@djangocfg/api 1.4.28 → 1.4.29
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/dist/index.cjs +4125 -3718
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +687 -41
- package/dist/index.d.ts +687 -41
- package/dist/index.mjs +4042 -3323
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/contexts/index.ts +3 -0
- package/src/cfg/contexts/knowbase/index.ts +3 -0
- package/src/cfg/generated/_utils/fetchers/cfg__accounts.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__accounts__auth.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__accounts__user_profile.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_admin_api.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_auth.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_monitoring.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_testing.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_api_zones.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_charts.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_commands.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_config.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_overview.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_statistics.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_system.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__db.ts +552 -0
- package/src/cfg/generated/_utils/fetchers/cfg__endpoints.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_api_keys.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_charts.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_configuration.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_monitoring.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_proto_files.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_services.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_testing.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__health.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__knowbase.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__leads.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__leads__lead_submission.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__bulk_email.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__campaigns.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__logs.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__newsletters.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__subscriptions.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__newsletter__testing.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__payments.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_jobs.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_monitoring.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_queues.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_registries.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_schedules.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_testing.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_workers.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/cfg__support.ts +2 -0
- package/src/cfg/generated/_utils/fetchers/index.ts +1 -0
- package/src/cfg/generated/_utils/hooks/cfg__accounts.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__accounts__auth.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__accounts__user_profile.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_admin_api.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_auth.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_monitoring.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__centrifugo__centrifugo_testing.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_activity.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_api_zones.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_charts.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_commands.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_config.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_overview.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_statistics.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__dashboard__dashboard_system.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__db.ts +151 -0
- package/src/cfg/generated/_utils/hooks/cfg__endpoints.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_api_keys.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_charts.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_configuration.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_monitoring.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_proto_files.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_services.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_testing.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__health.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__knowbase.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__leads.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__leads__lead_submission.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__newsletter.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__newsletter__bulk_email.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__newsletter__campaigns.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__newsletter__logs.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__newsletter__newsletters.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__newsletter__subscriptions.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__newsletter__testing.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__payments.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_jobs.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_monitoring.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_queues.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_registries.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_schedules.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_testing.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__rq__rq_workers.ts +2 -0
- package/src/cfg/generated/_utils/hooks/cfg__support.ts +2 -0
- package/src/cfg/generated/_utils/hooks/index.ts +3 -0
- package/src/cfg/generated/_utils/schemas/BackupRecord.schema.ts +43 -0
- package/src/cfg/generated/_utils/schemas/BackupRecordList.schema.ts +28 -0
- package/src/cfg/generated/_utils/schemas/PaginatedBackupRecordListList.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/PaginatedRestoreRecordList.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/RestoreRecord.schema.ts +30 -0
- package/src/cfg/generated/_utils/schemas/index.ts +5 -0
- package/src/cfg/generated/cfg__accounts/models.ts +2 -2
- package/src/cfg/generated/cfg__db/client.ts +117 -0
- package/src/cfg/generated/cfg__db/index.ts +2 -0
- package/src/cfg/generated/cfg__db/models.ts +181 -0
- package/src/cfg/generated/cfg__leads/client.ts +12 -6
- package/src/cfg/generated/client.ts +5 -0
- package/src/cfg/generated/enums.ts +83 -0
- package/src/cfg/generated/index.ts +5 -0
- package/src/cfg/generated/schema.json +803 -69
- package/src/cfg/generated/storage.ts +2 -0
- package/src/cfg/generated/validation-events.ts +2 -0
|
@@ -0,0 +1,552 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Typed fetchers for Db
|
|
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 { BackupRecordSchema, type BackupRecord } from '../schemas/BackupRecord.schema'
|
|
36
|
+
import { PaginatedBackupRecordListListSchema, type PaginatedBackupRecordListList } from '../schemas/PaginatedBackupRecordListList.schema'
|
|
37
|
+
import { PaginatedRestoreRecordListSchema, type PaginatedRestoreRecordList } from '../schemas/PaginatedRestoreRecordList.schema'
|
|
38
|
+
import { RestoreRecordSchema, type RestoreRecord } from '../schemas/RestoreRecord.schema'
|
|
39
|
+
import { getAPIInstance } from '../../api-instance'
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* API operation
|
|
43
|
+
*
|
|
44
|
+
* @method GET
|
|
45
|
+
* @path /cfg/db/backups/
|
|
46
|
+
*/
|
|
47
|
+
export async function getDbBackupsList( params?: { page?: number; page_size?: number }, client?: any
|
|
48
|
+
): Promise<PaginatedBackupRecordListList> {
|
|
49
|
+
const api = client || getAPIInstance()
|
|
50
|
+
const response = await api.cfg_db.backupsList(params?.page, params?.page_size)
|
|
51
|
+
try {
|
|
52
|
+
return PaginatedBackupRecordListListSchema.parse(response)
|
|
53
|
+
} catch (error) {
|
|
54
|
+
// Zod validation error - log detailed information
|
|
55
|
+
consola.error('❌ Zod Validation Failed');
|
|
56
|
+
consola.box({
|
|
57
|
+
title: 'getDbBackupsList',
|
|
58
|
+
message: `Path: /cfg/db/backups/\nMethod: GET`,
|
|
59
|
+
style: {
|
|
60
|
+
borderColor: 'red',
|
|
61
|
+
borderStyle: 'rounded'
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
66
|
+
consola.error('Validation Issues:');
|
|
67
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
68
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
69
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
70
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
71
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
consola.error('Response data:', response);
|
|
76
|
+
|
|
77
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
78
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
79
|
+
try {
|
|
80
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
81
|
+
detail: {
|
|
82
|
+
operation: 'getDbBackupsList',
|
|
83
|
+
path: '/cfg/db/backups/',
|
|
84
|
+
method: 'GET',
|
|
85
|
+
error: error,
|
|
86
|
+
response: response,
|
|
87
|
+
timestamp: new Date(),
|
|
88
|
+
},
|
|
89
|
+
bubbles: true,
|
|
90
|
+
cancelable: false,
|
|
91
|
+
});
|
|
92
|
+
window.dispatchEvent(event);
|
|
93
|
+
} catch (eventError) {
|
|
94
|
+
// Silently fail - event dispatch should never crash the app
|
|
95
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Re-throw the error
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* API operation
|
|
107
|
+
*
|
|
108
|
+
* @method GET
|
|
109
|
+
* @path /cfg/db/backups/{id}/
|
|
110
|
+
*/
|
|
111
|
+
export async function getDbBackupsRetrieve( id: string, client?: any
|
|
112
|
+
): Promise<BackupRecord> {
|
|
113
|
+
const api = client || getAPIInstance()
|
|
114
|
+
const response = await api.cfg_db.backupsRetrieve(id)
|
|
115
|
+
try {
|
|
116
|
+
return BackupRecordSchema.parse(response)
|
|
117
|
+
} catch (error) {
|
|
118
|
+
// Zod validation error - log detailed information
|
|
119
|
+
consola.error('❌ Zod Validation Failed');
|
|
120
|
+
consola.box({
|
|
121
|
+
title: 'getDbBackupsRetrieve',
|
|
122
|
+
message: `Path: /cfg/db/backups/{id}/\nMethod: GET`,
|
|
123
|
+
style: {
|
|
124
|
+
borderColor: 'red',
|
|
125
|
+
borderStyle: 'rounded'
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
130
|
+
consola.error('Validation Issues:');
|
|
131
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
132
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
133
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
134
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
135
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
consola.error('Response data:', response);
|
|
140
|
+
|
|
141
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
142
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
143
|
+
try {
|
|
144
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
145
|
+
detail: {
|
|
146
|
+
operation: 'getDbBackupsRetrieve',
|
|
147
|
+
path: '/cfg/db/backups/{id}/',
|
|
148
|
+
method: 'GET',
|
|
149
|
+
error: error,
|
|
150
|
+
response: response,
|
|
151
|
+
timestamp: new Date(),
|
|
152
|
+
},
|
|
153
|
+
bubbles: true,
|
|
154
|
+
cancelable: false,
|
|
155
|
+
});
|
|
156
|
+
window.dispatchEvent(event);
|
|
157
|
+
} catch (eventError) {
|
|
158
|
+
// Silently fail - event dispatch should never crash the app
|
|
159
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Re-throw the error
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* API operation
|
|
171
|
+
*
|
|
172
|
+
* @method POST
|
|
173
|
+
* @path /cfg/db/backups/{id}/restore/
|
|
174
|
+
*/
|
|
175
|
+
export async function createDbBackupsRestoreCreate( id: string, client?: any
|
|
176
|
+
): Promise<BackupRecord> {
|
|
177
|
+
const api = client || getAPIInstance()
|
|
178
|
+
const response = await api.cfg_db.backupsRestoreCreate(id)
|
|
179
|
+
try {
|
|
180
|
+
return BackupRecordSchema.parse(response)
|
|
181
|
+
} catch (error) {
|
|
182
|
+
// Zod validation error - log detailed information
|
|
183
|
+
consola.error('❌ Zod Validation Failed');
|
|
184
|
+
consola.box({
|
|
185
|
+
title: 'createDbBackupsRestoreCreate',
|
|
186
|
+
message: `Path: /cfg/db/backups/{id}/restore/\nMethod: POST`,
|
|
187
|
+
style: {
|
|
188
|
+
borderColor: 'red',
|
|
189
|
+
borderStyle: 'rounded'
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
194
|
+
consola.error('Validation Issues:');
|
|
195
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
196
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
197
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
198
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
199
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
consola.error('Response data:', response);
|
|
204
|
+
|
|
205
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
206
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
207
|
+
try {
|
|
208
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
209
|
+
detail: {
|
|
210
|
+
operation: 'createDbBackupsRestoreCreate',
|
|
211
|
+
path: '/cfg/db/backups/{id}/restore/',
|
|
212
|
+
method: 'POST',
|
|
213
|
+
error: error,
|
|
214
|
+
response: response,
|
|
215
|
+
timestamp: new Date(),
|
|
216
|
+
},
|
|
217
|
+
bubbles: true,
|
|
218
|
+
cancelable: false,
|
|
219
|
+
});
|
|
220
|
+
window.dispatchEvent(event);
|
|
221
|
+
} catch (eventError) {
|
|
222
|
+
// Silently fail - event dispatch should never crash the app
|
|
223
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Re-throw the error
|
|
228
|
+
throw error;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* API operation
|
|
235
|
+
*
|
|
236
|
+
* @method POST
|
|
237
|
+
* @path /cfg/db/backups/cleanup/
|
|
238
|
+
*/
|
|
239
|
+
export async function createDbBackupsCleanupCreate( client?: any
|
|
240
|
+
): Promise<BackupRecord> {
|
|
241
|
+
const api = client || getAPIInstance()
|
|
242
|
+
const response = await api.cfg_db.backupsCleanupCreate()
|
|
243
|
+
try {
|
|
244
|
+
return BackupRecordSchema.parse(response)
|
|
245
|
+
} catch (error) {
|
|
246
|
+
// Zod validation error - log detailed information
|
|
247
|
+
consola.error('❌ Zod Validation Failed');
|
|
248
|
+
consola.box({
|
|
249
|
+
title: 'createDbBackupsCleanupCreate',
|
|
250
|
+
message: `Path: /cfg/db/backups/cleanup/\nMethod: POST`,
|
|
251
|
+
style: {
|
|
252
|
+
borderColor: 'red',
|
|
253
|
+
borderStyle: 'rounded'
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
258
|
+
consola.error('Validation Issues:');
|
|
259
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
260
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
261
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
262
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
263
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
consola.error('Response data:', response);
|
|
268
|
+
|
|
269
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
270
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
271
|
+
try {
|
|
272
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
273
|
+
detail: {
|
|
274
|
+
operation: 'createDbBackupsCleanupCreate',
|
|
275
|
+
path: '/cfg/db/backups/cleanup/',
|
|
276
|
+
method: 'POST',
|
|
277
|
+
error: error,
|
|
278
|
+
response: response,
|
|
279
|
+
timestamp: new Date(),
|
|
280
|
+
},
|
|
281
|
+
bubbles: true,
|
|
282
|
+
cancelable: false,
|
|
283
|
+
});
|
|
284
|
+
window.dispatchEvent(event);
|
|
285
|
+
} catch (eventError) {
|
|
286
|
+
// Silently fail - event dispatch should never crash the app
|
|
287
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// Re-throw the error
|
|
292
|
+
throw error;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* API operation
|
|
299
|
+
*
|
|
300
|
+
* @method POST
|
|
301
|
+
* @path /cfg/db/backups/create_backup/
|
|
302
|
+
*/
|
|
303
|
+
export async function createDbBackupsCreateBackupCreate( client?: any
|
|
304
|
+
): Promise<BackupRecord> {
|
|
305
|
+
const api = client || getAPIInstance()
|
|
306
|
+
const response = await api.cfg_db.backupsCreateBackupCreate()
|
|
307
|
+
try {
|
|
308
|
+
return BackupRecordSchema.parse(response)
|
|
309
|
+
} catch (error) {
|
|
310
|
+
// Zod validation error - log detailed information
|
|
311
|
+
consola.error('❌ Zod Validation Failed');
|
|
312
|
+
consola.box({
|
|
313
|
+
title: 'createDbBackupsCreateBackupCreate',
|
|
314
|
+
message: `Path: /cfg/db/backups/create_backup/\nMethod: POST`,
|
|
315
|
+
style: {
|
|
316
|
+
borderColor: 'red',
|
|
317
|
+
borderStyle: 'rounded'
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
322
|
+
consola.error('Validation Issues:');
|
|
323
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
324
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
325
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
326
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
327
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
consola.error('Response data:', response);
|
|
332
|
+
|
|
333
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
334
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
335
|
+
try {
|
|
336
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
337
|
+
detail: {
|
|
338
|
+
operation: 'createDbBackupsCreateBackupCreate',
|
|
339
|
+
path: '/cfg/db/backups/create_backup/',
|
|
340
|
+
method: 'POST',
|
|
341
|
+
error: error,
|
|
342
|
+
response: response,
|
|
343
|
+
timestamp: new Date(),
|
|
344
|
+
},
|
|
345
|
+
bubbles: true,
|
|
346
|
+
cancelable: false,
|
|
347
|
+
});
|
|
348
|
+
window.dispatchEvent(event);
|
|
349
|
+
} catch (eventError) {
|
|
350
|
+
// Silently fail - event dispatch should never crash the app
|
|
351
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Re-throw the error
|
|
356
|
+
throw error;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* API operation
|
|
363
|
+
*
|
|
364
|
+
* @method GET
|
|
365
|
+
* @path /cfg/db/backups/databases/
|
|
366
|
+
*/
|
|
367
|
+
export async function getDbBackupsDatabasesRetrieve( client?: any
|
|
368
|
+
): Promise<BackupRecord> {
|
|
369
|
+
const api = client || getAPIInstance()
|
|
370
|
+
const response = await api.cfg_db.backupsDatabasesRetrieve()
|
|
371
|
+
try {
|
|
372
|
+
return BackupRecordSchema.parse(response)
|
|
373
|
+
} catch (error) {
|
|
374
|
+
// Zod validation error - log detailed information
|
|
375
|
+
consola.error('❌ Zod Validation Failed');
|
|
376
|
+
consola.box({
|
|
377
|
+
title: 'getDbBackupsDatabasesRetrieve',
|
|
378
|
+
message: `Path: /cfg/db/backups/databases/\nMethod: GET`,
|
|
379
|
+
style: {
|
|
380
|
+
borderColor: 'red',
|
|
381
|
+
borderStyle: 'rounded'
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
386
|
+
consola.error('Validation Issues:');
|
|
387
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
388
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
389
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
390
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
391
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
consola.error('Response data:', response);
|
|
396
|
+
|
|
397
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
398
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
399
|
+
try {
|
|
400
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
401
|
+
detail: {
|
|
402
|
+
operation: 'getDbBackupsDatabasesRetrieve',
|
|
403
|
+
path: '/cfg/db/backups/databases/',
|
|
404
|
+
method: 'GET',
|
|
405
|
+
error: error,
|
|
406
|
+
response: response,
|
|
407
|
+
timestamp: new Date(),
|
|
408
|
+
},
|
|
409
|
+
bubbles: true,
|
|
410
|
+
cancelable: false,
|
|
411
|
+
});
|
|
412
|
+
window.dispatchEvent(event);
|
|
413
|
+
} catch (eventError) {
|
|
414
|
+
// Silently fail - event dispatch should never crash the app
|
|
415
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Re-throw the error
|
|
420
|
+
throw error;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
/**
|
|
426
|
+
* API operation
|
|
427
|
+
*
|
|
428
|
+
* @method GET
|
|
429
|
+
* @path /cfg/db/restores/
|
|
430
|
+
*/
|
|
431
|
+
export async function getDbRestoresList( params?: { page?: number; page_size?: number }, client?: any
|
|
432
|
+
): Promise<PaginatedRestoreRecordList> {
|
|
433
|
+
const api = client || getAPIInstance()
|
|
434
|
+
const response = await api.cfg_db.restoresList(params?.page, params?.page_size)
|
|
435
|
+
try {
|
|
436
|
+
return PaginatedRestoreRecordListSchema.parse(response)
|
|
437
|
+
} catch (error) {
|
|
438
|
+
// Zod validation error - log detailed information
|
|
439
|
+
consola.error('❌ Zod Validation Failed');
|
|
440
|
+
consola.box({
|
|
441
|
+
title: 'getDbRestoresList',
|
|
442
|
+
message: `Path: /cfg/db/restores/\nMethod: GET`,
|
|
443
|
+
style: {
|
|
444
|
+
borderColor: 'red',
|
|
445
|
+
borderStyle: 'rounded'
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
450
|
+
consola.error('Validation Issues:');
|
|
451
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
452
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
453
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
454
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
455
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
consola.error('Response data:', response);
|
|
460
|
+
|
|
461
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
462
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
463
|
+
try {
|
|
464
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
465
|
+
detail: {
|
|
466
|
+
operation: 'getDbRestoresList',
|
|
467
|
+
path: '/cfg/db/restores/',
|
|
468
|
+
method: 'GET',
|
|
469
|
+
error: error,
|
|
470
|
+
response: response,
|
|
471
|
+
timestamp: new Date(),
|
|
472
|
+
},
|
|
473
|
+
bubbles: true,
|
|
474
|
+
cancelable: false,
|
|
475
|
+
});
|
|
476
|
+
window.dispatchEvent(event);
|
|
477
|
+
} catch (eventError) {
|
|
478
|
+
// Silently fail - event dispatch should never crash the app
|
|
479
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// Re-throw the error
|
|
484
|
+
throw error;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* API operation
|
|
491
|
+
*
|
|
492
|
+
* @method GET
|
|
493
|
+
* @path /cfg/db/restores/{id}/
|
|
494
|
+
*/
|
|
495
|
+
export async function getDbRestoresRetrieve( id: string, client?: any
|
|
496
|
+
): Promise<RestoreRecord> {
|
|
497
|
+
const api = client || getAPIInstance()
|
|
498
|
+
const response = await api.cfg_db.restoresRetrieve(id)
|
|
499
|
+
try {
|
|
500
|
+
return RestoreRecordSchema.parse(response)
|
|
501
|
+
} catch (error) {
|
|
502
|
+
// Zod validation error - log detailed information
|
|
503
|
+
consola.error('❌ Zod Validation Failed');
|
|
504
|
+
consola.box({
|
|
505
|
+
title: 'getDbRestoresRetrieve',
|
|
506
|
+
message: `Path: /cfg/db/restores/{id}/\nMethod: GET`,
|
|
507
|
+
style: {
|
|
508
|
+
borderColor: 'red',
|
|
509
|
+
borderStyle: 'rounded'
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
if (error instanceof Error && 'issues' in error && Array.isArray((error as any).issues)) {
|
|
514
|
+
consola.error('Validation Issues:');
|
|
515
|
+
(error as any).issues.forEach((issue: any, index: number) => {
|
|
516
|
+
consola.error(` ${index + 1}. ${issue.path.join('.') || 'root'}`);
|
|
517
|
+
consola.error(` ├─ Message: ${issue.message}`);
|
|
518
|
+
if (issue.expected) consola.error(` ├─ Expected: ${issue.expected}`);
|
|
519
|
+
if (issue.received) consola.error(` └─ Received: ${issue.received}`);
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
consola.error('Response data:', response);
|
|
524
|
+
|
|
525
|
+
// Dispatch browser CustomEvent (only if window is defined)
|
|
526
|
+
if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
|
|
527
|
+
try {
|
|
528
|
+
const event = new CustomEvent('zod-validation-error', {
|
|
529
|
+
detail: {
|
|
530
|
+
operation: 'getDbRestoresRetrieve',
|
|
531
|
+
path: '/cfg/db/restores/{id}/',
|
|
532
|
+
method: 'GET',
|
|
533
|
+
error: error,
|
|
534
|
+
response: response,
|
|
535
|
+
timestamp: new Date(),
|
|
536
|
+
},
|
|
537
|
+
bubbles: true,
|
|
538
|
+
cancelable: false,
|
|
539
|
+
});
|
|
540
|
+
window.dispatchEvent(event);
|
|
541
|
+
} catch (eventError) {
|
|
542
|
+
// Silently fail - event dispatch should never crash the app
|
|
543
|
+
consola.warn('Failed to dispatch validation error event:', eventError);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
// Re-throw the error
|
|
548
|
+
throw error;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
|