@djangocfg/api 1.2.32 → 1.2.34

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 (52) hide show
  1. package/dist/index.cjs +3306 -5
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +75 -2
  4. package/dist/index.d.ts +75 -2
  5. package/dist/index.mjs +3303 -5
  6. package/dist/index.mjs.map +1 -1
  7. package/package.json +2 -2
  8. package/src/cfg/generated/_utils/fetchers/cfg__accounts.ts +44 -0
  9. package/src/cfg/generated/_utils/fetchers/cfg__accounts__auth.ts +22 -0
  10. package/src/cfg/generated/_utils/fetchers/cfg__accounts__user_profile.ts +132 -0
  11. package/src/cfg/generated/_utils/fetchers/cfg__centrifugo.ts +22 -0
  12. package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_admin_api.ts +110 -0
  13. package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_auth.ts +22 -0
  14. package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_monitoring.ts +88 -0
  15. package/src/cfg/generated/_utils/fetchers/cfg__centrifugo__centrifugo_testing.ts +66 -0
  16. package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_api_zones.ts +22 -0
  17. package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_charts.ts +44 -0
  18. package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_commands.ts +44 -0
  19. package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_config.ts +22 -0
  20. package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_overview.ts +22 -0
  21. package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_statistics.ts +22 -0
  22. package/src/cfg/generated/_utils/fetchers/cfg__dashboard__dashboard_system.ts +44 -0
  23. package/src/cfg/generated/_utils/fetchers/cfg__endpoints.ts +44 -0
  24. package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_api_keys.ts +66 -0
  25. package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_charts.ts +154 -0
  26. package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_configuration.ts +44 -0
  27. package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_monitoring.ts +88 -0
  28. package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_proto_files.ts +22 -0
  29. package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_services.ts +66 -0
  30. package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_testing.ts +66 -0
  31. package/src/cfg/generated/_utils/fetchers/cfg__health.ts +44 -0
  32. package/src/cfg/generated/_utils/fetchers/cfg__knowbase.ts +1078 -0
  33. package/src/cfg/generated/_utils/fetchers/cfg__leads.ts +110 -0
  34. package/src/cfg/generated/_utils/fetchers/cfg__leads__lead_submission.ts +22 -0
  35. package/src/cfg/generated/_utils/fetchers/cfg__newsletter.ts +66 -0
  36. package/src/cfg/generated/_utils/fetchers/cfg__newsletter__bulk_email.ts +22 -0
  37. package/src/cfg/generated/_utils/fetchers/cfg__newsletter__campaigns.ts +110 -0
  38. package/src/cfg/generated/_utils/fetchers/cfg__newsletter__logs.ts +22 -0
  39. package/src/cfg/generated/_utils/fetchers/cfg__newsletter__newsletters.ts +44 -0
  40. package/src/cfg/generated/_utils/fetchers/cfg__newsletter__subscriptions.ts +66 -0
  41. package/src/cfg/generated/_utils/fetchers/cfg__newsletter__testing.ts +22 -0
  42. package/src/cfg/generated/_utils/fetchers/cfg__payments.ts +132 -0
  43. package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_jobs.ts +110 -0
  44. package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_monitoring.ts +44 -0
  45. package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_queues.ts +22 -0
  46. package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_registries.ts +154 -0
  47. package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_schedules.ts +88 -0
  48. package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_testing.ts +88 -0
  49. package/src/cfg/generated/_utils/fetchers/cfg__rq__rq_workers.ts +22 -0
  50. package/src/cfg/generated/_utils/fetchers/cfg__support.ts +220 -0
  51. package/src/cfg/generated/index.ts +4 -0
  52. package/src/cfg/generated/validation-events.ts +133 -0
