@djangocfg/api 2.1.227 → 2.1.229

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.
Files changed (55) hide show
  1. package/README.md +8 -9
  2. package/dist/auth-server.cjs +4 -9
  3. package/dist/auth-server.cjs.map +1 -1
  4. package/dist/auth-server.mjs +4 -9
  5. package/dist/auth-server.mjs.map +1 -1
  6. package/dist/auth.cjs +120 -158
  7. package/dist/auth.cjs.map +1 -1
  8. package/dist/auth.d.cts +120 -177
  9. package/dist/auth.d.ts +120 -177
  10. package/dist/auth.mjs +149 -191
  11. package/dist/auth.mjs.map +1 -1
  12. package/dist/clients.cjs +5 -11
  13. package/dist/clients.cjs.map +1 -1
  14. package/dist/clients.d.cts +253 -254
  15. package/dist/clients.d.ts +253 -254
  16. package/dist/clients.mjs +5 -11
  17. package/dist/clients.mjs.map +1 -1
  18. package/dist/hooks.cjs +4 -9
  19. package/dist/hooks.cjs.map +1 -1
  20. package/dist/hooks.d.cts +64 -85
  21. package/dist/hooks.d.ts +64 -85
  22. package/dist/hooks.mjs +4 -9
  23. package/dist/hooks.mjs.map +1 -1
  24. package/dist/index.cjs +5 -11
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +109 -99
  27. package/dist/index.d.ts +109 -99
  28. package/dist/index.mjs +5 -11
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +2 -2
  31. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts +24 -2
  32. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts +0 -2
  33. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts +0 -2
  34. package/src/_api/generated/cfg_accounts/accounts/client.ts +1 -1
  35. package/src/_api/generated/cfg_accounts/accounts/models.ts +37 -38
  36. package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +36 -36
  37. package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +15 -15
  38. package/src/_api/generated/cfg_accounts/enums.ts +0 -10
  39. package/src/_api/generated/cfg_accounts/schema.json +31 -25
  40. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/models.ts +74 -74
  41. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/models.ts +36 -36
  42. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_testing/models.ts +22 -22
  43. package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +10 -10
  44. package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +22 -22
  45. package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +8 -8
  46. package/src/auth/context/AccountsContext.tsx +6 -2
  47. package/src/auth/context/AuthContext.tsx +32 -39
  48. package/src/auth/context/types.ts +5 -9
  49. package/src/auth/hooks/index.ts +1 -1
  50. package/src/auth/hooks/useAuthForm.ts +42 -75
  51. package/src/auth/hooks/useAuthFormState.ts +35 -6
  52. package/src/auth/hooks/useAuthValidation.ts +5 -65
  53. package/src/auth/hooks/useTwoFactor.ts +17 -2
  54. package/src/auth/types/form.ts +25 -70
  55. package/src/auth/types/index.ts +2 -6
@@ -11,13 +11,13 @@ export interface CentrifugoHistoryResponse {
11
11
  }
12
12
 
13
13
  /**
14
- * Channel presence response.
14
+ * Request to get channel presence statistics.
15
15
  *
16
- * Response model (includes read-only fields).
16
+ * Request model (no read-only fields).
17
17
  */
