django-cfg 1.4.61__py3-none-any.whl → 1.4.63__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/accounts/services/otp_service.py +3 -14
- django_cfg/apps/centrifugo/__init__.py +57 -0
- django_cfg/apps/centrifugo/admin/__init__.py +13 -0
- django_cfg/apps/centrifugo/admin/centrifugo_log.py +249 -0
- django_cfg/apps/centrifugo/admin/config.py +82 -0
- django_cfg/apps/centrifugo/apps.py +31 -0
- django_cfg/apps/centrifugo/codegen/IMPLEMENTATION_SUMMARY.md +475 -0
- django_cfg/apps/centrifugo/codegen/README.md +242 -0
- django_cfg/apps/centrifugo/codegen/USAGE.md +616 -0
- django_cfg/apps/centrifugo/codegen/__init__.py +19 -0
- django_cfg/apps/centrifugo/codegen/discovery.py +246 -0
- django_cfg/apps/centrifugo/codegen/generators/go_thin/__init__.py +5 -0
- django_cfg/apps/centrifugo/codegen/generators/go_thin/generator.py +174 -0
- django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/README.md.j2 +182 -0
- django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/client.go.j2 +64 -0
- django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/go.mod.j2 +10 -0
- django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/rpc_client.go.j2 +300 -0
- django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/rpc_client.go.j2.old +267 -0
- django_cfg/apps/centrifugo/codegen/generators/go_thin/templates/types.go.j2 +16 -0
- django_cfg/apps/centrifugo/codegen/generators/python_thin/__init__.py +7 -0
- django_cfg/apps/centrifugo/codegen/generators/python_thin/generator.py +241 -0
- django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/README.md.j2 +128 -0
- django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/__init__.py.j2 +22 -0
- django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/client.py.j2 +73 -0
- django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/models.py.j2 +19 -0
- django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/requirements.txt.j2 +8 -0
- django_cfg/apps/centrifugo/codegen/generators/python_thin/templates/rpc_client.py.j2 +193 -0
- django_cfg/apps/centrifugo/codegen/generators/typescript_thin/__init__.py +5 -0
- django_cfg/apps/centrifugo/codegen/generators/typescript_thin/generator.py +124 -0
- django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/README.md.j2 +38 -0
- django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/client.ts.j2 +25 -0
- django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/index.ts.j2 +12 -0
- django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/package.json.j2 +13 -0
- django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/rpc-client.ts.j2 +137 -0
- django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/tsconfig.json.j2 +14 -0
- django_cfg/apps/centrifugo/codegen/generators/typescript_thin/templates/types.ts.j2 +9 -0
- django_cfg/apps/centrifugo/codegen/utils/__init__.py +37 -0
- django_cfg/apps/centrifugo/codegen/utils/naming.py +155 -0
- django_cfg/apps/centrifugo/codegen/utils/type_converter.py +349 -0
- django_cfg/apps/centrifugo/decorators.py +137 -0
- django_cfg/apps/centrifugo/management/__init__.py +1 -0
- django_cfg/apps/centrifugo/management/commands/__init__.py +1 -0
- django_cfg/apps/centrifugo/management/commands/generate_centrifugo_clients.py +254 -0
- django_cfg/apps/centrifugo/managers/__init__.py +12 -0
- django_cfg/apps/centrifugo/managers/centrifugo_log.py +264 -0
- django_cfg/apps/centrifugo/migrations/0001_initial.py +164 -0
- django_cfg/apps/centrifugo/migrations/__init__.py +3 -0
- django_cfg/apps/centrifugo/models/__init__.py +11 -0
- django_cfg/apps/centrifugo/models/centrifugo_log.py +210 -0
- django_cfg/apps/centrifugo/registry.py +106 -0
- django_cfg/apps/centrifugo/router.py +125 -0
- django_cfg/apps/centrifugo/serializers/__init__.py +40 -0
- django_cfg/apps/centrifugo/serializers/admin_api.py +264 -0
- django_cfg/apps/centrifugo/serializers/channels.py +26 -0
- django_cfg/apps/centrifugo/serializers/health.py +17 -0
- django_cfg/apps/centrifugo/serializers/publishes.py +16 -0
- django_cfg/apps/centrifugo/serializers/stats.py +21 -0
- django_cfg/apps/centrifugo/services/__init__.py +12 -0
- django_cfg/apps/centrifugo/services/client/__init__.py +29 -0
- django_cfg/apps/centrifugo/services/client/client.py +577 -0
- django_cfg/apps/centrifugo/services/client/config.py +228 -0
- django_cfg/apps/centrifugo/services/client/exceptions.py +212 -0
- django_cfg/apps/centrifugo/services/config_helper.py +63 -0
- django_cfg/apps/centrifugo/services/dashboard_notifier.py +157 -0
- django_cfg/apps/centrifugo/services/logging.py +677 -0
- django_cfg/apps/centrifugo/static/django_cfg_centrifugo/css/dashboard.css +260 -0
- django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/live_channels.mjs +313 -0
- django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/live_testing.mjs +803 -0
- django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/main.mjs +333 -0
- django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/overview.mjs +432 -0
- django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/testing.mjs +33 -0
- django_cfg/apps/centrifugo/static/django_cfg_centrifugo/js/dashboard/websocket.mjs +210 -0
- django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/channels_content.html +46 -0
- django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/live_channels_content.html +123 -0
- django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/overview_content.html +45 -0
- django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/publishes_content.html +84 -0
- django_cfg/apps/{ipc/templates/django_cfg_ipc → centrifugo/templates/django_cfg_centrifugo}/components/stat_cards.html +23 -20
- django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/system_status.html +91 -0
- django_cfg/apps/{ipc/templates/django_cfg_ipc → centrifugo/templates/django_cfg_centrifugo}/components/tab_navigation.html +15 -15
- django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/components/testing_tools.html +415 -0
- django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/layout/base.html +61 -0
- django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/pages/dashboard.html +58 -0
- django_cfg/apps/centrifugo/templates/django_cfg_centrifugo/tags/connection_script.html +48 -0
- django_cfg/apps/centrifugo/templatetags/__init__.py +1 -0
- django_cfg/apps/centrifugo/templatetags/centrifugo_tags.py +81 -0
- django_cfg/apps/centrifugo/urls.py +31 -0
- django_cfg/apps/{ipc → centrifugo}/urls_admin.py +4 -4
- django_cfg/apps/centrifugo/views/__init__.py +15 -0
- django_cfg/apps/centrifugo/views/admin_api.py +374 -0
- django_cfg/apps/centrifugo/views/dashboard.py +15 -0
- django_cfg/apps/centrifugo/views/monitoring.py +286 -0
- django_cfg/apps/centrifugo/views/testing_api.py +422 -0
- django_cfg/apps/support/utils/support_email_service.py +5 -18
- django_cfg/apps/tasks/templates/tasks/layout/base.html +0 -2
- django_cfg/apps/urls.py +5 -5
- django_cfg/core/base/config_model.py +4 -44
- django_cfg/core/builders/apps_builder.py +2 -2
- django_cfg/core/generation/integration_generators/third_party.py +8 -8
- django_cfg/core/utils/__init__.py +5 -0
- django_cfg/core/utils/url_helpers.py +73 -0
- django_cfg/modules/base.py +7 -7
- django_cfg/modules/django_client/core/__init__.py +2 -1
- django_cfg/modules/django_client/core/config/config.py +8 -0
- django_cfg/modules/django_client/core/generator/__init__.py +42 -2
- django_cfg/modules/django_client/core/generator/go/__init__.py +14 -0
- django_cfg/modules/django_client/core/generator/go/client_generator.py +124 -0
- django_cfg/modules/django_client/core/generator/go/files_generator.py +133 -0
- django_cfg/modules/django_client/core/generator/go/generator.py +203 -0
- django_cfg/modules/django_client/core/generator/go/models_generator.py +304 -0
- django_cfg/modules/django_client/core/generator/go/naming.py +193 -0
- django_cfg/modules/django_client/core/generator/go/operations_generator.py +134 -0
- django_cfg/modules/django_client/core/generator/go/templates/Makefile.j2 +38 -0
- django_cfg/modules/django_client/core/generator/go/templates/README.md.j2 +55 -0
- django_cfg/modules/django_client/core/generator/go/templates/client.go.j2 +122 -0
- django_cfg/modules/django_client/core/generator/go/templates/enums.go.j2 +49 -0
- django_cfg/modules/django_client/core/generator/go/templates/errors.go.j2 +182 -0
- django_cfg/modules/django_client/core/generator/go/templates/go.mod.j2 +6 -0
- django_cfg/modules/django_client/core/generator/go/templates/main_client.go.j2 +60 -0
- django_cfg/modules/django_client/core/generator/go/templates/middleware.go.j2 +388 -0
- django_cfg/modules/django_client/core/generator/go/templates/models.go.j2 +28 -0
- django_cfg/modules/django_client/core/generator/go/templates/operations_client.go.j2 +142 -0
- django_cfg/modules/django_client/core/generator/go/templates/validation.go.j2 +217 -0
- django_cfg/modules/django_client/core/generator/go/type_mapper.py +380 -0
- django_cfg/modules/django_client/management/commands/generate_client.py +53 -3
- django_cfg/modules/django_client/system/generate_mjs_clients.py +3 -1
- django_cfg/modules/django_client/system/schema_parser.py +5 -1
- django_cfg/modules/django_tailwind/templates/django_tailwind/base.html +1 -0
- django_cfg/modules/django_twilio/sendgrid_service.py +7 -4
- django_cfg/modules/django_unfold/dashboard.py +25 -19
- django_cfg/pyproject.toml +1 -1
- django_cfg/registry/core.py +2 -0
- django_cfg/registry/modules.py +2 -2
- django_cfg/static/js/api/centrifugo/client.mjs +164 -0
- django_cfg/static/js/api/centrifugo/index.mjs +13 -0
- django_cfg/static/js/api/index.mjs +5 -5
- django_cfg/static/js/api/types.mjs +89 -26
- {django_cfg-1.4.61.dist-info → django_cfg-1.4.63.dist-info}/METADATA +1 -1
- {django_cfg-1.4.61.dist-info → django_cfg-1.4.63.dist-info}/RECORD +142 -68
- django_cfg/apps/ipc/README.md +0 -346
- django_cfg/apps/ipc/RPC_LOGGING.md +0 -321
- django_cfg/apps/ipc/TESTING.md +0 -539
- django_cfg/apps/ipc/__init__.py +0 -60
- django_cfg/apps/ipc/admin.py +0 -212
- django_cfg/apps/ipc/apps.py +0 -28
- django_cfg/apps/ipc/migrations/0001_initial.py +0 -137
- django_cfg/apps/ipc/migrations/__init__.py +0 -0
- django_cfg/apps/ipc/models.py +0 -221
- django_cfg/apps/ipc/serializers/__init__.py +0 -29
- django_cfg/apps/ipc/serializers/serializers.py +0 -343
- django_cfg/apps/ipc/services/__init__.py +0 -7
- django_cfg/apps/ipc/services/client/__init__.py +0 -23
- django_cfg/apps/ipc/services/client/client.py +0 -621
- django_cfg/apps/ipc/services/client/config.py +0 -214
- django_cfg/apps/ipc/services/client/exceptions.py +0 -201
- django_cfg/apps/ipc/services/logging.py +0 -239
- django_cfg/apps/ipc/services/monitor.py +0 -466
- django_cfg/apps/ipc/static/django_cfg_ipc/js/dashboard/main.mjs +0 -269
- django_cfg/apps/ipc/static/django_cfg_ipc/js/dashboard/overview.mjs +0 -259
- django_cfg/apps/ipc/static/django_cfg_ipc/js/dashboard/testing.mjs +0 -375
- django_cfg/apps/ipc/static/django_cfg_ipc/js/dashboard.mjs.old +0 -441
- django_cfg/apps/ipc/templates/django_cfg_ipc/components/methods_content.html +0 -22
- django_cfg/apps/ipc/templates/django_cfg_ipc/components/notifications_content.html +0 -9
- django_cfg/apps/ipc/templates/django_cfg_ipc/components/overview_content.html +0 -9
- django_cfg/apps/ipc/templates/django_cfg_ipc/components/requests_content.html +0 -23
- django_cfg/apps/ipc/templates/django_cfg_ipc/components/system_status.html +0 -47
- django_cfg/apps/ipc/templates/django_cfg_ipc/components/testing_tools.html +0 -184
- django_cfg/apps/ipc/templates/django_cfg_ipc/layout/base.html +0 -71
- django_cfg/apps/ipc/templates/django_cfg_ipc/pages/dashboard.html +0 -56
- django_cfg/apps/ipc/urls.py +0 -23
- django_cfg/apps/ipc/views/__init__.py +0 -13
- django_cfg/apps/ipc/views/dashboard.py +0 -15
- django_cfg/apps/ipc/views/monitoring.py +0 -251
- django_cfg/apps/ipc/views/testing.py +0 -285
- django_cfg/static/js/api/ipc/client.mjs +0 -114
- django_cfg/static/js/api/ipc/index.mjs +0 -13
- {django_cfg-1.4.61.dist-info → django_cfg-1.4.63.dist-info}/WHEEL +0 -0
- {django_cfg-1.4.61.dist-info → django_cfg-1.4.63.dist-info}/entry_points.txt +0 -0
- {django_cfg-1.4.61.dist-info → django_cfg-1.4.63.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Centrifugo Admin API Serializers.
|
|
3
|
+
|
|
4
|
+
Pydantic models for Centrifugo server HTTP API requests and responses.
|
|
5
|
+
Based on Centrifugo v6 API specification from api.proto.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from typing import Any, Dict, List, Optional
|
|
9
|
+
from pydantic import BaseModel, Field
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# ==================== Common Types ====================
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class CentrifugoError(BaseModel):
|
|
16
|
+
"""Centrifugo API error structure."""
|
|
17
|
+
|
|
18
|
+
code: int = Field(default=0, description="Error code (0 = no error)")
|
|
19
|
+
message: str = Field(default="", description="Error message")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class CentrifugoMetrics(BaseModel):
|
|
23
|
+
"""Server metrics."""
|
|
24
|
+
|
|
25
|
+
interval: float = Field(description="Metrics collection interval")
|
|
26
|
+
items: Dict[str, float] = Field(description="Metric name to value mapping")
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CentrifugoProcess(BaseModel):
|
|
30
|
+
"""Process information."""
|
|
31
|
+
|
|
32
|
+
cpu: float = Field(description="CPU usage percentage")
|
|
33
|
+
rss: int = Field(description="Resident set size in bytes")
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# ==================== Info API ====================
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class CentrifugoInfoRequest(BaseModel):
|
|
40
|
+
"""Request for server info (no parameters)."""
|
|
41
|
+
|
|
42
|
+
pass
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class CentrifugoNodeInfo(BaseModel):
|
|
46
|
+
"""Information about a single Centrifugo node."""
|
|
47
|
+
|
|
48
|
+
uid: str = Field(description="Unique node identifier")
|
|
49
|
+
name: str = Field(description="Node name")
|
|
50
|
+
version: str = Field(description="Centrifugo version")
|
|
51
|
+
num_clients: int = Field(description="Number of connected clients")
|
|
52
|
+
num_users: int = Field(description="Number of unique users")
|
|
53
|
+
num_channels: int = Field(description="Number of active channels")
|
|
54
|
+
uptime: int = Field(description="Node uptime in seconds")
|
|
55
|
+
num_subs: int = Field(description="Total number of subscriptions")
|
|
56
|
+
metrics: Optional[CentrifugoMetrics] = Field(
|
|
57
|
+
default=None, description="Server metrics"
|
|
58
|
+
)
|
|
59
|
+
process: Optional[CentrifugoProcess] = Field(
|
|
60
|
+
default=None, description="Process information"
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class CentrifugoInfoResult(BaseModel):
|
|
65
|
+
"""Info result wrapper."""
|
|
66
|
+
|
|
67
|
+
nodes: List[CentrifugoNodeInfo] = Field(description="List of Centrifugo nodes")
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class CentrifugoInfoResponse(BaseModel):
|
|
71
|
+
"""Server info response."""
|
|
72
|
+
|
|
73
|
+
error: Optional[CentrifugoError] = Field(default=None, description="Error if any")
|
|
74
|
+
result: Optional[CentrifugoInfoResult] = Field(
|
|
75
|
+
default=None, description="Result data"
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# ==================== Channels API ====================
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class CentrifugoChannelsRequest(BaseModel):
|
|
83
|
+
"""Request to list active channels."""
|
|
84
|
+
|
|
85
|
+
pattern: Optional[str] = Field(
|
|
86
|
+
default=None, description="Pattern to filter channels (e.g., 'user:*')"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class CentrifugoChannelInfo(BaseModel):
|
|
91
|
+
"""Information about a single channel."""
|
|
92
|
+
|
|
93
|
+
num_clients: int = Field(description="Number of connected clients in channel")
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class CentrifugoChannelsResult(BaseModel):
|
|
97
|
+
"""Channels result wrapper."""
|
|
98
|
+
|
|
99
|
+
channels: Dict[str, CentrifugoChannelInfo] = Field(
|
|
100
|
+
description="Map of channel names to channel info"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class CentrifugoChannelsResponse(BaseModel):
|
|
105
|
+
"""List of active channels response."""
|
|
106
|
+
|
|
107
|
+
error: Optional[CentrifugoError] = Field(default=None, description="Error if any")
|
|
108
|
+
result: Optional[CentrifugoChannelsResult] = Field(
|
|
109
|
+
default=None, description="Result data"
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
# ==================== Presence API ====================
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class CentrifugoPresenceRequest(BaseModel):
|
|
117
|
+
"""Request to get channel presence."""
|
|
118
|
+
|
|
119
|
+
channel: str = Field(description="Channel name")
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class CentrifugoClientInfo(BaseModel):
|
|
123
|
+
"""Information about connected client."""
|
|
124
|
+
|
|
125
|
+
user: str = Field(description="User ID")
|
|
126
|
+
client: str = Field(description="Client UUID")
|
|
127
|
+
conn_info: Optional[Dict[str, Any]] = Field(
|
|
128
|
+
default=None, description="Connection metadata"
|
|
129
|
+
)
|
|
130
|
+
chan_info: Optional[Dict[str, Any]] = Field(
|
|
131
|
+
default=None, description="Channel-specific metadata"
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
class CentrifugoPresenceResult(BaseModel):
|
|
136
|
+
"""Presence result wrapper."""
|
|
137
|
+
|
|
138
|
+
presence: Dict[str, CentrifugoClientInfo] = Field(
|
|
139
|
+
description="Map of client IDs to client info"
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class CentrifugoPresenceResponse(BaseModel):
|
|
144
|
+
"""Channel presence response."""
|
|
145
|
+
|
|
146
|
+
error: Optional[CentrifugoError] = Field(default=None, description="Error if any")
|
|
147
|
+
result: Optional[CentrifugoPresenceResult] = Field(
|
|
148
|
+
default=None, description="Result data"
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
# ==================== Presence Stats API ====================
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class CentrifugoPresenceStatsRequest(BaseModel):
|
|
156
|
+
"""Request to get channel presence statistics."""
|
|
157
|
+
|
|
158
|
+
channel: str = Field(description="Channel name")
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class CentrifugoPresenceStatsResult(BaseModel):
|
|
162
|
+
"""Presence stats result."""
|
|
163
|
+
|
|
164
|
+
num_clients: int = Field(description="Number of connected clients")
|
|
165
|
+
num_users: int = Field(description="Number of unique users")
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
class CentrifugoPresenceStatsResponse(BaseModel):
|
|
169
|
+
"""Channel presence stats response."""
|
|
170
|
+
|
|
171
|
+
error: Optional[CentrifugoError] = Field(default=None, description="Error if any")
|
|
172
|
+
result: Optional[CentrifugoPresenceStatsResult] = Field(
|
|
173
|
+
default=None, description="Result data"
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
# ==================== History API ====================
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class CentrifugoStreamPosition(BaseModel):
|
|
181
|
+
"""Stream position for pagination."""
|
|
182
|
+
|
|
183
|
+
offset: int = Field(description="Stream offset")
|
|
184
|
+
epoch: str = Field(description="Stream epoch")
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class CentrifugoHistoryRequest(BaseModel):
|
|
188
|
+
"""Request to get channel history."""
|
|
189
|
+
|
|
190
|
+
channel: str = Field(description="Channel name")
|
|
191
|
+
limit: Optional[int] = Field(
|
|
192
|
+
default=None, ge=1, le=1000, description="Maximum number of messages to return"
|
|
193
|
+
)
|
|
194
|
+
since: Optional[CentrifugoStreamPosition] = Field(
|
|
195
|
+
default=None, description="Stream position to get messages since"
|
|
196
|
+
)
|
|
197
|
+
reverse: Optional[bool] = Field(
|
|
198
|
+
default=False, description="Reverse message order (newest first)"
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
class CentrifugoPublication(BaseModel):
|
|
203
|
+
"""Single publication (message) in channel history."""
|
|
204
|
+
|
|
205
|
+
data: Dict[str, Any] = Field(description="Message payload")
|
|
206
|
+
info: Optional[CentrifugoClientInfo] = Field(
|
|
207
|
+
default=None, description="Publisher client info"
|
|
208
|
+
)
|
|
209
|
+
offset: int = Field(description="Message offset in channel stream")
|
|
210
|
+
tags: Optional[Dict[str, str]] = Field(
|
|
211
|
+
default=None, description="Optional message tags"
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
class CentrifugoHistoryResult(BaseModel):
|
|
216
|
+
"""History result wrapper."""
|
|
217
|
+
|
|
218
|
+
publications: List[CentrifugoPublication] = Field(
|
|
219
|
+
description="List of publications"
|
|
220
|
+
)
|
|
221
|
+
epoch: str = Field(description="Current stream epoch")
|
|
222
|
+
offset: int = Field(description="Latest stream offset")
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class CentrifugoHistoryResponse(BaseModel):
|
|
226
|
+
"""Channel history response."""
|
|
227
|
+
|
|
228
|
+
error: Optional[CentrifugoError] = Field(default=None, description="Error if any")
|
|
229
|
+
result: Optional[CentrifugoHistoryResult] = Field(
|
|
230
|
+
default=None, description="Result data"
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
__all__ = [
|
|
235
|
+
# Common types
|
|
236
|
+
"CentrifugoError",
|
|
237
|
+
"CentrifugoMetrics",
|
|
238
|
+
"CentrifugoProcess",
|
|
239
|
+
# Info API
|
|
240
|
+
"CentrifugoInfoRequest",
|
|
241
|
+
"CentrifugoInfoResponse",
|
|
242
|
+
"CentrifugoInfoResult",
|
|
243
|
+
"CentrifugoNodeInfo",
|
|
244
|
+
# Channels API
|
|
245
|
+
"CentrifugoChannelsRequest",
|
|
246
|
+
"CentrifugoChannelsResponse",
|
|
247
|
+
"CentrifugoChannelsResult",
|
|
248
|
+
"CentrifugoChannelInfo",
|
|
249
|
+
# Presence API
|
|
250
|
+
"CentrifugoPresenceRequest",
|
|
251
|
+
"CentrifugoPresenceResponse",
|
|
252
|
+
"CentrifugoPresenceResult",
|
|
253
|
+
"CentrifugoClientInfo",
|
|
254
|
+
# Presence Stats API
|
|
255
|
+
"CentrifugoPresenceStatsRequest",
|
|
256
|
+
"CentrifugoPresenceStatsResponse",
|
|
257
|
+
"CentrifugoPresenceStatsResult",
|
|
258
|
+
# History API
|
|
259
|
+
"CentrifugoHistoryRequest",
|
|
260
|
+
"CentrifugoHistoryResponse",
|
|
261
|
+
"CentrifugoHistoryResult",
|
|
262
|
+
"CentrifugoPublication",
|
|
263
|
+
"CentrifugoStreamPosition",
|
|
264
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Channel statistics serializers for Centrifugo monitoring API.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ChannelStatsSerializer(BaseModel):
|
|
9
|
+
"""Statistics per channel."""
|
|
10
|
+
|
|
11
|
+
channel: str = Field(description="Channel name")
|
|
12
|
+
total: int = Field(description="Total publishes to this channel")
|
|
13
|
+
successful: int = Field(description="Successful publishes")
|
|
14
|
+
failed: int = Field(description="Failed publishes")
|
|
15
|
+
avg_duration_ms: float = Field(description="Average duration")
|
|
16
|
+
avg_acks: float = Field(description="Average ACKs received")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ChannelListSerializer(BaseModel):
|
|
20
|
+
"""List of channel statistics."""
|
|
21
|
+
|
|
22
|
+
channels: list[ChannelStatsSerializer] = Field(description="Channel statistics")
|
|
23
|
+
total_channels: int = Field(description="Total number of channels")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
__all__ = ["ChannelStatsSerializer", "ChannelListSerializer"]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Health check serializer for Centrifugo monitoring API.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class HealthCheckSerializer(BaseModel):
|
|
9
|
+
"""Health check response."""
|
|
10
|
+
|
|
11
|
+
status: str = Field(description="Health status: healthy or unhealthy")
|
|
12
|
+
wrapper_url: str = Field(description="Configured wrapper URL")
|
|
13
|
+
has_api_key: bool = Field(description="Whether API key is configured")
|
|
14
|
+
timestamp: str = Field(description="Current timestamp")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
__all__ = ["HealthCheckSerializer"]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Publishes serializers for Centrifugo monitoring API.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RecentPublishesSerializer(BaseModel):
|
|
9
|
+
"""Recent publishes list."""
|
|
10
|
+
|
|
11
|
+
publishes: list[dict] = Field(description="List of recent publishes")
|
|
12
|
+
count: int = Field(description="Number of publishes returned")
|
|
13
|
+
total_available: int = Field(description="Total publishes available")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
__all__ = ["RecentPublishesSerializer"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Statistics serializers for Centrifugo monitoring API.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class OverviewStatsSerializer(BaseModel):
|
|
9
|
+
"""Overview statistics for Centrifugo publishes."""
|
|
10
|
+
|
|
11
|
+
total: int = Field(description="Total publishes in period")
|
|
12
|
+
successful: int = Field(description="Successful publishes")
|
|
13
|
+
failed: int = Field(description="Failed publishes")
|
|
14
|
+
timeout: int = Field(description="Timeout publishes")
|
|
15
|
+
success_rate: float = Field(description="Success rate percentage")
|
|
16
|
+
avg_duration_ms: float = Field(description="Average duration in milliseconds")
|
|
17
|
+
avg_acks_received: float = Field(description="Average ACKs received")
|
|
18
|
+
period_hours: int = Field(description="Statistics period in hours")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
__all__ = ["OverviewStatsSerializer"]
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Centrifugo Services.
|
|
3
|
+
|
|
4
|
+
Business logic layer for Centrifugo integration.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .config_helper import get_centrifugo_config, get_centrifugo_config_or_default
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"get_centrifugo_config",
|
|
11
|
+
"get_centrifugo_config_or_default",
|
|
12
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Centrifugo Client.
|
|
3
|
+
|
|
4
|
+
Django client for publishing messages to Centrifugo via Python Wrapper.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .client import CentrifugoClient, PublishResponse, get_centrifugo_client
|
|
8
|
+
from .config import DjangoCfgCentrifugoConfig
|
|
9
|
+
from .exceptions import (
|
|
10
|
+
CentrifugoBaseException,
|
|
11
|
+
CentrifugoConfigurationError,
|
|
12
|
+
CentrifugoConnectionError,
|
|
13
|
+
CentrifugoPublishError,
|
|
14
|
+
CentrifugoTimeoutError,
|
|
15
|
+
CentrifugoValidationError,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"DjangoCfgCentrifugoConfig",
|
|
20
|
+
"CentrifugoClient",
|
|
21
|
+
"get_centrifugo_client",
|
|
22
|
+
"PublishResponse",
|
|
23
|
+
"CentrifugoBaseException",
|
|
24
|
+
"CentrifugoTimeoutError",
|
|
25
|
+
"CentrifugoPublishError",
|
|
26
|
+
"CentrifugoConnectionError",
|
|
27
|
+
"CentrifugoConfigurationError",
|
|
28
|
+
"CentrifugoValidationError",
|
|
29
|
+
]
|