@@ -72,6 +72,28 @@ export async function getRqSchedulesList( params?: { page?: number; page_size?:
72
72
 
73
73
  consola.error('Response data:', response);
74
74
 
75
+ // Dispatch browser CustomEvent (only if window is defined)
76
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
77
+ try {
78
+ const event = new CustomEvent('zod-validation-error', {
79
+ detail: {
80
+ operation: 'getRqSchedulesList',
81
+ path: '/cfg/rq/schedules/',
82
+ method: 'GET',
83
+ error: error,
84
+ response: response,
85
+ timestamp: new Date(),
86
+ },
87
+ bubbles: true,
88
+ cancelable: false,
89
+ });
90
+ window.dispatchEvent(event);
91
+ } catch (eventError) {
92
+ // Silently fail - event dispatch should never crash the app
93
+ consola.warn('Failed to dispatch validation error event:', eventError);
94
+ }
95
+ }
96
+
75
97
  // Re-throw the error
76
98
  throw error;
77
99
  }
@@ -114,6 +136,28 @@ export async function createRqSchedulesCreate( data: ScheduleCreateRequest, cl
114
136
 
115
137
  consola.error('Response data:', response);
116
138
 
139
+ // Dispatch browser CustomEvent (only if window is defined)
140
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
141
+ try {
142
+ const event = new CustomEvent('zod-validation-error', {
143
+ detail: {
144
+ operation: 'createRqSchedulesCreate',
145
+ path: '/cfg/rq/schedules/',
146
+ method: 'POST',
147
+ error: error,
148
+ response: response,
149
+ timestamp: new Date(),
150
+ },
151
+ bubbles: true,
152
+ cancelable: false,
153
+ });
154
+ window.dispatchEvent(event);
155
+ } catch (eventError) {
156
+ // Silently fail - event dispatch should never crash the app
157
+ consola.warn('Failed to dispatch validation error event:', eventError);
158
+ }
159
+ }
160
+
117
161
  // Re-throw the error
118
162
  throw error;
119
163
  }
@@ -156,6 +200,28 @@ export async function getRqSchedulesRetrieve( id: string, pk: string, params?:
156
200
 
157
201
  consola.error('Response data:', response);
158
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: 'getRqSchedulesRetrieve',
209
+ path: '/cfg/rq/schedules/{id}/',
210
+ method: 'GET',
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
+
159
225
  // Re-throw the error
160
226
  throw error;
161
227
  }
@@ -198,6 +264,28 @@ export async function deleteRqSchedulesDestroy( id: string, pk: string, params?
198
264
 
199
265
  consola.error('Response data:', response);
200
266
 
267
+ // Dispatch browser CustomEvent (only if window is defined)
268
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
269
+ try {
270
+ const event = new CustomEvent('zod-validation-error', {
271
+ detail: {
272
+ operation: 'deleteRqSchedulesDestroy',
273
+ path: '/cfg/rq/schedules/{id}/',
274
+ method: 'DELETE',
275
+ error: error,
276
+ response: response,
277
+ timestamp: new Date(),
278
+ },
279
+ bubbles: true,
280
+ cancelable: false,
281
+ });
282
+ window.dispatchEvent(event);
283
+ } catch (eventError) {
284
+ // Silently fail - event dispatch should never crash the app
285
+ consola.warn('Failed to dispatch validation error event:', eventError);
286
+ }
287
+ }
288
+
201
289
  // Re-throw the error
202
290
  throw error;
203
291
  }
@@ -85,6 +85,28 @@ export async function deleteRqTestingCleanupDestroy( params?: { delete_demo_job
85
85
 
86
86
  consola.error('Response data:', response);
87
87
 
88
+ // Dispatch browser CustomEvent (only if window is defined)
89
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
90
+ try {
91
+ const event = new CustomEvent('zod-validation-error', {
92
+ detail: {
93
+ operation: 'deleteRqTestingCleanupDestroy',
94
+ path: '/cfg/rq/testing/cleanup/',
95
+ method: 'DELETE',
96
+ error: error,
97
+ response: response,
98
+ timestamp: new Date(),
99
+ },
100
+ bubbles: true,
101
+ cancelable: false,
102
+ });
103
+ window.dispatchEvent(event);
104
+ } catch (eventError) {
105
+ // Silently fail - event dispatch should never crash the app
106
+ consola.warn('Failed to dispatch validation error event:', eventError);
107
+ }
108
+ }
109
+
88
110
  // Re-throw the error
89
111
  throw error;
90
112
  }
