timber-common 0.3.2__tar.gz → 0.3.3__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.
- {timber_common-0.3.2 → timber_common-0.3.3}/PKG-INFO +1 -1
- timber_common-0.3.3/common/services/integrations/__init__.py +279 -0
- timber_common-0.3.3/common/services/integrations/auth_service.py +603 -0
- timber_common-0.3.3/common/services/integrations/integration_service.py +744 -0
- timber_common-0.3.3/common/services/integrations/mapping_service.py +626 -0
- timber_common-0.3.3/common/services/integrations/models.py +399 -0
- timber_common-0.3.3/common/services/integrations/registry.py +512 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/config.py +306 -1
- {timber_common-0.3.2 → timber_common-0.3.3}/pyproject.toml +1 -1
- {timber_common-0.3.2 → timber_common-0.3.3}/CHANGELOG.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/LICENSE +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/README.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/config/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/config/model_loader.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/engine/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/engine/config_executor.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/engine/operation_registry.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/init.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/models/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/models/base.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/models/configs/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/models/core/__init.__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/models/core/tag.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/models/core/user.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/models/factory.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/models/mixins.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/models/registry.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/communication/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/communication/email_service.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/communication/messaging_service.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/communication/sms_service.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_fetcher/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_fetcher/alphavantage.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_fetcher/base.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_fetcher/curated_data.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_fetcher/polygon.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_fetcher/stock.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_fetcher/yfinance.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_processor/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_processor/portfolio_metrics.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_processor/returns.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_processor/risk_metrics.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_processor/standardization.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/data_processor/technical_indicators.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/db_service.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/decisioning/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/decisioning/decision_engine.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/decisioning/expression_engine.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/decisioning/graph_evaluator.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/decisioning/models.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/decisioning/table_evaluator.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/encryption/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/encryption/field_encryption.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/forecasting/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/forecasting/context.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/forecasting/core.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/forecasting/ensemble.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/forecasting/models.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/forecasting/service.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/forecasting/signals.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/gdpr/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/gdpr/deletion.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/inventory/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/inventory/available_capabilities.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/inventory/cached_capabilities.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/inventory/loader.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/llm/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/llm/base.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/llm/claude_provider.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/llm/gemini_provider.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/llm/groq_provider.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/llm/model_choice.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/llm/perplexity_provider.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/llm_service.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/DIRECTORY_STRUCTURE.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/MIGRATION_GUIDE.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/QUICKSTART.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/README.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/VIDEO_README.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/config_helpers.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/examples.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/image_generation.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/video_examples.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/media/video_generation.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/persistence/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/persistence/base.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/persistence/cache.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/persistence/instances.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/persistence/manager.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/persistence/notification.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/persistence/research.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/persistence/session.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/persistence/tracker.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/security/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/security/oauth_service.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/vector/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/vector/auto_ingestion.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/vector/search.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/vector/tag_embedding.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/vendors/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/vendors/plaid_service.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/services/vendors/stripe_service.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/db_utils.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/decisioning/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/decisioning/csv_parser.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/decisioning/dmn_parser.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/decisioning/yaml_exporter.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/decisioning/yaml_parser.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/helpers.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/llm/chunk_aggregator.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/llm/content_condenser.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/llm/content_handler.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/llm/hierarchical_summarizer.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/serialization_helpers.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/time_helpers.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/common/utils/validators.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/data/models/00_association_tables.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/data/models/cache_models.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/data/models/messaging_models.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/data/models/narrative_models.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/data/models/notification_models.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/data/models/oauth_models.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/data/models/portfolio_models.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/data/models/stock_research_models.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/data/models/user_preferences_models.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/data/models/vector_db_models.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/DOCUMENTATION_INDEX.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/DOCUMENTATION_SUMMARY.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/PROGRESS_UPDATE.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/TIMBER_SESSION_API_REFERENCE.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/best_practices/01_model_design_patterns.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/best_practices/02_service_architecture.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/best_practices/03_data_fetching_strategies.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/best_practices/04_caching_strategies.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/best_practices/05_error_handling.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/best_practices/06_performance_optimization.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/best_practices/07_security_best_practices.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/design_guides/01_system_architecture.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/design_guides/02_config_driven_models.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/design_guides/03_persistence_layer.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/design_guides/04_vector_integration.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/design_guides/05_multi_app_support.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/how_to/01_getting_started.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/how_to/02_creating_models.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/how_to/03_using_services.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/how_to/04_financial_data_fetching.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/how_to/05_encryption_and_security.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/how_to/06_vector_search.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/how_to/07_gdpr_compliance.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/documentation/how_to/08_testing_guide.md +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/modules/__init__.py +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/modules/config/custom_analysis.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/modules/config/investing_operations_config.yaml +0 -0
- {timber_common-0.3.2 → timber_common-0.3.3}/modules/investing_operations.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: timber-common
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Configuration-driven persistence library with ml tools (finance related) config driven db model registration, llm model choice, automatic encryption, caching, vector search, and GDPR compliance for Python applications
|
|
5
5
|
License: MIT
|
|
6
6
|
License-File: LICENSE
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
# common/services/integrations/__init__.py
|
|
2
|
+
"""
|
|
3
|
+
Integration Factory
|
|
4
|
+
|
|
5
|
+
A configuration-driven integration system that:
|
|
6
|
+
- Loads integration definitions from YAML files
|
|
7
|
+
- Manages credentials separately for reuse
|
|
8
|
+
- Handles multiple authentication types (Basic, API Key, OAuth2, etc.)
|
|
9
|
+
- Maps request/response data using field mappings
|
|
10
|
+
- Provides caching, retry, and circuit breaker patterns
|
|
11
|
+
|
|
12
|
+
Quick Start:
|
|
13
|
+
|
|
14
|
+
from common.services.integrations import (
|
|
15
|
+
integration_service,
|
|
16
|
+
initialize_integrations,
|
|
17
|
+
call_integration,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Initialize at startup
|
|
21
|
+
await initialize_integrations(
|
|
22
|
+
config_path='config/integrations/integration_config.yaml',
|
|
23
|
+
base_dir='/app',
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Execute an integration
|
|
27
|
+
response = await call_integration(
|
|
28
|
+
'alpha_vantage_quote',
|
|
29
|
+
params={'symbol': 'AAPL'},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
if response.success:
|
|
33
|
+
print(f"Price: {response.data['price']}")
|
|
34
|
+
else:
|
|
35
|
+
print(f"Error: {response.error_message}")
|
|
36
|
+
|
|
37
|
+
Module Exports:
|
|
38
|
+
- IntegrationService: Main service class
|
|
39
|
+
- integration_service: Singleton service instance
|
|
40
|
+
- IntegrationRegistry: Registry for integrations
|
|
41
|
+
- integration_registry: Singleton registry instance
|
|
42
|
+
- AuthService: Authentication handling
|
|
43
|
+
- auth_service: Singleton auth instance
|
|
44
|
+
- MappingService: Field mapping
|
|
45
|
+
- mapping_service: Singleton mapping instance
|
|
46
|
+
|
|
47
|
+
Data Models:
|
|
48
|
+
- IntegrationRequest: Request to execute
|
|
49
|
+
- IntegrationResponse: Execution response
|
|
50
|
+
- Credential: Authentication credential
|
|
51
|
+
- IntegrationDefinition: Integration configuration
|
|
52
|
+
|
|
53
|
+
Utility Functions:
|
|
54
|
+
- initialize_integrations(): Initialize the system
|
|
55
|
+
- call_integration(): Execute an integration
|
|
56
|
+
- get_integration(): Get integration by ID
|
|
57
|
+
- list_integrations(): List available integrations
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
from .models import (
|
|
61
|
+
# Enums
|
|
62
|
+
AuthType,
|
|
63
|
+
HttpMethod,
|
|
64
|
+
ParamLocation,
|
|
65
|
+
FieldType,
|
|
66
|
+
CircuitState,
|
|
67
|
+
|
|
68
|
+
# Credential models
|
|
69
|
+
Credential,
|
|
70
|
+
BasicAuthConfig,
|
|
71
|
+
ApiKeyConfig,
|
|
72
|
+
OAuth2ClientCredentialsConfig,
|
|
73
|
+
OAuth2AuthCodeConfig,
|
|
74
|
+
BearerTokenConfig,
|
|
75
|
+
CustomHeadersConfig,
|
|
76
|
+
AwsSignatureConfig,
|
|
77
|
+
CertificateConfig,
|
|
78
|
+
|
|
79
|
+
# Integration models
|
|
80
|
+
IntegrationDefinition,
|
|
81
|
+
ConnectionConfig,
|
|
82
|
+
RetryConfig,
|
|
83
|
+
EndpointConfig,
|
|
84
|
+
RequestConfig,
|
|
85
|
+
ResponseConfig,
|
|
86
|
+
BodyConfig,
|
|
87
|
+
FieldMapping,
|
|
88
|
+
CacheConfig,
|
|
89
|
+
RateLimitConfig,
|
|
90
|
+
|
|
91
|
+
# Execution models
|
|
92
|
+
IntegrationRequest,
|
|
93
|
+
IntegrationResponse,
|
|
94
|
+
CachedToken,
|
|
95
|
+
CircuitBreakerState,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
from .registry import (
|
|
99
|
+
IntegrationRegistry,
|
|
100
|
+
integration_registry,
|
|
101
|
+
get_integration,
|
|
102
|
+
get_credential,
|
|
103
|
+
list_integrations as registry_list_integrations,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
from .auth_service import (
|
|
107
|
+
AuthService,
|
|
108
|
+
auth_service,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
from .mapping_service import (
|
|
112
|
+
MappingService,
|
|
113
|
+
mapping_service,
|
|
114
|
+
register_transformer,
|
|
115
|
+
TRANSFORMERS,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
from .integration_service import (
|
|
119
|
+
IntegrationService,
|
|
120
|
+
integration_service,
|
|
121
|
+
call_integration,
|
|
122
|
+
initialize_from_config,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
from typing import Dict, Any, List, Optional
|
|
126
|
+
import logging
|
|
127
|
+
|
|
128
|
+
logger = logging.getLogger(__name__)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
# =============================================================================
|
|
132
|
+
# CONVENIENCE FUNCTIONS
|
|
133
|
+
# =============================================================================
|
|
134
|
+
|
|
135
|
+
async def initialize_integrations(
|
|
136
|
+
config_path: Optional[str] = None,
|
|
137
|
+
credential_paths: Optional[List[str]] = None,
|
|
138
|
+
integration_paths: Optional[List[str]] = None,
|
|
139
|
+
base_dir: Optional[str] = None,
|
|
140
|
+
use_config: bool = True,
|
|
141
|
+
) -> Dict[str, Any]:
|
|
142
|
+
"""
|
|
143
|
+
Initialize the integration factory.
|
|
144
|
+
|
|
145
|
+
Should be called once at application startup.
|
|
146
|
+
|
|
147
|
+
Args:
|
|
148
|
+
config_path: Path to integration_config.yaml
|
|
149
|
+
credential_paths: Paths to credential YAML files
|
|
150
|
+
integration_paths: Paths to integration definition YAML files
|
|
151
|
+
base_dir: Base directory for relative paths
|
|
152
|
+
use_config: If True and no paths provided, use Config singleton
|
|
153
|
+
|
|
154
|
+
Returns:
|
|
155
|
+
Initialization summary with counts of loaded items
|
|
156
|
+
|
|
157
|
+
Example:
|
|
158
|
+
# Option 1: Use unified Config (recommended)
|
|
159
|
+
summary = await initialize_integrations()
|
|
160
|
+
|
|
161
|
+
# Option 2: Explicit paths
|
|
162
|
+
summary = await initialize_integrations(
|
|
163
|
+
credential_paths=['config/integrations/credentials/'],
|
|
164
|
+
integration_paths=['config/integrations/definitions/'],
|
|
165
|
+
base_dir='/app',
|
|
166
|
+
use_config=False,
|
|
167
|
+
)
|
|
168
|
+
"""
|
|
169
|
+
# If no explicit paths and use_config enabled, try to use Config
|
|
170
|
+
if use_config and not any([config_path, credential_paths, integration_paths]):
|
|
171
|
+
return await initialize_from_config()
|
|
172
|
+
|
|
173
|
+
# Otherwise use explicit paths
|
|
174
|
+
return await integration_service.initialize(
|
|
175
|
+
config_path=config_path,
|
|
176
|
+
credential_paths=credential_paths,
|
|
177
|
+
integration_paths=integration_paths,
|
|
178
|
+
base_dir=base_dir,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
async def shutdown_integrations():
|
|
183
|
+
"""
|
|
184
|
+
Shutdown the integration factory.
|
|
185
|
+
|
|
186
|
+
Should be called at application shutdown to release resources.
|
|
187
|
+
"""
|
|
188
|
+
await integration_service.close()
|
|
189
|
+
logger.info("Integration factory shutdown complete")
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def list_integrations(enabled_only: bool = True) -> List[Dict[str, Any]]:
|
|
193
|
+
"""
|
|
194
|
+
List available integrations.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
enabled_only: Only list enabled integrations
|
|
198
|
+
|
|
199
|
+
Returns:
|
|
200
|
+
List of integration summaries
|
|
201
|
+
"""
|
|
202
|
+
return integration_service.list_integrations(enabled_only=enabled_only)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def get_integration_stats() -> Dict[str, Any]:
|
|
206
|
+
"""
|
|
207
|
+
Get integration service statistics.
|
|
208
|
+
|
|
209
|
+
Returns:
|
|
210
|
+
Stats including call counts, cache hits, errors
|
|
211
|
+
"""
|
|
212
|
+
return integration_service.get_stats()
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
# =============================================================================
|
|
216
|
+
# EXPORTS
|
|
217
|
+
# =============================================================================
|
|
218
|
+
|
|
219
|
+
__all__ = [
|
|
220
|
+
# Enums
|
|
221
|
+
'AuthType',
|
|
222
|
+
'HttpMethod',
|
|
223
|
+
'ParamLocation',
|
|
224
|
+
'FieldType',
|
|
225
|
+
'CircuitState',
|
|
226
|
+
|
|
227
|
+
# Credential models
|
|
228
|
+
'Credential',
|
|
229
|
+
'BasicAuthConfig',
|
|
230
|
+
'ApiKeyConfig',
|
|
231
|
+
'OAuth2ClientCredentialsConfig',
|
|
232
|
+
'OAuth2AuthCodeConfig',
|
|
233
|
+
'BearerTokenConfig',
|
|
234
|
+
'CustomHeadersConfig',
|
|
235
|
+
'AwsSignatureConfig',
|
|
236
|
+
'CertificateConfig',
|
|
237
|
+
|
|
238
|
+
# Integration models
|
|
239
|
+
'IntegrationDefinition',
|
|
240
|
+
'ConnectionConfig',
|
|
241
|
+
'RetryConfig',
|
|
242
|
+
'EndpointConfig',
|
|
243
|
+
'RequestConfig',
|
|
244
|
+
'ResponseConfig',
|
|
245
|
+
'BodyConfig',
|
|
246
|
+
'FieldMapping',
|
|
247
|
+
'CacheConfig',
|
|
248
|
+
'RateLimitConfig',
|
|
249
|
+
|
|
250
|
+
# Execution models
|
|
251
|
+
'IntegrationRequest',
|
|
252
|
+
'IntegrationResponse',
|
|
253
|
+
'CachedToken',
|
|
254
|
+
'CircuitBreakerState',
|
|
255
|
+
|
|
256
|
+
# Services
|
|
257
|
+
'IntegrationService',
|
|
258
|
+
'integration_service',
|
|
259
|
+
'IntegrationRegistry',
|
|
260
|
+
'integration_registry',
|
|
261
|
+
'AuthService',
|
|
262
|
+
'auth_service',
|
|
263
|
+
'MappingService',
|
|
264
|
+
'mapping_service',
|
|
265
|
+
|
|
266
|
+
# Transformers
|
|
267
|
+
'register_transformer',
|
|
268
|
+
'TRANSFORMERS',
|
|
269
|
+
|
|
270
|
+
# Convenience functions
|
|
271
|
+
'initialize_integrations',
|
|
272
|
+
'initialize_from_config',
|
|
273
|
+
'shutdown_integrations',
|
|
274
|
+
'call_integration',
|
|
275
|
+
'get_integration',
|
|
276
|
+
'get_credential',
|
|
277
|
+
'list_integrations',
|
|
278
|
+
'get_integration_stats',
|
|
279
|
+
]
|