@djangocfg/api 2.1.230 → 2.1.232

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 (92) hide show
  1. package/README.md +19 -4
  2. package/dist/auth-server.cjs +45 -358
  3. package/dist/auth-server.cjs.map +1 -1
  4. package/dist/auth-server.mjs +43 -356
  5. package/dist/auth-server.mjs.map +1 -1
  6. package/dist/auth.cjs +223 -735
  7. package/dist/auth.cjs.map +1 -1
  8. package/dist/auth.mjs +218 -730
  9. package/dist/auth.mjs.map +1 -1
  10. package/dist/clients.cjs +313 -1568
  11. package/dist/clients.cjs.map +1 -1
  12. package/dist/clients.d.cts +211 -1932
  13. package/dist/clients.d.ts +211 -1932
  14. package/dist/clients.mjs +309 -1564
  15. package/dist/clients.mjs.map +1 -1
  16. package/dist/hooks.cjs +36 -32
  17. package/dist/hooks.cjs.map +1 -1
  18. package/dist/hooks.d.cts +76 -76
  19. package/dist/hooks.d.ts +76 -76
  20. package/dist/hooks.mjs +36 -32
  21. package/dist/hooks.mjs.map +1 -1
  22. package/dist/index.cjs +88 -593
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +88 -88
  25. package/dist/index.d.ts +88 -88
  26. package/dist/index.mjs +88 -593
  27. package/dist/index.mjs.map +1 -1
  28. package/package.json +2 -2
  29. package/src/_api/generated/cfg_accounts/accounts/models.ts +34 -34
  30. package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +41 -41
  31. package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +18 -18
  32. package/src/_api/generated/cfg_accounts/client.ts +39 -42
  33. package/src/_api/generated/cfg_centrifugo/CLAUDE.md +2 -27
  34. package/src/_api/generated/cfg_centrifugo/_utils/fetchers/index.ts +0 -3
  35. package/src/_api/generated/cfg_centrifugo/_utils/hooks/index.ts +0 -3
  36. package/src/_api/generated/cfg_centrifugo/_utils/schemas/index.ts +0 -34
  37. package/src/_api/generated/cfg_centrifugo/client.ts +39 -51
  38. package/src/_api/generated/cfg_centrifugo/index.ts +0 -21
  39. package/src/_api/generated/cfg_centrifugo/schema.json +4 -2039
  40. package/src/_api/generated/cfg_totp/client.ts +39 -42
  41. package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +10 -10
  42. package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +12 -12
  43. package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +8 -8
  44. package/src/_api/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts +0 -344
  45. package/src/_api/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts +0 -326
  46. package/src/_api/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts +0 -211
  47. package/src/_api/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_admin_api.ts +0 -141
  48. package/src/_api/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts +0 -99
  49. package/src/_api/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_testing.ts +0 -82
  50. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelInfo.schema.ts +0 -19
  51. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts +0 -19
  52. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResponse.schema.ts +0 -22
  53. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResult.schema.ts +0 -20
  54. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoClientInfo.schema.ts +0 -22
  55. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoError.schema.ts +0 -20
  56. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoHealthCheck.schema.ts +0 -22
  57. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts +0 -23
  58. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResponse.schema.ts +0 -22
  59. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResult.schema.ts +0 -22
  60. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResponse.schema.ts +0 -22
  61. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResult.schema.ts +0 -20
  62. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoMetrics.schema.ts +0 -20
  63. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoNodeInfo.schema.ts +0 -30
  64. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoOverviewStats.schema.ts +0 -26
  65. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceRequestRequest.schema.ts +0 -19
  66. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResponse.schema.ts +0 -22
  67. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResult.schema.ts +0 -20
  68. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsRequestRequest.schema.ts +0 -19
  69. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts +0 -22
  70. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResult.schema.ts +0 -20
  71. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoProcess.schema.ts +0 -20
  72. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPublication.schema.ts +0 -23
  73. package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoStreamPosition.schema.ts +0 -20
  74. package/src/_api/generated/cfg_centrifugo/_utils/schemas/ChannelList.schema.ts +0 -21
  75. package/src/_api/generated/cfg_centrifugo/_utils/schemas/ChannelStats.schema.ts +0 -25
  76. package/src/_api/generated/cfg_centrifugo/_utils/schemas/ManualAckRequestRequest.schema.ts +0 -20
  77. package/src/_api/generated/cfg_centrifugo/_utils/schemas/ManualAckResponse.schema.ts +0 -21
  78. package/src/_api/generated/cfg_centrifugo/_utils/schemas/PaginatedPublishList.schema.ts +0 -24
  79. package/src/_api/generated/cfg_centrifugo/_utils/schemas/Publish.schema.ts +0 -29
  80. package/src/_api/generated/cfg_centrifugo/_utils/schemas/PublishTestRequestRequest.schema.ts +0 -22
  81. package/src/_api/generated/cfg_centrifugo/_utils/schemas/PublishTestResponse.schema.ts +0 -24
  82. package/src/_api/generated/cfg_centrifugo/_utils/schemas/TimelineItem.schema.ts +0 -23
  83. package/src/_api/generated/cfg_centrifugo/_utils/schemas/TimelineResponse.schema.ts +0 -22
  84. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/client.ts +0 -76
  85. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/index.ts +0 -4
  86. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/models.ts +0 -268
  87. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/client.ts +0 -110
  88. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/index.ts +0 -4
  89. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/models.ts +0 -144
  90. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_testing/client.ts +0 -48
  91. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_testing/index.ts +0 -4
  92. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_testing/models.ts +0 -64