@@ -141,6 +163,28 @@ export async function createRqTestingRunDemoCreate( data: RunDemoRequestRequest
141
163
 
142
164
  consola.error('Response data:', response);
143
165
 
166
+ // Dispatch browser CustomEvent (only if window is defined)
167
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
168
+ try {
169
+ const event = new CustomEvent('zod-validation-error', {
170
+ detail: {
171
+ operation: 'createRqTestingRunDemoCreate',
172
+ path: '/cfg/rq/testing/run-demo/',
173
+ method: 'POST',
174
+ error: error,
175
+ response: response,
176
+ timestamp: new Date(),
177
+ },
178
+ bubbles: true,
179
+ cancelable: false,
180
+ });
181
+ window.dispatchEvent(event);
182
+ } catch (eventError) {
183
+ // Silently fail - event dispatch should never crash the app
184
+ consola.warn('Failed to dispatch validation error event:', eventError);
185
+ }
186
+ }
187
+
144
188
  // Re-throw the error
145
189
  throw error;
146
190
  }
@@ -183,6 +227,28 @@ export async function createRqTestingScheduleDemoCreate( data: any, client?: a
183
227
 
184
228
  consola.error('Response data:', response);
185
229
 
230
+ // Dispatch browser CustomEvent (only if window is defined)
231
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
232
+ try {
233
+ const event = new CustomEvent('zod-validation-error', {
234
+ detail: {
235
+ operation: 'createRqTestingScheduleDemoCreate',
236
+ path: '/cfg/rq/testing/schedule-demo/',
237
+ method: 'POST',
238
+ error: error,
239
+ response: response,
240
+ timestamp: new Date(),
241
+ },
242
+ bubbles: true,
243
+ cancelable: false,
244
+ });
245
+ window.dispatchEvent(event);
246
+ } catch (eventError) {
247
+ // Silently fail - event dispatch should never crash the app
248
+ consola.warn('Failed to dispatch validation error event:', eventError);
249
+ }
250
+ }
251
+
186
252
  // Re-throw the error
187
253
  throw error;
188
254
  }
@@ -225,6 +291,28 @@ export async function createRqTestingStressTestCreate( data: StressTestRequestR
225
291
 
226
292
  consola.error('Response data:', response);
227
293
 
294
+ // Dispatch browser CustomEvent (only if window is defined)
295
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
296
+ try {
297
+ const event = new CustomEvent('zod-validation-error', {
298
+ detail: {
299
+ operation: 'createRqTestingStressTestCreate',
300
+ path: '/cfg/rq/testing/stress-test/',
301
+ method: 'POST',
302
+ error: error,
303
+ response: response,
304
+ timestamp: new Date(),
305
+ },
306
+ bubbles: true,
307
+ cancelable: false,
308
+ });
309
+ window.dispatchEvent(event);
310
+ } catch (eventError) {
311
+ // Silently fail - event dispatch should never crash the app
312
+ consola.warn('Failed to dispatch validation error event:', eventError);
313
+ }
314
+ }
315
+
228
316
  // Re-throw the error
229
317
  throw error;
230
318
  }
@@ -83,6 +83,28 @@ export async function getRqWorkersStatsRetrieve( client?: any
83
83
 
84
84
  consola.error('Response data:', response);
85
85
 
86
+ // Dispatch browser CustomEvent (only if window is defined)
87
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
88
+ try {
89
+ const event = new CustomEvent('zod-validation-error', {
90
+ detail: {
91
+ operation: 'getRqWorkersStatsRetrieve',
92
+ path: '/cfg/rq/workers/stats/',
93
+ method: 'GET',
94
+ error: error,
95
+ response: response,
96
+ timestamp: new Date(),
97
+ },
98
+ bubbles: true,
99
+ cancelable: false,
100
+ });
101
+ window.dispatchEvent(event);
102
+ } catch (eventError) {
103
+ // Silently fail - event dispatch should never crash the app
104
+ consola.warn('Failed to dispatch validation error event:', eventError);
105
+ }
106
+ }
107
+
86
108
  // Re-throw the error
