omnibase_infra 0.3.1__py3-none-any.whl → 0.3.2__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.
- omnibase_infra/__init__.py +1 -1
- omnibase_infra/enums/__init__.py +3 -0
- omnibase_infra/enums/enum_consumer_group_purpose.py +9 -0
- omnibase_infra/enums/enum_postgres_error_code.py +188 -0
- omnibase_infra/handlers/registration_storage/handler_registration_storage_postgres.py +29 -20
- omnibase_infra/mixins/__init__.py +14 -0
- omnibase_infra/mixins/mixin_postgres_error_response.py +314 -0
- omnibase_infra/mixins/mixin_postgres_op_executor.py +298 -0
- omnibase_infra/models/__init__.py +3 -0
- omnibase_infra/{nodes/effects/models → models}/model_backend_result.py +22 -6
- omnibase_infra/models/projection/__init__.py +11 -0
- omnibase_infra/models/projection/model_contract_projection.py +170 -0
- omnibase_infra/models/projection/model_topic_projection.py +148 -0
- omnibase_infra/nodes/contract_registry_reducer/__init__.py +5 -0
- omnibase_infra/nodes/contract_registry_reducer/contract_registration_event_router.py +689 -0
- omnibase_infra/nodes/effects/__init__.py +1 -1
- omnibase_infra/nodes/effects/models/__init__.py +6 -4
- omnibase_infra/nodes/effects/models/model_registry_response.py +1 -1
- omnibase_infra/nodes/effects/protocol_consul_client.py +1 -1
- omnibase_infra/nodes/effects/protocol_postgres_adapter.py +1 -1
- omnibase_infra/nodes/effects/registry_effect.py +1 -1
- omnibase_infra/nodes/node_contract_persistence_effect/__init__.py +101 -0
- omnibase_infra/nodes/node_contract_persistence_effect/contract.yaml +490 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/__init__.py +74 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_cleanup_topics.py +217 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_contract_upsert.py +242 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_deactivate.py +194 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_heartbeat.py +243 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_mark_stale.py +208 -0
- omnibase_infra/nodes/node_contract_persistence_effect/handlers/handler_postgres_topic_update.py +298 -0
- omnibase_infra/nodes/node_contract_persistence_effect/models/__init__.py +15 -0
- omnibase_infra/nodes/node_contract_persistence_effect/models/model_persistence_result.py +52 -0
- omnibase_infra/nodes/node_contract_persistence_effect/node.py +114 -0
- omnibase_infra/nodes/node_contract_persistence_effect/registry/__init__.py +27 -0
- omnibase_infra/nodes/node_contract_persistence_effect/registry/registry_infra_contract_persistence_effect.py +220 -0
- omnibase_infra/nodes/node_registry_effect/models/__init__.py +2 -2
- omnibase_infra/projectors/__init__.py +6 -0
- omnibase_infra/projectors/projection_reader_contract.py +1301 -0
- omnibase_infra/runtime/__init__.py +5 -0
- omnibase_infra/runtime/contract_registration_event_router.py +500 -0
- omnibase_infra/runtime/db/__init__.py +4 -0
- omnibase_infra/runtime/db/models/__init__.py +15 -10
- omnibase_infra/runtime/db/models/model_db_operation.py +40 -0
- omnibase_infra/runtime/db/models/model_db_param.py +24 -0
- omnibase_infra/runtime/db/models/model_db_repository_contract.py +40 -0
- omnibase_infra/runtime/db/models/model_db_return.py +26 -0
- omnibase_infra/runtime/db/models/model_db_safety_policy.py +32 -0
- omnibase_infra/runtime/intent_execution_router.py +430 -0
- omnibase_infra/runtime/models/__init__.py +6 -0
- omnibase_infra/runtime/models/model_contract_registry_config.py +41 -0
- omnibase_infra/runtime/models/model_intent_execution_summary.py +79 -0
- omnibase_infra/runtime/models/model_runtime_config.py +8 -0
- omnibase_infra/runtime/protocols/__init__.py +16 -0
- omnibase_infra/runtime/protocols/protocol_intent_executor.py +107 -0
- omnibase_infra/runtime/request_response_wiring.py +785 -0
- omnibase_infra/runtime/service_kernel.py +295 -8
- omnibase_infra/services/registry_api/models/__init__.py +25 -0
- omnibase_infra/services/registry_api/models/model_contract_ref.py +44 -0
- omnibase_infra/services/registry_api/models/model_contract_view.py +81 -0
- omnibase_infra/services/registry_api/models/model_response_contracts.py +50 -0
- omnibase_infra/services/registry_api/models/model_response_topics.py +50 -0
- omnibase_infra/services/registry_api/models/model_topic_summary.py +57 -0
- omnibase_infra/services/registry_api/models/model_topic_view.py +63 -0
- omnibase_infra/services/registry_api/routes.py +205 -6
- omnibase_infra/services/registry_api/service.py +528 -1
- omnibase_infra/validation/infra_validators.py +3 -1
- omnibase_infra/validation/validation_exemptions.yaml +54 -0
- {omnibase_infra-0.3.1.dist-info → omnibase_infra-0.3.2.dist-info}/METADATA +3 -3
- {omnibase_infra-0.3.1.dist-info → omnibase_infra-0.3.2.dist-info}/RECORD +72 -34
- {omnibase_infra-0.3.1.dist-info → omnibase_infra-0.3.2.dist-info}/WHEEL +0 -0
- {omnibase_infra-0.3.1.dist-info → omnibase_infra-0.3.2.dist-info}/entry_points.txt +0 -0
- {omnibase_infra-0.3.1.dist-info → omnibase_infra-0.3.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT
|
|
2
|
+
# Copyright (c) 2025 OmniNode Team
|
|
3
|
+
"""Registry for NodeContractPersistenceEffect infrastructure dependencies.
|
|
4
|
+
|
|
5
|
+
This registry provides factory methods for creating NodeContractPersistenceEffect
|
|
6
|
+
instances with their required dependencies resolved from the container.
|
|
7
|
+
|
|
8
|
+
Following ONEX naming conventions:
|
|
9
|
+
- File: registry_infra_<node_name>.py
|
|
10
|
+
- Class: RegistryInfra<NodeName>
|
|
11
|
+
|
|
12
|
+
The registry serves as the entry point for creating properly configured
|
|
13
|
+
effect node instances, documenting required protocols, and providing
|
|
14
|
+
node metadata for introspection.
|
|
15
|
+
|
|
16
|
+
Related:
|
|
17
|
+
- contract.yaml: Node contract defining operations and dependencies
|
|
18
|
+
- node.py: Declarative node implementation
|
|
19
|
+
- handlers/: PostgreSQL operation handlers
|
|
20
|
+
- OMN-1845: Implementation ticket
|
|
21
|
+
|
|
22
|
+
.. versionadded:: 0.5.0
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
from typing import TYPE_CHECKING
|
|
28
|
+
|
|
29
|
+
if TYPE_CHECKING:
|
|
30
|
+
from omnibase_core.models.container.model_onex_container import ModelONEXContainer
|
|
31
|
+
from omnibase_infra.nodes.node_contract_persistence_effect.node import (
|
|
32
|
+
NodeContractPersistenceEffect,
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class RegistryInfraContractPersistenceEffect:
|
|
37
|
+
"""Infrastructure registry for NodeContractPersistenceEffect.
|
|
38
|
+
|
|
39
|
+
Provides dependency resolution and factory methods for creating
|
|
40
|
+
properly configured NodeContractPersistenceEffect instances.
|
|
41
|
+
|
|
42
|
+
This registry follows the ONEX infrastructure registry pattern:
|
|
43
|
+
- Factory method for node creation with container injection
|
|
44
|
+
- Protocol requirements documentation for container validation
|
|
45
|
+
- Node type classification for routing decisions
|
|
46
|
+
- Capability listing for service discovery
|
|
47
|
+
|
|
48
|
+
Example:
|
|
49
|
+
>>> from omnibase_core.models.container import ModelONEXContainer
|
|
50
|
+
>>> from omnibase_infra.nodes.node_contract_persistence_effect.registry import (
|
|
51
|
+
... RegistryInfraContractPersistenceEffect,
|
|
52
|
+
... )
|
|
53
|
+
>>>
|
|
54
|
+
>>> # Create container with required protocols registered
|
|
55
|
+
>>> container = ModelONEXContainer()
|
|
56
|
+
>>> # ... register protocols ...
|
|
57
|
+
>>>
|
|
58
|
+
>>> # Create node instance via registry
|
|
59
|
+
>>> effect = RegistryInfraContractPersistenceEffect.create(container)
|
|
60
|
+
|
|
61
|
+
.. versionadded:: 0.5.0
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
@staticmethod
|
|
65
|
+
def create(container: ModelONEXContainer) -> NodeContractPersistenceEffect:
|
|
66
|
+
"""Create a NodeContractPersistenceEffect instance with resolved dependencies.
|
|
67
|
+
|
|
68
|
+
Factory method that creates a fully configured NodeContractPersistenceEffect
|
|
69
|
+
using the provided ONEX container for dependency injection.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
container: ONEX dependency injection container. Must have the
|
|
73
|
+
following protocols registered:
|
|
74
|
+
- ProtocolPostgresAdapter: PostgreSQL database operations
|
|
75
|
+
- ProtocolCircuitBreakerAware: Backend circuit breaker protection
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
Configured NodeContractPersistenceEffect instance ready for operation.
|
|
79
|
+
|
|
80
|
+
Raises:
|
|
81
|
+
OnexError: If required protocols are not registered in container.
|
|
82
|
+
|
|
83
|
+
Example:
|
|
84
|
+
>>> container = ModelONEXContainer()
|
|
85
|
+
>>> container.register(ProtocolPostgresAdapter, postgres_adapter)
|
|
86
|
+
>>> effect = RegistryInfraContractPersistenceEffect.create(container)
|
|
87
|
+
|
|
88
|
+
.. versionadded:: 0.5.0
|
|
89
|
+
"""
|
|
90
|
+
from omnibase_infra.nodes.node_contract_persistence_effect.node import (
|
|
91
|
+
NodeContractPersistenceEffect,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return NodeContractPersistenceEffect(container)
|
|
95
|
+
|
|
96
|
+
@staticmethod
|
|
97
|
+
def get_required_protocols() -> list[str]:
|
|
98
|
+
"""Get list of protocols required by this node.
|
|
99
|
+
|
|
100
|
+
Returns the protocol class names that must be registered in the
|
|
101
|
+
container before creating a NodeContractPersistenceEffect instance.
|
|
102
|
+
|
|
103
|
+
Returns:
|
|
104
|
+
List of protocol class names required for node operation.
|
|
105
|
+
|
|
106
|
+
Example:
|
|
107
|
+
>>> protocols = RegistryInfraContractPersistenceEffect.get_required_protocols()
|
|
108
|
+
>>> for proto in protocols:
|
|
109
|
+
... if not container.has(proto):
|
|
110
|
+
... raise ConfigurationError(f"Missing: {proto}")
|
|
111
|
+
|
|
112
|
+
.. versionadded:: 0.5.0
|
|
113
|
+
"""
|
|
114
|
+
return [
|
|
115
|
+
"ProtocolPostgresAdapter",
|
|
116
|
+
"ProtocolCircuitBreakerAware",
|
|
117
|
+
]
|
|
118
|
+
|
|
119
|
+
@staticmethod
|
|
120
|
+
def get_node_type() -> str:
|
|
121
|
+
"""Get the node type classification.
|
|
122
|
+
|
|
123
|
+
Returns the ONEX node archetype for this node, used for
|
|
124
|
+
routing decisions and execution context selection.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
Node type string ("EFFECT").
|
|
128
|
+
|
|
129
|
+
Note:
|
|
130
|
+
EFFECT nodes perform external I/O operations and should
|
|
131
|
+
be treated as side-effecting by the runtime.
|
|
132
|
+
|
|
133
|
+
.. versionadded:: 0.5.0
|
|
134
|
+
"""
|
|
135
|
+
return "EFFECT"
|
|
136
|
+
|
|
137
|
+
@staticmethod
|
|
138
|
+
def get_node_name() -> str:
|
|
139
|
+
"""Get the canonical node name.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
The node name as defined in contract.yaml.
|
|
143
|
+
|
|
144
|
+
.. versionadded:: 0.5.0
|
|
145
|
+
"""
|
|
146
|
+
return "node_contract_persistence_effect"
|
|
147
|
+
|
|
148
|
+
@staticmethod
|
|
149
|
+
def get_capabilities() -> list[str]:
|
|
150
|
+
"""Get list of capabilities provided by this node.
|
|
151
|
+
|
|
152
|
+
Returns capability identifiers that can be used for service
|
|
153
|
+
discovery and feature detection.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
List of capability identifiers.
|
|
157
|
+
|
|
158
|
+
.. versionadded:: 0.5.0
|
|
159
|
+
"""
|
|
160
|
+
return [
|
|
161
|
+
"contract_persistence",
|
|
162
|
+
"topic_routing",
|
|
163
|
+
"staleness_detection",
|
|
164
|
+
"heartbeat_tracking",
|
|
165
|
+
"soft_delete",
|
|
166
|
+
"circuit_breaker_protection",
|
|
167
|
+
]
|
|
168
|
+
|
|
169
|
+
@staticmethod
|
|
170
|
+
def get_supported_operations() -> list[str]:
|
|
171
|
+
"""Get list of operations supported by this node.
|
|
172
|
+
|
|
173
|
+
Returns:
|
|
174
|
+
List of operation identifiers as defined in contract.yaml.
|
|
175
|
+
|
|
176
|
+
.. versionadded:: 0.5.0
|
|
177
|
+
"""
|
|
178
|
+
return [
|
|
179
|
+
"upsert_contract",
|
|
180
|
+
"update_topic",
|
|
181
|
+
"mark_stale",
|
|
182
|
+
"update_heartbeat",
|
|
183
|
+
"deactivate_contract",
|
|
184
|
+
"cleanup_topic_references",
|
|
185
|
+
]
|
|
186
|
+
|
|
187
|
+
@staticmethod
|
|
188
|
+
def get_supported_intent_types() -> list[str]:
|
|
189
|
+
"""Get list of intent types routed by this node.
|
|
190
|
+
|
|
191
|
+
Returns the payload.intent_type values that this effect node
|
|
192
|
+
can handle, matching ContractRegistryReducer output.
|
|
193
|
+
|
|
194
|
+
Returns:
|
|
195
|
+
List of intent type strings.
|
|
196
|
+
|
|
197
|
+
.. versionadded:: 0.5.0
|
|
198
|
+
"""
|
|
199
|
+
return [
|
|
200
|
+
"postgres.upsert_contract",
|
|
201
|
+
"postgres.update_topic",
|
|
202
|
+
"postgres.mark_stale",
|
|
203
|
+
"postgres.update_heartbeat",
|
|
204
|
+
"postgres.deactivate_contract",
|
|
205
|
+
"postgres.cleanup_topic_references",
|
|
206
|
+
]
|
|
207
|
+
|
|
208
|
+
@staticmethod
|
|
209
|
+
def get_backends() -> list[str]:
|
|
210
|
+
"""Get list of backend types this node interacts with.
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
List of backend identifiers.
|
|
214
|
+
|
|
215
|
+
.. versionadded:: 0.5.0
|
|
216
|
+
"""
|
|
217
|
+
return ["postgres"]
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
__all__ = ["RegistryInfraContractPersistenceEffect"]
|
|
@@ -21,9 +21,9 @@ Related:
|
|
|
21
21
|
|
|
22
22
|
from __future__ import annotations
|
|
23
23
|
|
|
24
|
-
# Re-export shared
|
|
24
|
+
# Re-export shared models for convenience
|
|
25
|
+
from omnibase_infra.models import ModelBackendResult
|
|
25
26
|
from omnibase_infra.nodes.effects.models import (
|
|
26
|
-
ModelBackendResult,
|
|
27
27
|
ModelEffectIdempotencyConfig,
|
|
28
28
|
ModelRegistryRequest,
|
|
29
29
|
ModelRegistryResponse,
|
|
@@ -8,15 +8,20 @@ outputs to storage (PostgreSQL) and by orchestrators to query current
|
|
|
8
8
|
entity state.
|
|
9
9
|
|
|
10
10
|
Exports:
|
|
11
|
+
ProjectionReaderContract: Contract/topic projection reader for Registry API
|
|
11
12
|
ProjectionReaderRegistration: Registration projection reader implementation
|
|
12
13
|
SnapshotPublisherRegistration: Registration snapshot publisher for Kafka
|
|
13
14
|
|
|
14
15
|
Related Tickets:
|
|
16
|
+
- OMN-1845: Create ProjectionReaderContract for contract/topic queries
|
|
15
17
|
- OMN-947 (F2): Snapshot Publishing
|
|
16
18
|
- OMN-944 (F1): Implement Registration Projection Schema
|
|
17
19
|
- OMN-940 (F0): Define Projector Execution Model
|
|
18
20
|
"""
|
|
19
21
|
|
|
22
|
+
from omnibase_infra.projectors.projection_reader_contract import (
|
|
23
|
+
ProjectionReaderContract,
|
|
24
|
+
)
|
|
20
25
|
from omnibase_infra.projectors.projection_reader_registration import (
|
|
21
26
|
ProjectionReaderRegistration,
|
|
22
27
|
)
|
|
@@ -25,6 +30,7 @@ from omnibase_infra.projectors.snapshot_publisher_registration import (
|
|
|
25
30
|
)
|
|
26
31
|
|
|
27
32
|
__all__ = [
|
|
33
|
+
"ProjectionReaderContract",
|
|
28
34
|
"ProjectionReaderRegistration",
|
|
29
35
|
"SnapshotPublisherRegistration",
|
|
30
36
|
]
|