18
- export interface CentrifugoPresenceResponse {
19
- error?: CentrifugoError | null;
20
- result?: CentrifugoPresenceResult | null;
18
+ export interface CentrifugoPresenceStatsRequestRequest {
19
+ /** Channel name */
20
+ channel: string;
21
21
  }
22
22
 
23
23
  /**
@@ -31,13 +31,23 @@ export interface CentrifugoInfoResponse {
31
31
  }
32
32
 
33
33
  /**
34
- * Request to get channel presence.
34
+ * Channel presence response.
35
35
  *
36
- * Request model (no read-only fields).
36
+ * Response model (includes read-only fields).
37
37
  */
38
- export interface CentrifugoPresenceRequestRequest {
39
- /** Channel name */
40
- channel: string;
38
+ export interface CentrifugoPresenceResponse {
39
+ error?: CentrifugoError | null;
40
+ result?: CentrifugoPresenceResult | null;
41
+ }
42
+
43
+ /**
44
+ * Channel presence stats response.
45
+ *
46
+ * Response model (includes read-only fields).
47
+ */
48
+ export interface CentrifugoPresenceStatsResponse {
49
+ error?: CentrifugoError | null;
50
+ result?: CentrifugoPresenceStatsResult | null;
41
51
  }
42
52
 
43
53
  /**
@@ -51,15 +61,25 @@ export interface CentrifugoChannelsResponse {
51
61
  }
52
62
 
53
63
  /**
54
- * Request to get channel presence statistics.
64
+ * Request to get channel presence.
55
65
  *
56
66
  * Request model (no read-only fields).
57
67
  */
58
- export interface CentrifugoPresenceStatsRequestRequest {
68
+ export interface CentrifugoPresenceRequestRequest {
59
69
  /** Channel name */
60
70
  channel: string;
61
71
  }
62
72
 
73
+ /**
74
+ * Request to list active channels.
75
+ *
76
+ * Request model (no read-only fields).
77
+ */
78
+ export interface CentrifugoChannelsRequestRequest {
79
+ /** Pattern to filter channels (e.g., 'user:*') */
80
+ pattern?: string | null;
81
+ }
82
+
63
83
  /**
64
84
  * Request to get channel history.
65
85
  *
@@ -76,23 +96,15 @@ export interface CentrifugoHistoryRequestRequest {
76
96
  }
77
97
 
78
98
  /**
79
- * Request to list active channels.
80
- *
81
- * Request model (no read-only fields).
82
- */
83
- export interface CentrifugoChannelsRequestRequest {
84
- /** Pattern to filter channels (e.g., 'user:*') */
85
- pattern?: string | null;
86
- }
87
-
88
- /**
89
- * Channel presence stats response.
99
+ * Centrifugo API error structure.
90
100
  *
91
101
  * Response model (includes read-only fields).
92
102
  */
93
- export interface CentrifugoPresenceStatsResponse {
94
- error?: CentrifugoError | null;
95
- result?: CentrifugoPresenceStatsResult | null;
103
+ export interface CentrifugoError {
104
+ /** Error code (0 = no error) */
105
+ code?: number;
106
+ /** Error message */
107
+ message?: string;
96
108
  }
97
109
 
98
110
  /**
@@ -110,15 +122,13 @@ export interface CentrifugoHistoryResult {
110
122
  }
111
123
 
112
124
  /**
113
- * Centrifugo API error structure.
125
+ * Info result wrapper.
114
126
  *
115
127
  * Response model (includes read-only fields).
116
128
  */
117
- export interface CentrifugoError {
118
- /** Error code (0 = no error) */
119
- code?: number;
120
- /** Error message */
121
- message?: string;
129
+ export interface CentrifugoInfoResult {
130
+ /** List of Centrifugo nodes */
131
+ nodes: Array<CentrifugoNodeInfo>;
122
132
  }
123
133
 
124
134
  /**
@@ -132,13 +142,15 @@ export interface CentrifugoPresenceResult {
132
142
  }
133
143
 
134
144
  /**
135
- * Info result wrapper.
145
+ * Presence stats result.
136
146
  *
137
147
  * Response model (includes read-only fields).
138
148
  */
139
- export interface CentrifugoInfoResult {
140
- /** List of Centrifugo nodes */
141
- nodes: Array<CentrifugoNodeInfo>;
149
+ export interface CentrifugoPresenceStatsResult {
150
+ /** Number of connected clients */
151
+ num_clients: number;
152
+ /** Number of unique users */
153
+ num_users: number;
142
154
  }
143
155
 
144
156
  /**
@@ -163,18 +175,6 @@ export interface CentrifugoStreamPosition {
163
175
  epoch: string;
164
176
  }
165
177
 
166
- /**
167
- * Presence stats result.
168
- *
169
- * Response model (includes read-only fields).
170
- */
171
- export interface CentrifugoPresenceStatsResult {
172
- /** Number of connected clients */
173
- num_clients: number;
174
- /** Number of unique users */
175
- num_users: number;
176
- }
177
-
178
178
  /**
179
179
  * Single publication (message) in channel history.
180
180
  *
@@ -190,22 +190,6 @@ export interface CentrifugoPublication {
190
190
  tags?: Record<string, any> | null;
191
191
  }
192
192
 
193
- /**
194
- * Information about connected client.
195
- *
196
- * Response model (includes read-only fields).
197
- */
198
- export interface CentrifugoClientInfo {
199
- /** User ID */
200
- user: string;
201
- /** Client UUID */
202
- client: string;
203
- /** Connection metadata */
204
- conn_info?: Record<string, any> | null;
205
- /** Channel-specific metadata */
206
- chan_info?: Record<string, any> | null;
207
- }
208
-
209
193
  /**
210
194
  * Information about a single Centrifugo node.
211
195
  *
@@ -233,25 +217,29 @@ export interface CentrifugoNodeInfo {
233
217
  }
234
218
 
235
219
  /**
236
- * Information about a single channel.
220
+ * Information about connected client.
237
221
  *
238
222
  * Response model (includes read-only fields).
239
223
  */
240
- export interface CentrifugoChannelInfo {
241
- /** Number of connected clients in channel */
242
- num_clients: number;
224
+ export interface CentrifugoClientInfo {
225
+ /** User ID */
226
+ user: string;
227
+ /** Client UUID */
228
+ client: string;
229
+ /** Connection metadata */
230
+ conn_info?: Record<string, any> | null;
231
+ /** Channel-specific metadata */
232
+ chan_info?: Record<string, any> | null;
243
233
  }
244
234
 
245
235
  /**
246
- * Server metrics.
236
+ * Information about a single channel.
247
237
  *
248
238
  * Response model (includes read-only fields).
249
239
  */
250
- export interface CentrifugoMetrics {
251
- /** Metrics collection interval */
252
- interval: number;
253
- /** Metric name to value mapping */
254
- items: Record<string, any>;
240
+ export interface CentrifugoChannelInfo {
241
+ /** Number of connected clients in channel */
242
+ num_clients: number;
255
243
  }
256
244
 
257
245
  /**
@@ -266,3 +254,15 @@ export interface CentrifugoProcess {
266
254
  rss: number;
267
255
  }
268
256
 
257
+ /**
258
+ * Server metrics.
259
+ *
260
+ * Response model (includes read-only fields).
261
+ */
262
+ export interface CentrifugoMetrics {
263
+ /** Metrics collection interval */
264
+ interval: number;
265
+ /** Metric name to value mapping */
266
+ items: Record<string, any>;
267
+ }
268
+
@@ -1,14 +1,15 @@
1
1
  // @ts-nocheck
2
2
  // Auto-generated by DjangoCFG - see CLAUDE.md
3
3
  /**
4
- * Timeline response with hourly/daily breakdown for DRF.
4
+ * List of channel statistics.
5
5
  *
6
6
  * Response model (includes read-only fields).
7
7
  */
8
- export interface TimelineResponse {
9
- timeline: Array<TimelineItem>;
10
- period_hours: number;
11
- interval: string;
8
+ export interface ChannelList {
9
+ /** Channel statistics */
10
+ channels: Array<ChannelStats>;
11
+ /** Total number of channels */
12
+ total_channels: number;
12
13
  }
13
14
 
14
15
  /**
@@ -36,18 +37,6 @@ export interface PaginatedPublishList {
36
37
  results: Array<Publish>;
37
38
  }
38
39
 
39
- /**
40
- * List of channel statistics.
41
- *
42
- * Response model (includes read-only fields).
43
- */
44
- export interface ChannelList {
45
- /** Channel statistics */
46
- channels: Array<ChannelStats>;
47
- /** Total number of channels */
48
- total_channels: number;
49
- }
50
-
51
40
  /**
52
41
  * Health check response.
53
42
  *
@@ -89,16 +78,36 @@ export interface CentrifugoOverviewStats {
89
78
  }
90
79
 
91
80
  /**
92
- * Single timeline data point for DRF.
81
+ * Timeline response with hourly/daily breakdown for DRF.
93
82
  *
94
83
  * Response model (includes read-only fields).
95
84
  */
96
- export interface TimelineItem {
97
- timestamp: string;
98
- count: number;
85
+ export interface TimelineResponse {
86
+ timeline: Array<TimelineItem>;
87
+ period_hours: number;
88
+ interval: string;
89
+ }
90
+
91
+ /**
92
+ * Statistics per channel.
93
+ *
94
+ * Response model (includes read-only fields).
95
+ */
96
+ export interface ChannelStats {
97
+ /** Channel name */
98
+ channel: string;
99
+ /** Total publishes to this channel */
100
+ total: number;
101
+ /** Successful publishes */
99
102
  successful: number;
103
+ /** Failed publishes */
100
104
  failed: number;
101
- timeout: number;
105
+ /** Average duration */
106
+ avg_duration_ms: number;
107
+ /** Average ACKs received */
108
+ avg_acks: number;
109
+ /** Last activity timestamp (ISO format) */
110
+ last_activity_at: string | null;
102
111
  }
103
112
 
104
113
  /**
@@ -121,24 +130,15 @@ export interface Publish {
121
130
  }
122
131
 
123
132
  /**
124
- * Statistics per channel.
133
+ * Single timeline data point for DRF.
125
134
  *
126
135
  * Response model (includes read-only fields).
127
136
  */
128
- export interface ChannelStats {
129
- /** Channel name */
130
- channel: string;
131
- /** Total publishes to this channel */
132
- total: number;
133
- /** Successful publishes */
137
+ export interface TimelineItem {
138
+ timestamp: string;
139
+ count: number;
134
140
  successful: number;
135
- /** Failed publishes */
136
141
  failed: number;
137
- /** Average duration */
138
- avg_duration_ms: number;
139
- /** Average ACKs received */
140
- avg_acks: number;
141
- /** Last activity timestamp (ISO format) */
142
- last_activity_at: string | null;
142
+ timeout: number;
143
143
  }
144
144
 
@@ -1,5 +1,21 @@
1
1
  // @ts-nocheck
2
2
  // Auto-generated by DjangoCFG - see CLAUDE.md
3
+ /**
4
+ * Request model for test message publishing.
5
+ *
6
+ * Request model (no read-only fields).
7
+ */
8
+ export interface PublishTestRequestRequest {
9
+ /** Target channel name */
10
+ channel: string;
11
+ /** Message data (any JSON object) */
12
+ data: Record<string, any>;
13
+ /** Wait for client acknowledgment */
14
+ wait_for_ack?: boolean;
15
+ /** ACK timeout in seconds */
16
+ ack_timeout?: number;
17
+ }
18
+
3
19
  /**
4
20
  * Response model for manual ACK.
5
21
  *
@@ -15,19 +31,15 @@ export interface ManualAckResponse {
15
31
  }
16
32
 
17
33
  /**
18
- * Request model for test message publishing.
34
+ * Request model for manual ACK sending.
19
35
  *
20
36
  * Request model (no read-only fields).
21
37
  */
22
- export interface PublishTestRequestRequest {
23
- /** Target channel name */
24
- channel: string;
25
- /** Message data (any JSON object) */
26
- data: Record<string, any>;
27
- /** Wait for client acknowledgment */
28
- wait_for_ack?: boolean;
29
- /** ACK timeout in seconds */
30
- ack_timeout?: number;
38
+ export interface ManualAckRequestRequest {
39
+ /** Message ID to acknowledge */
40
+ message_id: string;
41
+ /** Client ID sending the ACK */
42
+ client_id: string;
31
43
  }
32
44
 
33
45
  /**
@@ -50,15 +62,3 @@ export interface PublishTestResponse {
50
62
  error?: string | null;
51
63
  }
52
64
 
53
- /**
54
- * Request model for manual ACK sending.
55
- *
56
- * Request model (no read-only fields).
57
- */
58
- export interface ManualAckRequestRequest {
59
- /** Message ID to acknowledge */
60
- message_id: string;
61
- /** Client ID sending the ACK */
62
- client_id: string;
63
- }
64
-
@@ -2,16 +2,6 @@
2
2
  // Auto-generated by DjangoCFG - see CLAUDE.md
3
3
  import * as Enums from "../enums";
4
4
 
5
- /**
6
- * Serializer for completely disabling 2FA.
7
- *
8
- * Request model (no read-only fields).
9
- */
10
- export interface DisableRequest {
11
- /** TOTP code for verification */
12
- code: string;
13
- }
14
-
15
5
  /**
16
6
  *
17
7
  * Response model (includes read-only fields).
@@ -37,6 +27,16 @@ export interface PaginatedDeviceListResponseList {
37
27
  results: Array<DeviceListResponse>;
38
28
  }
39
29
 
30
+ /**
31
+ * Serializer for completely disabling 2FA.
32
+ *
33
+ * Request model (no read-only fields).
34
+ */
35
+ export interface DisableRequest {
36
+ /** TOTP code for verification */
37
+ code: string;
38
+ }
39
+
40
40
  /**
41
41
  * Response serializer for device list endpoint.
42
42
  *
@@ -1,5 +1,15 @@
1
1
  // @ts-nocheck
2
2
  // Auto-generated by DjangoCFG - see CLAUDE.md
3
+ /**
4
+ * Serializer for starting 2FA setup.
5
+ *
6
+ * Request model (no read-only fields).
7
+ */
8
+ export interface SetupRequest {
9
+ /** Device name for identification (e.g., 'My iPhone') */
10
+ device_name?: string;
11
+ }
12
+
3
13
  /**
4
14
  * Response serializer for setup confirmation.
5
15
  *
@@ -13,6 +23,18 @@ export interface ConfirmSetupResponse {
13
23
  backup_codes_warning: string;
14
24
  }
15
25
 
26
+ /**
27
+ * Serializer for confirming 2FA setup with first code.
28
+ *
29
+ * Request model (no read-only fields).
30
+ */
31
+ export interface ConfirmSetupRequest {
32
+ /** Device ID from setup response */
33
+ device_id: string;
34
+ /** 6-digit TOTP code from authenticator app */
35
+ code: string;
36
+ }
37
+
16
38
  /**
17
39
  * Response serializer for setup initiation.
18
40
  *
@@ -31,25 +53,3 @@ export interface SetupResponse {
31
53
  expires_in: number;
32
54
  }
33
55
 
34
- /**
35
- * Serializer for confirming 2FA setup with first code.
36
- *
37
- * Request model (no read-only fields).
38
- */
39
- export interface ConfirmSetupRequest {
40
- /** Device ID from setup response */
41
- device_id: string;
42
- /** 6-digit TOTP code from authenticator app */
43
- code: string;
44
- }
45
-
46
- /**
47
- * Serializer for starting 2FA setup.
48
- *
49
- * Request model (no read-only fields).
50
- */
51
- export interface SetupRequest {
52
- /** Device name for identification (e.g., 'My iPhone') */
53
- device_name?: string;
54
- }
55
-
@@ -1,15 +1,15 @@
1
1
  // @ts-nocheck
2
2
  // Auto-generated by DjangoCFG - see CLAUDE.md
3
3
  /**
4
- * Serializer for TOTP code verification during login.
4
+ * Serializer for backup code verification during login.
5
5
  *
6
6
  * Request model (no read-only fields).
7
7
  */
8
- export interface VerifyRequest {
8
+ export interface VerifyBackupRequest {
9
9
  /** 2FA session ID from login response */
10
10
  session_id: string;
11
- /** 6-digit TOTP code from authenticator app */
12
- code: string;
11
+ /** 8-character backup recovery code */
12
+ backup_code: string;
13
13
  }
14
14
 
15
15
  /**
@@ -31,15 +31,15 @@ export interface VerifyResponse {
31
31
  }
32
32
 
33
33
  /**
34
- * Serializer for backup code verification during login.
34
+ * Serializer for TOTP code verification during login.
35
35
  *
36
36
  * Request model (no read-only fields).
37
37
  */
38
- export interface VerifyBackupRequest {
38
+ export interface VerifyRequest {
39
39
  /** 2FA session ID from login response */
40
40
  session_id: string;
41
- /** 8-character backup recovery code */
42
- backup_code: string;
41
+ /** 6-digit TOTP code from authenticator app */
42
+ code: string;
43
43
  }
44
44
 
45
45
  /**
@@ -186,8 +186,12 @@ export function AccountsProvider({ children }: AccountsProviderProps) {
186
186
  // Normal flow - save tokens after successful verification
187
187
  if (result.access && result.refresh) {
188
188
  apiAccounts.setToken(result.access, result.refresh);
189
- // Refresh profile to load user data with new token
190
- await refreshProfile({ callerId: 'verifyOTP', force: true });
189
+ // Refresh profile don't let profile fetch error kill the whole verification
190
+ try {
191
+ await refreshProfile({ callerId: 'verifyOTP', force: true });
192
+ } catch (profileError) {
193
+ authLogger.warn('Profile refresh failed after OTP verify (tokens are saved):', profileError);
194
+ }
191
195
  }
192
196
 
193
197
  return result as OTPVerifyResponse;