87
109
  throw error;
88
110
  }
@@ -78,6 +78,28 @@ export async function getSupportTicketsList( params?: { page?: number; page_siz
78
78
 
79
79
  consola.error('Response data:', response);
80
80
 
81
+ // Dispatch browser CustomEvent (only if window is defined)
82
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
83
+ try {
84
+ const event = new CustomEvent('zod-validation-error', {
85
+ detail: {
86
+ operation: 'getSupportTicketsList',
87
+ path: '/cfg/support/tickets/',
88
+ method: 'GET',
89
+ error: error,
90
+ response: response,
91
+ timestamp: new Date(),
92
+ },
93
+ bubbles: true,
94
+ cancelable: false,
95
+ });
96
+ window.dispatchEvent(event);
97
+ } catch (eventError) {
98
+ // Silently fail - event dispatch should never crash the app
99
+ consola.warn('Failed to dispatch validation error event:', eventError);
100
+ }
101
+ }
102
+
81
103
  // Re-throw the error
82
104
  throw error;
83
105
  }
@@ -120,6 +142,28 @@ export async function createSupportTicketsCreate( data: TicketRequest, client?
120
142
 
121
143
  consola.error('Response data:', response);
122
144
 
145
+ // Dispatch browser CustomEvent (only if window is defined)
146
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
147
+ try {
148
+ const event = new CustomEvent('zod-validation-error', {
149
+ detail: {
150
+ operation: 'createSupportTicketsCreate',
151
+ path: '/cfg/support/tickets/',
152
+ method: 'POST',
153
+ error: error,
154
+ response: response,
155
+ timestamp: new Date(),
156
+ },
157
+ bubbles: true,
158
+ cancelable: false,
159
+ });
160
+ window.dispatchEvent(event);
161
+ } catch (eventError) {
162
+ // Silently fail - event dispatch should never crash the app
163
+ consola.warn('Failed to dispatch validation error event:', eventError);
164
+ }
165
+ }
166
+
123
167
  // Re-throw the error
124
168
  throw error;
125
169
  }
@@ -162,6 +206,28 @@ export async function getSupportTicketsMessagesList( ticket_uuid: string, param
162
206
 
163
207
  consola.error('Response data:', response);
164
208
 
209
+ // Dispatch browser CustomEvent (only if window is defined)
210
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
211
+ try {
212
+ const event = new CustomEvent('zod-validation-error', {
213
+ detail: {
214
+ operation: 'getSupportTicketsMessagesList',
215
+ path: '/cfg/support/tickets/{ticket_uuid}/messages/',
216
+ method: 'GET',
217
+ error: error,
218
+ response: response,
219
+ timestamp: new Date(),
220
+ },
221
+ bubbles: true,
222
+ cancelable: false,
223
+ });
224
+ window.dispatchEvent(event);
225
+ } catch (eventError) {
226
+ // Silently fail - event dispatch should never crash the app
227
+ consola.warn('Failed to dispatch validation error event:', eventError);
228
+ }
229
+ }
230
+
165
231
  // Re-throw the error
166
232
  throw error;
167
233
  }
@@ -204,6 +270,28 @@ export async function createSupportTicketsMessagesCreate( ticket_uuid: string,
204
270
 
205
271
  consola.error('Response data:', response);
206
272
 
273
+ // Dispatch browser CustomEvent (only if window is defined)
274
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
275
+ try {
276
+ const event = new CustomEvent('zod-validation-error', {
277
+ detail: {
278
+ operation: 'createSupportTicketsMessagesCreate',
279
+ path: '/cfg/support/tickets/{ticket_uuid}/messages/',
280
+ method: 'POST',
281
+ error: error,
282
+ response: response,
283
+ timestamp: new Date(),
284
+ },
285
+ bubbles: true,
286
+ cancelable: false,
287
+ });
288
+ window.dispatchEvent(event);
289
+ } catch (eventError) {
290
+ // Silently fail - event dispatch should never crash the app
291
+ consola.warn('Failed to dispatch validation error event:', eventError);
292
+ }
293
+ }
294
+
207
295
  // Re-throw the error
