@djangocfg/api 2.1.231 → 2.1.233
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.
- package/README.md +25 -4
- package/dist/auth-server.cjs +45 -358
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +43 -356
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +223 -735
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +218 -730
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +313 -1568
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +211 -1932
- package/dist/clients.d.ts +211 -1932
- package/dist/clients.mjs +309 -1564
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +36 -32
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +76 -76
- package/dist/hooks.d.ts +76 -76
- package/dist/hooks.mjs +36 -32
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +88 -593
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +88 -88
- package/dist/index.d.ts +88 -88
- package/dist/index.mjs +88 -593
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/cfg_accounts/accounts/models.ts +34 -34
- package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +41 -41
- package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +18 -18
- package/src/_api/generated/cfg_accounts/client.ts +39 -42
- package/src/_api/generated/cfg_centrifugo/CLAUDE.md +2 -27
- package/src/_api/generated/cfg_centrifugo/_utils/fetchers/index.ts +0 -3
- package/src/_api/generated/cfg_centrifugo/_utils/hooks/index.ts +0 -3
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/index.ts +0 -34
- package/src/_api/generated/cfg_centrifugo/client.ts +39 -51
- package/src/_api/generated/cfg_centrifugo/index.ts +0 -21
- package/src/_api/generated/cfg_centrifugo/schema.json +4 -2039
- package/src/_api/generated/cfg_totp/client.ts +39 -42
- package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +10 -10
- package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +12 -12
- package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +8 -8
- package/src/_api/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts +0 -344
- package/src/_api/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts +0 -326
- package/src/_api/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts +0 -211
- package/src/_api/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_admin_api.ts +0 -141
- package/src/_api/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts +0 -99
- package/src/_api/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_testing.ts +0 -82
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelInfo.schema.ts +0 -19
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts +0 -19
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResponse.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResult.schema.ts +0 -20
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoClientInfo.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoError.schema.ts +0 -20
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoHealthCheck.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts +0 -23
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResponse.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResult.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResponse.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResult.schema.ts +0 -20
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoMetrics.schema.ts +0 -20
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoNodeInfo.schema.ts +0 -30
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoOverviewStats.schema.ts +0 -26
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceRequestRequest.schema.ts +0 -19
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResponse.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResult.schema.ts +0 -20
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsRequestRequest.schema.ts +0 -19
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResult.schema.ts +0 -20
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoProcess.schema.ts +0 -20
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoPublication.schema.ts +0 -23
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/CentrifugoStreamPosition.schema.ts +0 -20
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/ChannelList.schema.ts +0 -21
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/ChannelStats.schema.ts +0 -25
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/ManualAckRequestRequest.schema.ts +0 -20
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/ManualAckResponse.schema.ts +0 -21
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/PaginatedPublishList.schema.ts +0 -24
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/Publish.schema.ts +0 -29
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/PublishTestRequestRequest.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/PublishTestResponse.schema.ts +0 -24
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/TimelineItem.schema.ts +0 -23
- package/src/_api/generated/cfg_centrifugo/_utils/schemas/TimelineResponse.schema.ts +0 -22
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/client.ts +0 -76
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/index.ts +0 -4
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/models.ts +0 -268
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/client.ts +0 -110
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/index.ts +0 -4
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/models.ts +0 -144
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_testing/client.ts +0 -48
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_testing/index.ts +0 -4
- package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_testing/models.ts +0 -64
|
@@ -254,55 +254,52 @@ export class APIClient {
|
|
|
254
254
|
throw error;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
257
|
+
// Classify network error using PerformanceResourceTiming.
|
|
258
|
+
// Browser intentionally makes CORS errors indistinguishable from network failures
|
|
259
|
+
// (same TypeError: "Failed to fetch") for security reasons. We use PerformanceResourceTiming
|
|
260
|
+
// as the best available heuristic:
|
|
261
|
+
// - Entry exists with responseStatus === 0 → request reached server, JS blocked → likely CORS
|
|
262
|
+
// - No entry / entry missing → connection never established → server unavailable / DNS / offline
|
|
263
|
+
// All cases are dispatched as 'network-error' with a `possibly_cors` flag.
|
|
264
|
+
let possiblyCors = false;
|
|
265
|
+
if (error instanceof TypeError && typeof window !== 'undefined') {
|
|
266
|
+
try {
|
|
267
|
+
const isCrossOrigin = (() => {
|
|
268
|
+
try { return new URL(url).origin !== window.location.origin; } catch { return false; }
|
|
269
|
+
})();
|
|
270
|
+
if (isCrossOrigin) {
|
|
271
|
+
const entries = performance.getEntriesByName(url, 'resource');
|
|
272
|
+
if (entries.length > 0) {
|
|
273
|
+
const last = entries[entries.length - 1] as PerformanceResourceTiming;
|
|
274
|
+
possiblyCors = 'responseStatus' in last && (last as any).responseStatus === 0;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
} catch { /* ignore — PerformanceResourceTiming not available */ }
|
|
278
|
+
}
|
|
262
279
|
|
|
263
|
-
// Log specific error type first
|
|
264
280
|
if (this.logger) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
this.logger.error(` →
|
|
269
|
-
} else {
|
|
270
|
-
this.logger.error(`⚠️ Network Error: ${method} ${url}`);
|
|
271
|
-
this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);
|
|
281
|
+
this.logger.error(`⚠️ Network Error: ${method} ${url}`);
|
|
282
|
+
this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);
|
|
283
|
+
if (possiblyCors) {
|
|
284
|
+
this.logger.error(` → Possibly blocked by CORS policy (configure CORS on the server)`);
|
|
272
285
|
}
|
|
273
286
|
}
|
|
274
287
|
|
|
275
|
-
// Dispatch
|
|
288
|
+
// Dispatch network-error event with possibly_cors hint
|
|
276
289
|
if (typeof window !== 'undefined') {
|
|
277
290
|
try {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
} else {
|
|
291
|
-
// Dispatch generic network error event
|
|
292
|
-
window.dispatchEvent(new CustomEvent('network-error', {
|
|
293
|
-
detail: {
|
|
294
|
-
url: url,
|
|
295
|
-
method: method,
|
|
296
|
-
error: error instanceof Error ? error.message : String(error),
|
|
297
|
-
timestamp: new Date(),
|
|
298
|
-
},
|
|
299
|
-
bubbles: true,
|
|
300
|
-
cancelable: false,
|
|
301
|
-
}));
|
|
302
|
-
}
|
|
303
|
-
} catch (eventError) {
|
|
304
|
-
// Silently fail - event dispatch should never crash the app
|
|
305
|
-
}
|
|
291
|
+
window.dispatchEvent(new CustomEvent('network-error', {
|
|
292
|
+
detail: {
|
|
293
|
+
url: url,
|
|
294
|
+
method: method,
|
|
295
|
+
error: error instanceof Error ? error.message : String(error),
|
|
296
|
+
possibly_cors: possiblyCors,
|
|
297
|
+
timestamp: new Date(),
|
|
298
|
+
},
|
|
299
|
+
bubbles: true,
|
|
300
|
+
cancelable: false,
|
|
301
|
+
}));
|
|
302
|
+
} catch { /* silently ignore — event dispatch must never crash the app */ }
|
|
306
303
|
}
|
|
307
304
|
|
|
308
305
|
// Wrap other errors as NetworkError
|
|
@@ -2,6 +2,16 @@
|
|
|
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
|
+
|
|
5
15
|
/**
|
|
6
16
|
*
|
|
7
17
|
* Response model (includes read-only fields).
|
|
@@ -27,16 +37,6 @@ export interface PaginatedDeviceListResponseList {
|
|
|
27
37
|
results: Array<DeviceListResponse>;
|
|
28
38
|
}
|
|
29
39
|
|
|
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,17 +1,5 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
|
-
/**
|
|
4
|
-
* Serializer for confirming 2FA setup with first code.
|
|
5
|
-
*
|
|
6
|
-
* Request model (no read-only fields).
|
|
7
|
-
*/
|
|
8
|
-
export interface ConfirmSetupRequest {
|
|
9
|
-
/** Device ID from setup response */
|
|
10
|
-
device_id: string;
|
|
11
|
-
/** 6-digit TOTP code from authenticator app */
|
|
12
|
-
code: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
3
|
/**
|
|
16
4
|
* Response serializer for setup initiation.
|
|
17
5
|
*
|
|
@@ -30,6 +18,18 @@ export interface SetupResponse {
|
|
|
30
18
|
expires_in: number;
|
|
31
19
|
}
|
|
32
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Serializer for confirming 2FA setup with first code.
|
|
23
|
+
*
|
|
24
|
+
* Request model (no read-only fields).
|
|
25
|
+
*/
|
|
26
|
+
export interface ConfirmSetupRequest {
|
|
27
|
+
/** Device ID from setup response */
|
|
28
|
+
device_id: string;
|
|
29
|
+
/** 6-digit TOTP code from authenticator app */
|
|
30
|
+
code: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
33
|
/**
|
|
34
34
|
* Serializer for starting 2FA setup.
|
|
35
35
|
*
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
3
|
/**
|
|
4
|
-
* Serializer for
|
|
4
|
+
* Serializer for backup code verification during login.
|
|
5
5
|
*
|
|
6
6
|
* Request model (no read-only fields).
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface VerifyBackupRequest {
|
|
9
9
|
/** 2FA session ID from login response */
|
|
10
10
|
session_id: string;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/** 8-character backup recovery code */
|
|
12
|
+
backup_code: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Serializer for
|
|
16
|
+
* Serializer for TOTP code verification during login.
|
|
17
17
|
*
|
|
18
18
|
* Request model (no read-only fields).
|
|
19
19
|
*/
|
|
20
|
-
export interface
|
|
20
|
+
export interface VerifyRequest {
|
|
21
21
|
/** 2FA session ID from login response */
|
|
22
22
|
session_id: string;
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/** 6-digit TOTP code from authenticator app */
|
|
24
|
+
code: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
package/src/_api/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts
DELETED
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
// Auto-generated by DjangoCFG - see CLAUDE.md
|
|
3
|
-
/**
|
|
4
|
-
* Typed fetchers for Centrifugo Admin API
|
|
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 { CentrifugoChannelsRequestRequestSchema, type CentrifugoChannelsRequestRequest } from '../schemas/CentrifugoChannelsRequestRequest.schema'
|
|
36
|
-
import { CentrifugoChannelsResponseSchema, type CentrifugoChannelsResponse } from '../schemas/CentrifugoChannelsResponse.schema'
|
|
37
|
-
import { CentrifugoHistoryRequestRequestSchema, type CentrifugoHistoryRequestRequest } from '../schemas/CentrifugoHistoryRequestRequest.schema'
|
|
38
|
-
import { CentrifugoHistoryResponseSchema, type CentrifugoHistoryResponse } from '../schemas/CentrifugoHistoryResponse.schema'
|
|
39
|
-
import { CentrifugoInfoResponseSchema, type CentrifugoInfoResponse } from '../schemas/CentrifugoInfoResponse.schema'
|
|
40
|
-
import { CentrifugoPresenceRequestRequestSchema, type CentrifugoPresenceRequestRequest } from '../schemas/CentrifugoPresenceRequestRequest.schema'
|
|
41
|
-
import { CentrifugoPresenceResponseSchema, type CentrifugoPresenceResponse } from '../schemas/CentrifugoPresenceResponse.schema'
|
|
42
|
-
import { CentrifugoPresenceStatsRequestRequestSchema, type CentrifugoPresenceStatsRequestRequest } from '../schemas/CentrifugoPresenceStatsRequestRequest.schema'
|
|
43
|
-
import { CentrifugoPresenceStatsResponseSchema, type CentrifugoPresenceStatsResponse } from '../schemas/CentrifugoPresenceStatsResponse.schema'
|
|
44
|
-
import { getAPIInstance } from '../../api-instance'
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Get connection token for dashboard
|
|
48
|
-
*
|
|
49
|
-
* @method POST
|
|
50
|
-
* @path /cfg/centrifugo/server/auth/token/
|
|
51
|
-
*/
|
|
52
|
-
export async function createCentrifugoServerAuthTokenCreate( client?: any
|
|
53
|
-
): Promise<any> {
|
|
54
|
-
const api = client || getAPIInstance()
|
|
55
|
-
const response = await api.centrifugo_admin_api.centrifugoServerAuthTokenCreate()
|
|
56
|
-
return response
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* List active channels
|
|
62
|
-
*
|
|
63
|
-
* @method POST
|
|
64
|
-
* @path /cfg/centrifugo/server/channels/
|
|
65
|
-
*/
|
|
66
|
-
export async function createCentrifugoServerChannelsCreate( data: CentrifugoChannelsRequestRequest, client?: any
|
|
67
|
-
): Promise<CentrifugoChannelsResponse> {
|
|
68
|
-
const api = client || getAPIInstance()
|
|
69
|
-
const response = await api.centrifugo_admin_api.centrifugoServerChannelsCreate(data)
|
|
70
|
-
try {
|
|
71
|
-
return CentrifugoChannelsResponseSchema.parse(response)
|
|
72
|
-
} catch (error) {
|
|
73
|
-
// Zod validation error - log detailed information
|
|
74
|
-
consola.error('❌ Zod Validation Failed');
|
|
75
|
-
consola.box(`createCentrifugoServerChannelsCreate\nPath: /cfg/centrifugo/server/channels/\nMethod: POST`);
|
|
76
|
-
|
|
77
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
78
|
-
consola.error('Validation Issues:');
|
|
79
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
80
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
81
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
82
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
83
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
consola.error('Response data:', response);
|
|
88
|
-
|
|
89
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
90
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
91
|
-
try {
|
|
92
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
93
|
-
detail: {
|
|
94
|
-
operation: 'createCentrifugoServerChannelsCreate',
|
|
95
|
-
path: '/cfg/centrifugo/server/channels/',
|
|
96
|
-
method: 'POST',
|
|
97
|
-
error: error,
|
|
98
|
-
response: response,
|
|
99
|
-
timestamp: new Date(),
|
|
100
|
-
},
|
|
101
|
-
bubbles: true,
|
|
102
|
-
cancelable: false,
|
|
103
|
-
});
|
|
104
|
-
window.dispatchEvent(event);
|
|
105
|
-
} catch (eventError) {
|
|
106
|
-
// Silently fail - event dispatch should never crash the app
|
|
107
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Re-throw the error
|
|
112
|
-
throw error;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Get channel history
|
|
119
|
-
*
|
|
120
|
-
* @method POST
|
|
121
|
-
* @path /cfg/centrifugo/server/history/
|
|
122
|
-
*/
|
|
123
|
-
export async function createCentrifugoServerHistoryCreate( data: CentrifugoHistoryRequestRequest, client?: any
|
|
124
|
-
): Promise<CentrifugoHistoryResponse> {
|
|
125
|
-
const api = client || getAPIInstance()
|
|
126
|
-
const response = await api.centrifugo_admin_api.centrifugoServerHistoryCreate(data)
|
|
127
|
-
try {
|
|
128
|
-
return CentrifugoHistoryResponseSchema.parse(response)
|
|
129
|
-
} catch (error) {
|
|
130
|
-
// Zod validation error - log detailed information
|
|
131
|
-
consola.error('❌ Zod Validation Failed');
|
|
132
|
-
consola.box(`createCentrifugoServerHistoryCreate\nPath: /cfg/centrifugo/server/history/\nMethod: POST`);
|
|
133
|
-
|
|
134
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
135
|
-
consola.error('Validation Issues:');
|
|
136
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
137
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
138
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
139
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
140
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
consola.error('Response data:', response);
|
|
145
|
-
|
|
146
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
147
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
148
|
-
try {
|
|
149
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
150
|
-
detail: {
|
|
151
|
-
operation: 'createCentrifugoServerHistoryCreate',
|
|
152
|
-
path: '/cfg/centrifugo/server/history/',
|
|
153
|
-
method: 'POST',
|
|
154
|
-
error: error,
|
|
155
|
-
response: response,
|
|
156
|
-
timestamp: new Date(),
|
|
157
|
-
},
|
|
158
|
-
bubbles: true,
|
|
159
|
-
cancelable: false,
|
|
160
|
-
});
|
|
161
|
-
window.dispatchEvent(event);
|
|
162
|
-
} catch (eventError) {
|
|
163
|
-
// Silently fail - event dispatch should never crash the app
|
|
164
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// Re-throw the error
|
|
169
|
-
throw error;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Get Centrifugo server info
|
|
176
|
-
*
|
|
177
|
-
* @method POST
|
|
178
|
-
* @path /cfg/centrifugo/server/info/
|
|
179
|
-
*/
|
|
180
|
-
export async function createCentrifugoServerInfoCreate( client?: any
|
|
181
|
-
): Promise<CentrifugoInfoResponse> {
|
|
182
|
-
const api = client || getAPIInstance()
|
|
183
|
-
const response = await api.centrifugo_admin_api.centrifugoServerInfoCreate()
|
|
184
|
-
try {
|
|
185
|
-
return CentrifugoInfoResponseSchema.parse(response)
|
|
186
|
-
} catch (error) {
|
|
187
|
-
// Zod validation error - log detailed information
|
|
188
|
-
consola.error('❌ Zod Validation Failed');
|
|
189
|
-
consola.box(`createCentrifugoServerInfoCreate\nPath: /cfg/centrifugo/server/info/\nMethod: POST`);
|
|
190
|
-
|
|
191
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
192
|
-
consola.error('Validation Issues:');
|
|
193
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
194
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
195
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
196
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
197
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
consola.error('Response data:', response);
|
|
202
|
-
|
|
203
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
204
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
205
|
-
try {
|
|
206
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
207
|
-
detail: {
|
|
208
|
-
operation: 'createCentrifugoServerInfoCreate',
|
|
209
|
-
path: '/cfg/centrifugo/server/info/',
|
|
210
|
-
method: 'POST',
|
|
211
|
-
error: error,
|
|
212
|
-
response: response,
|
|
213
|
-
timestamp: new Date(),
|
|
214
|
-
},
|
|
215
|
-
bubbles: true,
|
|
216
|
-
cancelable: false,
|
|
217
|
-
});
|
|
218
|
-
window.dispatchEvent(event);
|
|
219
|
-
} catch (eventError) {
|
|
220
|
-
// Silently fail - event dispatch should never crash the app
|
|
221
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Re-throw the error
|
|
226
|
-
throw error;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Get channel presence
|
|
233
|
-
*
|
|
234
|
-
* @method POST
|
|
235
|
-
* @path /cfg/centrifugo/server/presence/
|
|
236
|
-
*/
|
|
237
|
-
export async function createCentrifugoServerPresenceCreate( data: CentrifugoPresenceRequestRequest, client?: any
|
|
238
|
-
): Promise<CentrifugoPresenceResponse> {
|
|
239
|
-
const api = client || getAPIInstance()
|
|
240
|
-
const response = await api.centrifugo_admin_api.centrifugoServerPresenceCreate(data)
|
|
241
|
-
try {
|
|
242
|
-
return CentrifugoPresenceResponseSchema.parse(response)
|
|
243
|
-
} catch (error) {
|
|
244
|
-
// Zod validation error - log detailed information
|
|
245
|
-
consola.error('❌ Zod Validation Failed');
|
|
246
|
-
consola.box(`createCentrifugoServerPresenceCreate\nPath: /cfg/centrifugo/server/presence/\nMethod: POST`);
|
|
247
|
-
|
|
248
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
249
|
-
consola.error('Validation Issues:');
|
|
250
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
251
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
252
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
253
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
254
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
consola.error('Response data:', response);
|
|
259
|
-
|
|
260
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
261
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
262
|
-
try {
|
|
263
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
264
|
-
detail: {
|
|
265
|
-
operation: 'createCentrifugoServerPresenceCreate',
|
|
266
|
-
path: '/cfg/centrifugo/server/presence/',
|
|
267
|
-
method: 'POST',
|
|
268
|
-
error: error,
|
|
269
|
-
response: response,
|
|
270
|
-
timestamp: new Date(),
|
|
271
|
-
},
|
|
272
|
-
bubbles: true,
|
|
273
|
-
cancelable: false,
|
|
274
|
-
});
|
|
275
|
-
window.dispatchEvent(event);
|
|
276
|
-
} catch (eventError) {
|
|
277
|
-
// Silently fail - event dispatch should never crash the app
|
|
278
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// Re-throw the error
|
|
283
|
-
throw error;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Get channel presence statistics
|
|
290
|
-
*
|
|
291
|
-
* @method POST
|
|
292
|
-
* @path /cfg/centrifugo/server/presence-stats/
|
|
293
|
-
*/
|
|
294
|
-
export async function createCentrifugoServerPresenceStatsCreate( data: CentrifugoPresenceStatsRequestRequest, client?: any
|
|
295
|
-
): Promise<CentrifugoPresenceStatsResponse> {
|
|
296
|
-
const api = client || getAPIInstance()
|
|
297
|
-
const response = await api.centrifugo_admin_api.centrifugoServerPresenceStatsCreate(data)
|
|
298
|
-
try {
|
|
299
|
-
return CentrifugoPresenceStatsResponseSchema.parse(response)
|
|
300
|
-
} catch (error) {
|
|
301
|
-
// Zod validation error - log detailed information
|
|
302
|
-
consola.error('❌ Zod Validation Failed');
|
|
303
|
-
consola.box(`createCentrifugoServerPresenceStatsCreate\nPath: /cfg/centrifugo/server/presence-stats/\nMethod: POST`);
|
|
304
|
-
|
|
305
|
-
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
306
|
-
consola.error('Validation Issues:');
|
|
307
|
-
(error as any).issues.forEach((issue: any, index: number) => {
|
|
308
|
-
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
309
|
-
consola.error(` ├─ Message: ${issue.message}`);
|
|
310
|
-
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
311
|
-
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
consola.error('Response data:', response);
|
|
316
|
-
|
|
317
|
-
// Dispatch browser CustomEvent (only if window is defined)
|
|
318
|
-
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
319
|
-
try {
|
|
320
|
-
const event = new CustomEvent('zod-validation-error', {
|
|
321
|
-
detail: {
|
|
322
|
-
operation: 'createCentrifugoServerPresenceStatsCreate',
|
|
323
|
-
path: '/cfg/centrifugo/server/presence-stats/',
|
|
324
|
-
method: 'POST',
|
|
325
|
-
error: error,
|
|
326
|
-
response: response,
|
|
327
|
-
timestamp: new Date(),
|
|
328
|
-
},
|
|
329
|
-
bubbles: true,
|
|
330
|
-
cancelable: false,
|
|
331
|
-
});
|
|
332
|
-
window.dispatchEvent(event);
|
|
333
|
-
} catch (eventError) {
|
|
334
|
-
// Silently fail - event dispatch should never crash the app
|
|
335
|
-
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Re-throw the error
|
|
340
|
-
throw error;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|