@@ -1,326 +0,0 @@
1
- // @ts-nocheck
2
- // Auto-generated by DjangoCFG - see CLAUDE.md
3
- /**
4
- * Typed fetchers for Centrifugo Monitoring
5
- *
6
- * Universal functions that work in any environment:
7
- * - Next.js (App Router / Pages Router / Server Components)
8
- * - React Native
9
- * - Node.js backend
10
- *
11
- * These fetchers use Zod schemas for runtime validation.
12
- *
13
- * Usage:
14
- * ```typescript
15
- * // Configure API once (in your app entry point)
16
- * import { configureAPI } from '../../api-instance'
17
- * configureAPI({ baseUrl: 'https://api.example.com' })
18
- *
19
- * // Then use fetchers anywhere
20
- * const users = await getUsers({ page: 1 })
21
- *
22
- * // With SWR
23
- * const { data } = useSWR(['users', params], () => getUsers(params))
24
- *
25
- * // With React Query
26
- * const { data } = useQuery(['users', params], () => getUsers(params))
27
- *
28
- * // In Server Component or SSR (pass custom client)
29
- * import { API } from '../../index'
30
- * const api = new API('https://api.example.com')
31
- * const users = await getUsers({ page: 1 }, api)
32
- * ```
33
- */
34
- import { consola } from 'consola'
35
- import { CentrifugoHealthCheckSchema, type CentrifugoHealthCheck } from '../schemas/CentrifugoHealthCheck.schema'
36
- import { CentrifugoOverviewStatsSchema, type CentrifugoOverviewStats } from '../schemas/CentrifugoOverviewStats.schema'
37
- import { ChannelListSchema, type ChannelList } from '../schemas/ChannelList.schema'
38
- import { PaginatedPublishListSchema, type PaginatedPublishList } from '../schemas/PaginatedPublishList.schema'
39
- import { TimelineResponseSchema, type TimelineResponse } from '../schemas/TimelineResponse.schema'
40
- import { getAPIInstance } from '../../api-instance'
41
-
42
- /**
43
- * Get channel statistics
44
- *
45
- * @method GET
46
- * @path /cfg/centrifugo/monitor/channels/
47
- */
48
- export async function getCentrifugoMonitorChannelsRetrieve( params?: { hours?: number }, client?: any
49
- ): Promise<ChannelList> {
50
- const api = client || getAPIInstance()
51
- const response = await api.centrifugo_monitoring.centrifugoMonitorChannelsRetrieve(params?.hours)
52
- try {
53
- return ChannelListSchema.parse(response)
54
- } catch (error) {
55
- // Zod validation error - log detailed information
56
- consola.error('❌ Zod Validation Failed');
57
- consola.box(`getCentrifugoMonitorChannelsRetrieve\nPath: /cfg/centrifugo/monitor/channels/\nMethod: GET`);
58
-
59
- if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
60
- consola.error('Validation Issues:');
61
- (error as any).issues.forEach((issue: any, index: number) => {
62
- consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
63
- consola.error(` ├─ Message: ${issue.message}`);
64
- if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
65
- if (issue.received) consola.error(` └─ Received: ${issue.received}`);
66
- });
67
- }
68
-
69
- consola.error('Response data:', response);
70
-
71
- // Dispatch browser CustomEvent (only if window is defined)
72
- if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
73
- try {
74
- const event = new CustomEvent('zod-validation-error', {
75
- detail: {
76
- operation: 'getCentrifugoMonitorChannelsRetrieve',
77
- path: '/cfg/centrifugo/monitor/channels/',
78
- method: 'GET',
79
- error: error,
80
- response: response,
81
- timestamp: new Date(),
82
- },
83
- bubbles: true,
84
- cancelable: false,
85
- });
86
- window.dispatchEvent(event);
87
- } catch (eventError) {
88
- // Silently fail - event dispatch should never crash the app
89
- consola.warn('Failed to dispatch validation error event:', eventError);
90
- }
91
- }
92
-
93
- // Re-throw the error
94
- throw error;
95
- }
96
- }
97
-
98
-
99
- /**
100
- * Get Centrifugo health status
101
- *
102
- * @method GET
103
- * @path /cfg/centrifugo/monitor/health/
104
- */
105
- export async function getCentrifugoMonitorHealthRetrieve( client?: any
106
- ): Promise<CentrifugoHealthCheck> {
107
- const api = client || getAPIInstance()
108
- const response = await api.centrifugo_monitoring.centrifugoMonitorHealthRetrieve()
109
- try {
110
- return CentrifugoHealthCheckSchema.parse(response)
111
- } catch (error) {
112
- // Zod validation error - log detailed information
113
- consola.error('❌ Zod Validation Failed');
114
- consola.box(`getCentrifugoMonitorHealthRetrieve\nPath: /cfg/centrifugo/monitor/health/\nMethod: GET`);
115
-
116
- if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
117
- consola.error('Validation Issues:');
118
- (error as any).issues.forEach((issue: any, index: number) => {
119
- consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
120
- consola.error(` ├─ Message: ${issue.message}`);
121
- if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
122
- if (issue.received) consola.error(` └─ Received: ${issue.received}`);
123
- });
124
- }
125
-
126
- consola.error('Response data:', response);
127
-
128
- // Dispatch browser CustomEvent (only if window is defined)
129
- if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
130
- try {
131
- const event = new CustomEvent('zod-validation-error', {
132
- detail: {
133
- operation: 'getCentrifugoMonitorHealthRetrieve',
134
- path: '/cfg/centrifugo/monitor/health/',
135
- method: 'GET',
136
- error: error,
137
- response: response,
138
- timestamp: new Date(),
139
- },
140
- bubbles: true,
141
- cancelable: false,
142
- });
143
- window.dispatchEvent(event);
144
- } catch (eventError) {
145
- // Silently fail - event dispatch should never crash the app
146
- consola.warn('Failed to dispatch validation error event:', eventError);
147
- }
148
- }
149
-
150
- // Re-throw the error
151
- throw error;
152
- }
153
- }
154
-
155
-
156
- /**
157
- * Get overview statistics
158
- *
159
- * @method GET
160
- * @path /cfg/centrifugo/monitor/overview/
161
- */
162
- export async function getCentrifugoMonitorOverviewRetrieve( params?: { hours?: number }, client?: any
163
- ): Promise<CentrifugoOverviewStats> {
164
- const api = client || getAPIInstance()
165
- const response = await api.centrifugo_monitoring.centrifugoMonitorOverviewRetrieve(params?.hours)
166
- try {
167
- return CentrifugoOverviewStatsSchema.parse(response)
168
- } catch (error) {
169
- // Zod validation error - log detailed information
170
- consola.error('❌ Zod Validation Failed');
171
- consola.box(`getCentrifugoMonitorOverviewRetrieve\nPath: /cfg/centrifugo/monitor/overview/\nMethod: GET`);
172
-
173
- if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
174
- consola.error('Validation Issues:');
175
- (error as any).issues.forEach((issue: any, index: number) => {
176
- consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
177
- consola.error(` ├─ Message: ${issue.message}`);
178
- if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
179
- if (issue.received) consola.error(` └─ Received: ${issue.received}`);
180
- });
181
- }
182
-
183
- consola.error('Response data:', response);
184
-
185
- // Dispatch browser CustomEvent (only if window is defined)
186
- if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
187
- try {
188
- const event = new CustomEvent('zod-validation-error', {
189
- detail: {
190
- operation: 'getCentrifugoMonitorOverviewRetrieve',
191
- path: '/cfg/centrifugo/monitor/overview/',
192
- method: 'GET',
193
- error: error,
194
- response: response,
195
- timestamp: new Date(),
196
- },
197
- bubbles: true,
198
- cancelable: false,
199
- });
200
- window.dispatchEvent(event);
201
- } catch (eventError) {
202
- // Silently fail - event dispatch should never crash the app
203
- consola.warn('Failed to dispatch validation error event:', eventError);
204
- }
205
- }
206
-
207
- // Re-throw the error
208
- throw error;
209
- }
210
- }
211
-
212
-
213
- /**
214
- * Get recent publishes
215
- *
216
- * @method GET
217
- * @path /cfg/centrifugo/monitor/publishes/
218
- */
219
- export async function getCentrifugoMonitorPublishesList( params?: { channel?: string; ordering?: string; page?: number; page_size?: number; search?: string; status?: string }, client?: any
220
- ): Promise<PaginatedPublishList> {
221
- const api = client || getAPIInstance()
222
- const response = await api.centrifugo_monitoring.centrifugoMonitorPublishesList(params?.channel, params?.ordering, params?.page, params?.page_size, params?.search, params?.status)
223
- try {
224
- return PaginatedPublishListSchema.parse(response)
225
- } catch (error) {
226
- // Zod validation error - log detailed information
227
- consola.error('❌ Zod Validation Failed');
228
- consola.box(`getCentrifugoMonitorPublishesList\nPath: /cfg/centrifugo/monitor/publishes/\nMethod: GET`);
229
-
230
- if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
231
- consola.error('Validation Issues:');
232
- (error as any).issues.forEach((issue: any, index: number) => {
233
- consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
234
- consola.error(` ├─ Message: ${issue.message}`);
235
- if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
236
- if (issue.received) consola.error(` └─ Received: ${issue.received}`);
237
- });
238
- }
239
-
240
- consola.error('Response data:', response);
241
-
242
- // Dispatch browser CustomEvent (only if window is defined)
243
- if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
244
- try {
245
- const event = new CustomEvent('zod-validation-error', {
246
- detail: {
247
- operation: 'getCentrifugoMonitorPublishesList',
248
- path: '/cfg/centrifugo/monitor/publishes/',
249
- method: 'GET',
250
- error: error,
251
- response: response,
252
- timestamp: new Date(),
253
- },
254
- bubbles: true,
255
- cancelable: false,
256
- });
257
- window.dispatchEvent(event);
258
- } catch (eventError) {
259
- // Silently fail - event dispatch should never crash the app
260
- consola.warn('Failed to dispatch validation error event:', eventError);
261
- }
262
- }
263
-
264
- // Re-throw the error
265
- throw error;
266
- }
267
- }
268
-
269
-
270
- /**
271
- * Get publish timeline
272
- *
273
- * @method GET
274
- * @path /cfg/centrifugo/monitor/timeline/
275
- */
276
- export async function getCentrifugoMonitorTimelineRetrieve( params?: { hours?: number; interval?: string }, client?: any
277
- ): Promise<TimelineResponse> {
278
- const api = client || getAPIInstance()
279
- const response = await api.centrifugo_monitoring.centrifugoMonitorTimelineRetrieve(params?.hours, params?.interval)
280
- try {
281
- return TimelineResponseSchema.parse(response)
282
- } catch (error) {
283
- // Zod validation error - log detailed information
284
- consola.error('❌ Zod Validation Failed');
285
- consola.box(`getCentrifugoMonitorTimelineRetrieve\nPath: /cfg/centrifugo/monitor/timeline/\nMethod: GET`);
286
-
287
- if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
288
- consola.error('Validation Issues:');
289
- (error as any).issues.forEach((issue: any, index: number) => {
290
- consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
291
- consola.error(` ├─ Message: ${issue.message}`);
292
- if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
293
- if (issue.received) consola.error(` └─ Received: ${issue.received}`);
294
- });
295
- }
296
-
297
- consola.error('Response data:', response);
298
-
299
- // Dispatch browser CustomEvent (only if window is defined)
300
- if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
301
- try {
302
- const event = new CustomEvent('zod-validation-error', {
303
- detail: {
304
- operation: 'getCentrifugoMonitorTimelineRetrieve',
305
- path: '/cfg/centrifugo/monitor/timeline/',
306
- method: 'GET',
307
- error: error,
308
- response: response,
309
- timestamp: new Date(),
310
- },
311
- bubbles: true,
312
- cancelable: false,
313
- });
314
- window.dispatchEvent(event);
315
- } catch (eventError) {
316
- // Silently fail - event dispatch should never crash the app
317
- consola.warn('Failed to dispatch validation error event:', eventError);
318
- }
319
- }
320
-
321
- // Re-throw the error
322
- throw error;
323
- }
324
- }
325
-
326
-
@@ -1,211 +0,0 @@
1
- // @ts-nocheck
2
- // Auto-generated by DjangoCFG - see CLAUDE.md
3
- /**
4
- * Typed fetchers for Centrifugo Testing
5
- *
6
- * Universal functions that work in any environment:
7
- * - Next.js (App Router / Pages Router / Server Components)
8
- * - React Native
9
- * - Node.js backend
10
- *
11
- * These fetchers use Zod schemas for runtime validation.
12
- *
13
- * Usage:
14
- * ```typescript
15
- * // Configure API once (in your app entry point)
16
- * import { configureAPI } from '../../api-instance'
17
- * configureAPI({ baseUrl: 'https://api.example.com' })
18
- *
19
- * // Then use fetchers anywhere
20
- * const users = await getUsers({ page: 1 })
21
- *
22
- * // With SWR
23
- * const { data } = useSWR(['users', params], () => getUsers(params))
24
- *
25
- * // With React Query
26
- * const { data } = useQuery(['users', params], () => getUsers(params))
27
- *
28
- * // In Server Component or SSR (pass custom client)
29
- * import { API } from '../../index'
30
- * const api = new API('https://api.example.com')
31
- * const users = await getUsers({ page: 1 }, api)
32
- * ```
33
- */
34
- import { consola } from 'consola'
35
- import { ManualAckRequestRequestSchema, type ManualAckRequestRequest } from '../schemas/ManualAckRequestRequest.schema'
36
- import { ManualAckResponseSchema, type ManualAckResponse } from '../schemas/ManualAckResponse.schema'
37
- import { PublishTestRequestRequestSchema, type PublishTestRequestRequest } from '../schemas/PublishTestRequestRequest.schema'
38
- import { PublishTestResponseSchema, type PublishTestResponse } from '../schemas/PublishTestResponse.schema'
39
- import { getAPIInstance } from '../../api-instance'
40
-
41
- /**
42
- * Publish test message
43
- *
44
- * @method POST
45
- * @path /cfg/centrifugo/testing/publish-test/
46
- */
47
- export async function createCentrifugoTestingPublishTestCreate( data: PublishTestRequestRequest, client?: any
48
- ): Promise<PublishTestResponse> {
49
- const api = client || getAPIInstance()
50
- const response = await api.centrifugo_testing.publishTestCreate(data)
51
- try {
52
- return PublishTestResponseSchema.parse(response)
53
- } catch (error) {
54
- // Zod validation error - log detailed information
55
- consola.error('❌ Zod Validation Failed');
56
- consola.box(`createCentrifugoTestingPublishTestCreate\nPath: /cfg/centrifugo/testing/publish-test/\nMethod: POST`);
57
-
58
- if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
59
- consola.error('Validation Issues:');
60
- (error as any).issues.forEach((issue: any, index: number) => {
61
- consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
62
- consola.error(` ├─ Message: ${issue.message}`);
63
- if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
64
- if (issue.received) consola.error(` └─ Received: ${issue.received}`);
65
- });
66
- }
67
-
68
- consola.error('Response data:', response);
69
-
70
- // Dispatch browser CustomEvent (only if window is defined)
71
- if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
72
- try {
73
- const event = new CustomEvent('zod-validation-error', {
74
- detail: {
75
- operation: 'createCentrifugoTestingPublishTestCreate',
76
- path: '/cfg/centrifugo/testing/publish-test/',
77
- method: 'POST',
78
- error: error,
79
- response: response,
80
- timestamp: new Date(),
81
- },
82
- bubbles: true,
83
- cancelable: false,
84
- });
85
- window.dispatchEvent(event);
86
- } catch (eventError) {
87
- // Silently fail - event dispatch should never crash the app
88
- consola.warn('Failed to dispatch validation error event:', eventError);
89
- }
90
- }
91
-
92
- // Re-throw the error
93
- throw error;
94
- }
95
- }
96
-
97
-
98
- /**
99
- * Publish with database logging
100
- *
101
- * @method POST
102
- * @path /cfg/centrifugo/testing/publish-with-logging/
103
- */
104
- export async function createCentrifugoTestingPublishWithLoggingCreate( data: PublishTestRequestRequest, client?: any
105
- ): Promise<PublishTestResponse> {
106
- const api = client || getAPIInstance()
107
- const response = await api.centrifugo_testing.publishWithLoggingCreate(data)
108
- try {
109
- return PublishTestResponseSchema.parse(response)
110
- } catch (error) {
111
- // Zod validation error - log detailed information
112
- consola.error('❌ Zod Validation Failed');
113
- consola.box(`createCentrifugoTestingPublishWithLoggingCreate\nPath: /cfg/centrifugo/testing/publish-with-logging/\nMethod: POST`);
114
-
115
- if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
116
- consola.error('Validation Issues:');
117
- (error as any).issues.forEach((issue: any, index: number) => {
118
- consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
119
- consola.error(` ├─ Message: ${issue.message}`);
120
- if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
121
- if (issue.received) consola.error(` └─ Received: ${issue.received}`);
122
- });
123
- }
124
-
125
- consola.error('Response data:', response);
126
-
127
- // Dispatch browser CustomEvent (only if window is defined)
128
- if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
129
- try {
130
- const event = new CustomEvent('zod-validation-error', {
131
- detail: {
132
- operation: 'createCentrifugoTestingPublishWithLoggingCreate',
133
- path: '/cfg/centrifugo/testing/publish-with-logging/',
134
- method: 'POST',
135
- error: error,
136
- response: response,
137
- timestamp: new Date(),
138
- },
139
- bubbles: true,
140
- cancelable: false,
141
- });
142
- window.dispatchEvent(event);
143
- } catch (eventError) {
144
- // Silently fail - event dispatch should never crash the app
145
- consola.warn('Failed to dispatch validation error event:', eventError);
146
- }
147
- }
148
-
149
- // Re-throw the error
150
- throw error;
151
- }
152
- }
153
-
154
-
155
- /**
156
- * Send manual ACK
157
- *
158
- * @method POST
159
- * @path /cfg/centrifugo/testing/send-ack/
160
- */
161
- export async function createCentrifugoTestingSendAckCreate( data: ManualAckRequestRequest, client?: any
162
- ): Promise<ManualAckResponse> {
163
- const api = client || getAPIInstance()
164
- const response = await api.centrifugo_testing.sendAckCreate(data)
165
- try {
166
- return ManualAckResponseSchema.parse(response)
167
- } catch (error) {
168
- // Zod validation error - log detailed information
169
- consola.error('❌ Zod Validation Failed');
170
- consola.box(`createCentrifugoTestingSendAckCreate\nPath: /cfg/centrifugo/testing/send-ack/\nMethod: POST`);
171
-
172
- if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
173
- consola.error('Validation Issues:');
174
- (error as any).issues.forEach((issue: any, index: number) => {
175
- consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
176
- consola.error(` ├─ Message: ${issue.message}`);
177
- if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
178
- if (issue.received) consola.error(` └─ Received: ${issue.received}`);
179
- });
180
- }
181
-
182
- consola.error('Response data:', response);
183
-
184
- // Dispatch browser CustomEvent (only if window is defined)
185
- if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
186
- try {
187
- const event = new CustomEvent('zod-validation-error', {
188
- detail: {
189
- operation: 'createCentrifugoTestingSendAckCreate',
190
- path: '/cfg/centrifugo/testing/send-ack/',
191
- method: 'POST',
192
- error: error,
193
- response: response,
194
- timestamp: new Date(),
195
- },
196
- bubbles: true,
197
- cancelable: false,
198
- });
199
- window.dispatchEvent(event);
200
- } catch (eventError) {
201
- // Silently fail - event dispatch should never crash the app
202
- consola.warn('Failed to dispatch validation error event:', eventError);
203
- }
204
- }
205
-
206
- // Re-throw the error
207
- throw error;
208
- }
209
- }
210
-
211
-
@@ -1,141 +0,0 @@
1
- // @ts-nocheck
2
- // Auto-generated by DjangoCFG - see CLAUDE.md
3
- 'use client';
4
-
5
- /**
6
- * SWR Hooks for Centrifugo Admin API
7
- *
8
- * React hooks powered by SWR for data fetching with automatic caching,
9
- * revalidation, and optimistic updates.
10
- *
11
- * Usage:
12
- * ```typescript
13
- * // Query hooks (GET)
14
- * const { data, error, isLoading } = useUsers({ page: 1 })
15
- *
16
- * // Mutation hooks (POST/PUT/PATCH/DELETE)
17
- * const createUser = useCreateUser()
18
- * await createUser({ name: 'John', email: 'john@example.com' })
19
- * ```
20
- */
21
- import { useSWRConfig } from 'swr'
22
- import * as Fetchers from '../fetchers/centrifugo__centrifugo_admin_api'
23
- import type { API } from '../../index'
24
- import type { CentrifugoChannelsRequestRequest } from '../schemas/CentrifugoChannelsRequestRequest.schema'
25
- import type { CentrifugoChannelsResponse } from '../schemas/CentrifugoChannelsResponse.schema'
26
- import type { CentrifugoHistoryRequestRequest } from '../schemas/CentrifugoHistoryRequestRequest.schema'
27
- import type { CentrifugoHistoryResponse } from '../schemas/CentrifugoHistoryResponse.schema'
28
- import type { CentrifugoInfoResponse } from '../schemas/CentrifugoInfoResponse.schema'
29
- import type { CentrifugoPresenceRequestRequest } from '../schemas/CentrifugoPresenceRequestRequest.schema'
30
- import type { CentrifugoPresenceResponse } from '../schemas/CentrifugoPresenceResponse.schema'
31
- import type { CentrifugoPresenceStatsRequestRequest } from '../schemas/CentrifugoPresenceStatsRequestRequest.schema'
32
- import type { CentrifugoPresenceStatsResponse } from '../schemas/CentrifugoPresenceStatsResponse.schema'
33
-
34
- /**
35
- * Get connection token for dashboard
36
- *
37
- * @method POST
38
- * @path /cfg/centrifugo/server/auth/token/
39
- */
40
- export function useCreateCentrifugoServerAuthTokenCreate() {
41
- const { mutate } = useSWRConfig()
42
-
43
- return async (client?: API): Promise<any> => {
44
- const result = await Fetchers.createCentrifugoServerAuthTokenCreate(client)
45
- // Revalidate related queries
46
- mutate('cfg-centrifugo-server-auth-token')
47
- return result
48
- }
49
- }
50
-
51
-
52
- /**
53
- * List active channels
54
- *
55
- * @method POST
56
- * @path /cfg/centrifugo/server/channels/
57
- */
58
- export function useCreateCentrifugoServerChannelsCreate() {
59
- const { mutate } = useSWRConfig()
60
-
61
- return async (data: CentrifugoChannelsRequestRequest, client?: API): Promise<CentrifugoChannelsResponse> => {
62
- const result = await Fetchers.createCentrifugoServerChannelsCreate(data, client)
63
- // Revalidate related queries
64
- mutate('cfg-centrifugo-server-channels')
65
- return result
66
- }
67
- }
68
-
69
-
70
- /**
71
- * Get channel history
72
- *
73
- * @method POST
74
- * @path /cfg/centrifugo/server/history/
75
- */
76
- export function useCreateCentrifugoServerHistoryCreate() {
77
- const { mutate } = useSWRConfig()
78
-
79
- return async (data: CentrifugoHistoryRequestRequest, client?: API): Promise<CentrifugoHistoryResponse> => {
80
- const result = await Fetchers.createCentrifugoServerHistoryCreate(data, client)
81
- // Revalidate related queries
82
- mutate('cfg-centrifugo-server-history')
83
- return result
84
- }
85
- }
86
-
87
-
88
- /**
89
- * Get Centrifugo server info
90
- *
91
- * @method POST
92
- * @path /cfg/centrifugo/server/info/
93
- */
94
- export function useCreateCentrifugoServerInfoCreate() {
95
- const { mutate } = useSWRConfig()
96
-
97
- return async (client?: API): Promise<CentrifugoInfoResponse> => {
98
- const result = await Fetchers.createCentrifugoServerInfoCreate(client)
99
- // Revalidate related queries
100
- mutate('cfg-centrifugo-server-info')
101
- return result
102
- }
103
- }
104
-
105
-
106
- /**
107
- * Get channel presence
108
- *
109
- * @method POST
110
- * @path /cfg/centrifugo/server/presence/
111
- */
112
- export function useCreateCentrifugoServerPresenceCreate() {
113
- const { mutate } = useSWRConfig()
114
-
115
- return async (data: CentrifugoPresenceRequestRequest, client?: API): Promise<CentrifugoPresenceResponse> => {
116
- const result = await Fetchers.createCentrifugoServerPresenceCreate(data, client)
117
- // Revalidate related queries
118
- mutate('cfg-centrifugo-server-presence')
119
- return result
120
- }
121
- }
122
-
123
-
124
- /**
125
- * Get channel presence statistics
126
- *
127
- * @method POST
128
- * @path /cfg/centrifugo/server/presence-stats/
129
- */
130
- export function useCreateCentrifugoServerPresenceStatsCreate() {
131
- const { mutate } = useSWRConfig()
132
-
133
- return async (data: CentrifugoPresenceStatsRequestRequest, client?: API): Promise<CentrifugoPresenceStatsResponse> => {
134
- const result = await Fetchers.createCentrifugoServerPresenceStatsCreate(data, client)
135
- // Revalidate related queries
136
- mutate('cfg-centrifugo-server-presence-stats')
137
- return result
138
- }
139
- }
140
-
141
-