208
296
  throw error;
209
297
  }
@@ -246,6 +334,28 @@ export async function getSupportTicketsMessagesRetrieve( ticket_uuid: string, u
246
334
 
247
335
  consola.error('Response data:', response);
248
336
 
337
+ // Dispatch browser CustomEvent (only if window is defined)
338
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
339
+ try {
340
+ const event = new CustomEvent('zod-validation-error', {
341
+ detail: {
342
+ operation: 'getSupportTicketsMessagesRetrieve',
343
+ path: '/cfg/support/tickets/{ticket_uuid}/messages/{uuid}/',
344
+ method: 'GET',
345
+ error: error,
346
+ response: response,
347
+ timestamp: new Date(),
348
+ },
349
+ bubbles: true,
350
+ cancelable: false,
351
+ });
352
+ window.dispatchEvent(event);
353
+ } catch (eventError) {
354
+ // Silently fail - event dispatch should never crash the app
355
+ consola.warn('Failed to dispatch validation error event:', eventError);
356
+ }
357
+ }
358
+
249
359
  // Re-throw the error
250
360
  throw error;
251
361
  }
@@ -288,6 +398,28 @@ export async function updateSupportTicketsMessagesUpdate( ticket_uuid: string,
288
398
 
289
399
  consola.error('Response data:', response);
290
400
 
401
+ // Dispatch browser CustomEvent (only if window is defined)
402
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
403
+ try {
404
+ const event = new CustomEvent('zod-validation-error', {
405
+ detail: {
406
+ operation: 'updateSupportTicketsMessagesUpdate',
407
+ path: '/cfg/support/tickets/{ticket_uuid}/messages/{uuid}/',
408
+ method: 'PUT',
409
+ error: error,
410
+ response: response,
411
+ timestamp: new Date(),
412
+ },
413
+ bubbles: true,
414
+ cancelable: false,
415
+ });
416
+ window.dispatchEvent(event);
417
+ } catch (eventError) {
418
+ // Silently fail - event dispatch should never crash the app
419
+ consola.warn('Failed to dispatch validation error event:', eventError);
420
+ }
421
+ }
422
+
291
423
  // Re-throw the error
292
424
  throw error;
293
425
  }
@@ -330,6 +462,28 @@ export async function partialUpdateSupportTicketsMessagesPartialUpdate( ticket_
330
462
 
331
463
  consola.error('Response data:', response);
332
464
 
465
+ // Dispatch browser CustomEvent (only if window is defined)
466
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
467
+ try {
468
+ const event = new CustomEvent('zod-validation-error', {
469
+ detail: {
470
+ operation: 'partialUpdateSupportTicketsMessagesPartialUpdate',
471
+ path: '/cfg/support/tickets/{ticket_uuid}/messages/{uuid}/',
472
+ method: 'PATCH',
473
+ error: error,
474
+ response: response,
475
+ timestamp: new Date(),
476
+ },
477
+ bubbles: true,
478
+ cancelable: false,
479
+ });
480
+ window.dispatchEvent(event);
481
+ } catch (eventError) {
482
+ // Silently fail - event dispatch should never crash the app
483
+ consola.warn('Failed to dispatch validation error event:', eventError);
484
+ }
485
+ }
486
+
333
487
  // Re-throw the error
334
488
  throw error;
335
489
  }
