django-cfg 1.5.8__py3-none-any.whl → 1.5.14__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.
Potentially problematic release.
This version of django-cfg might be problematic. Click here for more details.
- django_cfg/__init__.py +1 -1
- django_cfg/apps/api/commands/serializers.py +152 -0
- django_cfg/apps/api/commands/views.py +32 -0
- django_cfg/apps/business/accounts/management/commands/otp_test.py +5 -2
- django_cfg/apps/business/agents/management/commands/create_agent.py +5 -194
- django_cfg/apps/business/agents/management/commands/load_agent_templates.py +205 -0
- django_cfg/apps/business/agents/management/commands/orchestrator_status.py +4 -2
- django_cfg/apps/business/knowbase/management/commands/knowbase_stats.py +4 -2
- django_cfg/apps/business/knowbase/management/commands/setup_knowbase.py +4 -2
- django_cfg/apps/business/newsletter/management/commands/test_newsletter.py +5 -2
- django_cfg/apps/business/payments/management/commands/check_payment_status.py +4 -2
- django_cfg/apps/business/payments/management/commands/create_payment.py +4 -2
- django_cfg/apps/business/payments/management/commands/sync_currencies.py +4 -2
- django_cfg/apps/integrations/centrifugo/management/commands/generate_centrifugo_clients.py +5 -5
- django_cfg/apps/integrations/centrifugo/serializers/__init__.py +2 -1
- django_cfg/apps/integrations/centrifugo/serializers/publishes.py +22 -2
- django_cfg/apps/integrations/centrifugo/views/monitoring.py +25 -40
- django_cfg/apps/integrations/grpc/admin/__init__.py +7 -1
- django_cfg/apps/integrations/grpc/admin/config.py +113 -9
- django_cfg/apps/integrations/grpc/admin/grpc_api_key.py +129 -0
- django_cfg/apps/integrations/grpc/admin/grpc_request_log.py +72 -63
- django_cfg/apps/integrations/grpc/admin/grpc_server_status.py +236 -0
- django_cfg/apps/integrations/grpc/auth/__init__.py +11 -3
- django_cfg/apps/integrations/grpc/auth/api_key_auth.py +320 -0
- django_cfg/apps/integrations/grpc/interceptors/logging.py +17 -20
- django_cfg/apps/integrations/grpc/interceptors/metrics.py +15 -14
- django_cfg/apps/integrations/grpc/interceptors/request_logger.py +79 -59
- django_cfg/apps/integrations/grpc/management/commands/generate_protos.py +130 -0
- django_cfg/apps/integrations/grpc/management/commands/rungrpc.py +171 -96
- django_cfg/apps/integrations/grpc/management/commands/test_grpc_integration.py +75 -0
- django_cfg/apps/integrations/grpc/managers/__init__.py +2 -0
- django_cfg/apps/integrations/grpc/managers/grpc_api_key.py +192 -0
- django_cfg/apps/integrations/grpc/managers/grpc_server_status.py +19 -11
- django_cfg/apps/integrations/grpc/migrations/0005_grpcapikey.py +143 -0
- django_cfg/apps/integrations/grpc/migrations/0006_grpcrequestlog_api_key_and_more.py +34 -0
- django_cfg/apps/integrations/grpc/models/__init__.py +2 -0
- django_cfg/apps/integrations/grpc/models/grpc_api_key.py +198 -0
- django_cfg/apps/integrations/grpc/models/grpc_request_log.py +11 -0
- django_cfg/apps/integrations/grpc/models/grpc_server_status.py +39 -4
- django_cfg/apps/integrations/grpc/serializers/__init__.py +22 -6
- django_cfg/apps/integrations/grpc/serializers/api_keys.py +63 -0
- django_cfg/apps/integrations/grpc/serializers/charts.py +118 -120
- django_cfg/apps/integrations/grpc/serializers/config.py +65 -51
- django_cfg/apps/integrations/grpc/serializers/health.py +7 -7
- django_cfg/apps/integrations/grpc/serializers/proto_files.py +74 -0
- django_cfg/apps/integrations/grpc/serializers/requests.py +13 -7
- django_cfg/apps/integrations/grpc/serializers/service_registry.py +181 -112
- django_cfg/apps/integrations/grpc/serializers/services.py +14 -32
- django_cfg/apps/integrations/grpc/serializers/stats.py +50 -12
- django_cfg/apps/integrations/grpc/serializers/testing.py +66 -58
- django_cfg/apps/integrations/grpc/services/__init__.py +2 -0
- django_cfg/apps/integrations/grpc/services/monitoring_service.py +149 -43
- django_cfg/apps/integrations/grpc/services/proto_files_manager.py +268 -0
- django_cfg/apps/integrations/grpc/services/service_registry.py +48 -46
- django_cfg/apps/integrations/grpc/services/testing_service.py +10 -15
- django_cfg/apps/integrations/grpc/urls.py +8 -0
- django_cfg/apps/integrations/grpc/utils/__init__.py +4 -13
- django_cfg/apps/integrations/grpc/utils/integration_test.py +334 -0
- django_cfg/apps/integrations/grpc/utils/proto_gen.py +48 -8
- django_cfg/apps/integrations/grpc/utils/streaming_logger.py +177 -0
- django_cfg/apps/integrations/grpc/views/__init__.py +4 -0
- django_cfg/apps/integrations/grpc/views/api_keys.py +255 -0
- django_cfg/apps/integrations/grpc/views/charts.py +21 -14
- django_cfg/apps/integrations/grpc/views/config.py +8 -6
- django_cfg/apps/integrations/grpc/views/monitoring.py +51 -79
- django_cfg/apps/integrations/grpc/views/proto_files.py +214 -0
- django_cfg/apps/integrations/grpc/views/services.py +30 -21
- django_cfg/apps/integrations/grpc/views/testing.py +45 -43
- django_cfg/apps/integrations/rq/views/jobs.py +19 -9
- django_cfg/apps/integrations/rq/views/schedule.py +7 -3
- django_cfg/apps/system/dashboard/serializers/commands.py +25 -1
- django_cfg/apps/system/dashboard/services/commands_service.py +12 -1
- django_cfg/apps/system/maintenance/management/commands/maintenance.py +5 -2
- django_cfg/apps/system/maintenance/management/commands/process_scheduled_maintenance.py +4 -2
- django_cfg/apps/system/maintenance/management/commands/sync_cloudflare.py +5 -2
- django_cfg/config.py +33 -0
- django_cfg/core/generation/integration_generators/grpc_generator.py +30 -32
- django_cfg/management/commands/check_endpoints.py +2 -2
- django_cfg/management/commands/check_settings.py +3 -10
- django_cfg/management/commands/clear_constance.py +3 -10
- django_cfg/management/commands/create_token.py +4 -11
- django_cfg/management/commands/list_urls.py +4 -10
- django_cfg/management/commands/migrate_all.py +18 -12
- django_cfg/management/commands/migrator.py +4 -11
- django_cfg/management/commands/script.py +4 -10
- django_cfg/management/commands/show_config.py +8 -16
- django_cfg/management/commands/show_urls.py +5 -11
- django_cfg/management/commands/superuser.py +4 -11
- django_cfg/management/commands/tree.py +5 -10
- django_cfg/management/utils/README.md +402 -0
- django_cfg/management/utils/__init__.py +29 -0
- django_cfg/management/utils/mixins.py +176 -0
- django_cfg/middleware/pagination.py +53 -54
- django_cfg/models/api/grpc/__init__.py +15 -21
- django_cfg/models/api/grpc/config.py +155 -73
- django_cfg/models/ngrok/config.py +7 -6
- django_cfg/modules/django_client/core/generator/python/files_generator.py +5 -13
- django_cfg/modules/django_client/core/generator/python/templates/api_wrapper.py.jinja +16 -4
- django_cfg/modules/django_client/core/generator/python/templates/main_init.py.jinja +2 -3
- django_cfg/modules/django_client/core/generator/typescript/files_generator.py +6 -5
- django_cfg/modules/django_client/core/generator/typescript/templates/main_index.ts.jinja +12 -8
- django_cfg/modules/django_client/core/parser/base.py +114 -30
- django_cfg/modules/django_client/management/commands/generate_client.py +5 -2
- django_cfg/modules/django_client/management/commands/validate_openapi.py +5 -2
- django_cfg/modules/django_email/management/commands/test_email.py +4 -10
- django_cfg/modules/django_ngrok/management/commands/runserver_ngrok.py +16 -13
- django_cfg/modules/django_telegram/management/commands/test_telegram.py +4 -11
- django_cfg/modules/django_twilio/management/commands/test_twilio.py +4 -11
- django_cfg/modules/django_unfold/navigation.py +6 -18
- django_cfg/pyproject.toml +1 -1
- django_cfg/registry/modules.py +1 -4
- django_cfg/requirements.txt +52 -0
- django_cfg/static/frontend/admin.zip +0 -0
- {django_cfg-1.5.8.dist-info → django_cfg-1.5.14.dist-info}/METADATA +1 -1
- {django_cfg-1.5.8.dist-info → django_cfg-1.5.14.dist-info}/RECORD +118 -97
- django_cfg/apps/integrations/grpc/auth/jwt_auth.py +0 -295
- {django_cfg-1.5.8.dist-info → django_cfg-1.5.14.dist-info}/WHEEL +0 -0
- {django_cfg-1.5.8.dist-info → django_cfg-1.5.14.dist-info}/entry_points.txt +0 -0
- {django_cfg-1.5.8.dist-info → django_cfg-1.5.14.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,97 +1,111 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
2
|
+
DRF serializers for gRPC configuration and server info.
|
|
3
3
|
|
|
4
4
|
These serializers define the structure for configuration and server
|
|
5
5
|
information endpoints.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
from
|
|
8
|
+
from rest_framework import serializers
|
|
9
9
|
|
|
10
|
-
from pydantic import BaseModel, Field
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
class GRPCServerConfigSerializer(BaseModel):
|
|
11
|
+
class GRPCServerConfigSerializer(serializers.Serializer):
|
|
14
12
|
"""gRPC server configuration details."""
|
|
15
13
|
|
|
16
|
-
host
|
|
17
|
-
port
|
|
18
|
-
enabled
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
host = serializers.CharField(help_text="Server host address")
|
|
15
|
+
port = serializers.IntegerField(help_text="Server port")
|
|
16
|
+
enabled = serializers.BooleanField(help_text="Whether gRPC server is enabled")
|
|
17
|
+
max_concurrent_streams = serializers.IntegerField(
|
|
18
|
+
allow_null=True, required=False, help_text="Maximum concurrent streams (async server)"
|
|
19
|
+
)
|
|
20
|
+
max_concurrent_rpcs = serializers.IntegerField(
|
|
21
|
+
allow_null=True, required=False, help_text="Maximum concurrent RPCs"
|
|
22
22
|
)
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
class GRPCFrameworkConfigSerializer(
|
|
25
|
+
class GRPCFrameworkConfigSerializer(serializers.Serializer):
|
|
26
26
|
"""gRPC framework configuration details."""
|
|
27
27
|
|
|
28
|
-
enabled
|
|
29
|
-
auto_discover
|
|
30
|
-
services_path
|
|
31
|
-
interceptors
|
|
32
|
-
|
|
28
|
+
enabled = serializers.BooleanField(help_text="Whether framework is enabled")
|
|
29
|
+
auto_discover = serializers.BooleanField(help_text="Auto-discover services")
|
|
30
|
+
services_path = serializers.CharField(help_text="Services discovery path pattern")
|
|
31
|
+
interceptors = serializers.ListField(
|
|
32
|
+
child=serializers.CharField(),
|
|
33
|
+
default=list,
|
|
34
|
+
help_text="Registered interceptors",
|
|
33
35
|
)
|
|
34
36
|
|
|
35
37
|
|
|
36
|
-
class GRPCFeaturesSerializer(
|
|
38
|
+
class GRPCFeaturesSerializer(serializers.Serializer):
|
|
37
39
|
"""gRPC features configuration."""
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
request_logging
|
|
41
|
-
metrics
|
|
42
|
-
reflection
|
|
41
|
+
api_key_auth = serializers.BooleanField(help_text="API key authentication enabled")
|
|
42
|
+
request_logging = serializers.BooleanField(help_text="Request logging enabled")
|
|
43
|
+
metrics = serializers.BooleanField(help_text="Metrics collection enabled")
|
|
44
|
+
reflection = serializers.BooleanField(help_text="gRPC reflection enabled")
|
|
43
45
|
|
|
44
46
|
|
|
45
|
-
class GRPCConfigSerializer(
|
|
47
|
+
class GRPCConfigSerializer(serializers.Serializer):
|
|
46
48
|
"""Complete gRPC configuration response."""
|
|
47
49
|
|
|
48
|
-
server
|
|
49
|
-
framework
|
|
50
|
-
|
|
50
|
+
server = GRPCServerConfigSerializer(help_text="Server configuration")
|
|
51
|
+
framework = GRPCFrameworkConfigSerializer(help_text="Framework configuration")
|
|
52
|
+
features = GRPCFeaturesSerializer(help_text="Feature flags")
|
|
53
|
+
registered_services = serializers.IntegerField(
|
|
54
|
+
help_text="Number of registered services"
|
|
51
55
|
)
|
|
52
|
-
|
|
53
|
-
registered_services: int = Field(..., description="Number of registered services")
|
|
54
|
-
total_methods: int = Field(..., description="Total number of methods")
|
|
56
|
+
total_methods = serializers.IntegerField(help_text="Total number of methods")
|
|
55
57
|
|
|
56
58
|
|
|
57
|
-
class GRPCServiceInfoSerializer(
|
|
59
|
+
class GRPCServiceInfoSerializer(serializers.Serializer):
|
|
58
60
|
"""Information about a single gRPC service."""
|
|
59
61
|
|
|
60
|
-
name
|
|
61
|
-
methods
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
name = serializers.CharField(help_text="Service name")
|
|
63
|
+
methods = serializers.ListField(
|
|
64
|
+
child=serializers.CharField(), default=list, help_text="Service methods"
|
|
65
|
+
)
|
|
66
|
+
full_name = serializers.CharField(help_text="Full service name with package")
|
|
67
|
+
description = serializers.CharField(
|
|
68
|
+
default="", allow_blank=True, help_text="Service description"
|
|
69
|
+
)
|
|
64
70
|
|
|
65
71
|
|
|
66
|
-
class GRPCInterceptorInfoSerializer(
|
|
72
|
+
class GRPCInterceptorInfoSerializer(serializers.Serializer):
|
|
67
73
|
"""Information about an interceptor."""
|
|
68
74
|
|
|
69
|
-
name
|
|
70
|
-
enabled
|
|
75
|
+
name = serializers.CharField(help_text="Interceptor name")
|
|
76
|
+
enabled = serializers.BooleanField(help_text="Whether interceptor is enabled")
|
|
71
77
|
|
|
72
78
|
|
|
73
|
-
class GRPCStatsSerializer(
|
|
79
|
+
class GRPCStatsSerializer(serializers.Serializer):
|
|
74
80
|
"""Runtime statistics summary."""
|
|
75
81
|
|
|
76
|
-
total_requests
|
|
77
|
-
success_rate
|
|
78
|
-
avg_duration_ms
|
|
82
|
+
total_requests = serializers.IntegerField(help_text="Total number of requests")
|
|
83
|
+
success_rate = serializers.FloatField(help_text="Success rate percentage")
|
|
84
|
+
avg_duration_ms = serializers.FloatField(
|
|
85
|
+
help_text="Average duration in milliseconds"
|
|
86
|
+
)
|
|
79
87
|
|
|
80
88
|
|
|
81
|
-
class GRPCServerInfoSerializer(
|
|
89
|
+
class GRPCServerInfoSerializer(serializers.Serializer):
|
|
82
90
|
"""Complete gRPC server information response."""
|
|
83
91
|
|
|
84
|
-
server_status
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
92
|
+
server_status = serializers.CharField(
|
|
93
|
+
help_text="Server status (running, stopped)"
|
|
94
|
+
)
|
|
95
|
+
address = serializers.CharField(help_text="Server address (host:port)")
|
|
96
|
+
started_at = serializers.CharField(
|
|
97
|
+
allow_null=True, required=False, help_text="Server start timestamp"
|
|
98
|
+
)
|
|
99
|
+
uptime_seconds = serializers.IntegerField(
|
|
100
|
+
allow_null=True, required=False, help_text="Server uptime in seconds"
|
|
101
|
+
)
|
|
102
|
+
services = GRPCServiceInfoSerializer(
|
|
103
|
+
many=True, default=list, help_text="Registered services"
|
|
90
104
|
)
|
|
91
|
-
interceptors
|
|
92
|
-
|
|
105
|
+
interceptors = GRPCInterceptorInfoSerializer(
|
|
106
|
+
many=True, default=list, help_text="Active interceptors"
|
|
93
107
|
)
|
|
94
|
-
stats
|
|
108
|
+
stats = GRPCStatsSerializer(help_text="Runtime statistics")
|
|
95
109
|
|
|
96
110
|
|
|
97
111
|
__all__ = [
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
Health check serializer for gRPC monitoring API.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from rest_framework import serializers
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class GRPCHealthCheckSerializer(
|
|
8
|
+
class GRPCHealthCheckSerializer(serializers.Serializer):
|
|
9
9
|
"""gRPC health check response."""
|
|
10
10
|
|
|
11
|
-
status
|
|
12
|
-
server_host
|
|
13
|
-
server_port
|
|
14
|
-
enabled
|
|
15
|
-
timestamp
|
|
11
|
+
status = serializers.CharField(help_text="Health status: healthy or unhealthy")
|
|
12
|
+
server_host = serializers.CharField(help_text="Configured gRPC server host")
|
|
13
|
+
server_port = serializers.IntegerField(help_text="Configured gRPC server port")
|
|
14
|
+
enabled = serializers.BooleanField(help_text="Whether gRPC is enabled")
|
|
15
|
+
timestamp = serializers.CharField(help_text="Current timestamp")
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
__all__ = ["GRPCHealthCheckSerializer"]
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Serializers for gRPC proto files API.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from rest_framework import serializers
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ProtoFileDetailSerializer(serializers.Serializer):
|
|
9
|
+
"""Proto file metadata."""
|
|
10
|
+
|
|
11
|
+
app_label = serializers.CharField()
|
|
12
|
+
filename = serializers.CharField()
|
|
13
|
+
size_bytes = serializers.IntegerField()
|
|
14
|
+
package = serializers.CharField(allow_blank=True)
|
|
15
|
+
messages_count = serializers.IntegerField()
|
|
16
|
+
services_count = serializers.IntegerField()
|
|
17
|
+
created_at = serializers.FloatField()
|
|
18
|
+
modified_at = serializers.FloatField()
|
|
19
|
+
download_url = serializers.CharField(
|
|
20
|
+
required=False,
|
|
21
|
+
help_text="API endpoint to download this proto file"
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ProtoFileListSerializer(serializers.Serializer):
|
|
26
|
+
"""List of proto files."""
|
|
27
|
+
|
|
28
|
+
files = ProtoFileDetailSerializer(many=True)
|
|
29
|
+
total_files = serializers.IntegerField()
|
|
30
|
+
proto_dir = serializers.CharField()
|
|
31
|
+
download_all_url = serializers.CharField(
|
|
32
|
+
required=False,
|
|
33
|
+
help_text="API endpoint to download all proto files as .zip archive"
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ProtoGenerateRequestSerializer(serializers.Serializer):
|
|
38
|
+
"""Request to generate proto files."""
|
|
39
|
+
|
|
40
|
+
apps = serializers.ListField(
|
|
41
|
+
child=serializers.CharField(),
|
|
42
|
+
required=False,
|
|
43
|
+
help_text="List of app labels to generate protos for (uses enabled_apps from config if not specified)",
|
|
44
|
+
)
|
|
45
|
+
force = serializers.BooleanField(
|
|
46
|
+
default=False,
|
|
47
|
+
required=False,
|
|
48
|
+
help_text="Force regeneration even if proto file exists",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class ProtoGenerateErrorSerializer(serializers.Serializer):
|
|
53
|
+
"""Proto generation error."""
|
|
54
|
+
|
|
55
|
+
app = serializers.CharField()
|
|
56
|
+
error = serializers.CharField()
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class ProtoGenerateResponseSerializer(serializers.Serializer):
|
|
60
|
+
"""Response from proto generation."""
|
|
61
|
+
|
|
62
|
+
status = serializers.CharField()
|
|
63
|
+
generated = serializers.ListField(child=serializers.CharField())
|
|
64
|
+
generated_count = serializers.IntegerField()
|
|
65
|
+
errors = ProtoGenerateErrorSerializer(many=True)
|
|
66
|
+
proto_dir = serializers.CharField()
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
__all__ = [
|
|
70
|
+
"ProtoFileDetailSerializer",
|
|
71
|
+
"ProtoFileListSerializer",
|
|
72
|
+
"ProtoGenerateRequestSerializer",
|
|
73
|
+
"ProtoGenerateResponseSerializer",
|
|
74
|
+
]
|
|
@@ -2,17 +2,23 @@
|
|
|
2
2
|
Requests serializers for gRPC monitoring API.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
-
from
|
|
5
|
+
from rest_framework import serializers
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class RecentRequestsSerializer(
|
|
8
|
+
class RecentRequestsSerializer(serializers.Serializer):
|
|
9
9
|
"""Recent gRPC requests list."""
|
|
10
10
|
|
|
11
|
-
requests
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
requests = serializers.ListField(
|
|
12
|
+
child=serializers.DictField(), help_text="List of recent requests"
|
|
13
|
+
)
|
|
14
|
+
count = serializers.IntegerField(help_text="Number of requests returned")
|
|
15
|
+
total_available = serializers.IntegerField(help_text="Total requests available")
|
|
16
|
+
offset = serializers.IntegerField(
|
|
17
|
+
default=0, help_text="Current offset for pagination"
|
|
18
|
+
)
|
|
19
|
+
has_more = serializers.BooleanField(
|
|
20
|
+
default=False, help_text="Whether more results are available"
|
|
21
|
+
)
|
|
16
22
|
|
|
17
23
|
|
|
18
24
|
__all__ = ["RecentRequestsSerializer"]
|