@@ -386,6 +540,28 @@ export async function getSupportTicketsRetrieve( uuid: string, client?: any
386
540
 
387
541
  consola.error('Response data:', response);
388
542
 
543
+ // Dispatch browser CustomEvent (only if window is defined)
544
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
545
+ try {
546
+ const event = new CustomEvent('zod-validation-error', {
547
+ detail: {
548
+ operation: 'getSupportTicketsRetrieve',
549
+ path: '/cfg/support/tickets/{uuid}/',
550
+ method: 'GET',
551
+ error: error,
552
+ response: response,
553
+ timestamp: new Date(),
554
+ },
555
+ bubbles: true,
556
+ cancelable: false,
557
+ });
558
+ window.dispatchEvent(event);
559
+ } catch (eventError) {
560
+ // Silently fail - event dispatch should never crash the app
561
+ consola.warn('Failed to dispatch validation error event:', eventError);
562
+ }
563
+ }
564
+
389
565
  // Re-throw the error
390
566
  throw error;
391
567
  }
@@ -428,6 +604,28 @@ export async function updateSupportTicketsUpdate( uuid: string, data: TicketReq
428
604
 
429
605
  consola.error('Response data:', response);
430
606
 
607
+ // Dispatch browser CustomEvent (only if window is defined)
608
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
609
+ try {
610
+ const event = new CustomEvent('zod-validation-error', {
611
+ detail: {
612
+ operation: 'updateSupportTicketsUpdate',
613
+ path: '/cfg/support/tickets/{uuid}/',
614
+ method: 'PUT',
615
+ error: error,
616
+ response: response,
617
+ timestamp: new Date(),
618
+ },
619
+ bubbles: true,
620
+ cancelable: false,
621
+ });
622
+ window.dispatchEvent(event);
623
+ } catch (eventError) {
624
+ // Silently fail - event dispatch should never crash the app
625
+ consola.warn('Failed to dispatch validation error event:', eventError);
626
+ }
627
+ }
628
+
431
629
  // Re-throw the error
432
630
  throw error;
433
631
  }
@@ -470,6 +668,28 @@ export async function partialUpdateSupportTicketsPartialUpdate( uuid: string, d
470
668
 
471
669
  consola.error('Response data:', response);
472
670
 
671
+ // Dispatch browser CustomEvent (only if window is defined)
672
+ if (typeof window !== 'undefined' && error instanceof Error && 'issues' in error) {
673
+ try {
674
+ const event = new CustomEvent('zod-validation-error', {
675
+ detail: {
676
+ operation: 'partialUpdateSupportTicketsPartialUpdate',
677
+ path: '/cfg/support/tickets/{uuid}/',
678
+ method: 'PATCH',
679
+ error: error,
680
+ response: response,
681
+ timestamp: new Date(),
682
+ },
683
+ bubbles: true,
684
+ cancelable: false,
685
+ });
686
+ window.dispatchEvent(event);
687
+ } catch (eventError) {
688
+ // Silently fail - event dispatch should never crash the app
689
+ consola.warn('Failed to dispatch validation error event:', eventError);
690
+ }
691
+ }
692
+
473
693
  // Re-throw the error
474
694
  throw error;
475
695
  }
@@ -135,6 +135,10 @@ export * as Enums from "./enums";
135
135
  // Re-export Zod schemas for runtime validation
136
136
  export * as Schemas from "./_utils/schemas";
137
137
 
138
+ // Re-export Zod validation events for browser integration
139
+ export type { ValidationErrorDetail, ValidationErrorEvent } from "./validation-events";
140
+ export { dispatchValidationError, onValidationError, formatZodError } from "./validation-events";
141
+
138
142
  // Re-export typed fetchers for universal usage
139
143
  export * as Fetchers from "./_utils/fetchers";
140
144
  export * from "./_utils/fetchers";
@@ -0,0 +1,133 @@
1
+ /**
2
+ * Zod Validation Events - Browser CustomEvent integration
3
+ *
4
+ * Dispatches browser CustomEvents when Zod validation fails, allowing
5
+ * React/frontend apps to listen and handle validation errors globally.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // In your React app
10
+ * window.addEventListener('zod-validation-error', (event) => {
11
+ * const { operation, path, method, error, response } = event.detail;
12
+ * console.error(`Validation failed for ${method} ${path}`, error);
13
+ * // Show toast notification, log to Sentry, etc.
14
+ * });
15
+ * ```
16
+ */
17
+
18
+ import type { ZodError } from 'zod'
19
+
20
+ /**
21
+ * Validation error event detail
22
+ */
23
+ export interface ValidationErrorDetail {
24
+ /** Operation/function name that failed validation */
25
+ operation: string
26
+ /** API endpoint path */
27
+ path: string
28
+ /** HTTP method */
29
+ method: string
30
+ /** Zod validation error */
31
+ error: ZodError
32
+ /** Raw response data that failed validation */
33
+ response: any
34
+ /** Timestamp of the error */
35
+ timestamp: Date
36
+ }
37
+
38
+ /**
39
+ * Custom event type for Zod validation errors
40
+ */
41
+ export type ValidationErrorEvent = CustomEvent<ValidationErrorDetail>
42
+
43
+ /**
44
+ * Dispatch a Zod validation error event.
45
+ *
46
+ * Only dispatches in browser environment (when window is defined).
47
+ * Safe to call in Node.js/SSR - will be a no-op.
48
+ *
49
+ * @param detail - Validation error details
50
+ */
51
+ export function dispatchValidationError(detail: ValidationErrorDetail): void {
52
+ // Check if running in browser
53
+ if (typeof window === 'undefined') {
54
+ return
55
+ }
56
+
57
+ try {
58
+ const event = new CustomEvent<ValidationErrorDetail>('zod-validation-error', {
59
+ detail,
60
+ bubbles: true,
61
+ cancelable: false,
62
+ })
63
+
64
+ window.dispatchEvent(event)
65
+ } catch (error) {
66
+ // Silently fail - validation event dispatch should never crash the app
67
+ console.warn('Failed to dispatch validation error event:', error)
68
+ }
69
+ }
70
+
71
+ /**
72
+ * Add a global listener for Zod validation errors.
73
+ *
74
+ * @param callback - Function to call when validation error occurs
75
+ * @returns Cleanup function to remove the listener
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * const cleanup = onValidationError(({ operation, error }) => {
80
+ * toast.error(`Validation failed in ${operation}`);
81
+ * logToSentry(error);
82
+ * });
83
+ *
84
+ * // Later, remove listener
85
+ * cleanup();
86
+ * ```
87
+ */
88
+ export function onValidationError(
89
+ callback: (detail: ValidationErrorDetail) => void
90
+ ): () => void {
91
+ if (typeof window === 'undefined') {
92
+ // Return no-op cleanup function for SSR
93
+ return () => {}
94
+ }
95
+
96
+ const handler = (event: Event) => {
97
+ if (event instanceof CustomEvent) {
98
+ callback(event.detail)
99
+ }
100
+ }
101
+
102
+ window.addEventListener('zod-validation-error', handler)
103
+
104
+ // Return cleanup function
105
+ return () => {
106
+ window.removeEventListener('zod-validation-error', handler)
107
+ }
108
+ }
109
+
110
+ /**
111
+ * Format Zod error for logging/display.
112
+ *
113
+ * @param error - Zod validation error
114
+ * @returns Formatted error message
115
+ */
116
+ export function formatZodError(error: ZodError): string {
117
+ const issues = error.issues.map((issue, index) => {
118
+ const path = issue.path.join('.') || 'root'
119
+ const parts = [`${index + 1}. ${path}: ${issue.message}`]
120
+
121
+ if ('expected' in issue && issue.expected) {
122
+ parts.push(` Expected: ${issue.expected}`)
123
+ }
124
+
125
+ if ('received' in issue && issue.received) {
126
+ parts.push(` Received: ${issue.received}`)
127
+ }
128
+
129
+ return parts.join('\n')
130
+ })
131
+
132
+ return issues.join('\n')
133
+ }