@djangocfg/api 2.1.42 → 2.1.44

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 (102) hide show
  1. package/dist/auth.cjs +42 -44
  2. package/dist/auth.cjs.map +1 -1
  3. package/dist/auth.mjs +50 -45
  4. package/dist/auth.mjs.map +1 -1
  5. package/dist/clients.cjs +1842 -1842
  6. package/dist/clients.cjs.map +1 -1
  7. package/dist/clients.d.cts +1627 -1837
  8. package/dist/clients.d.ts +1627 -1837
  9. package/dist/clients.mjs +1840 -1840
  10. package/dist/clients.mjs.map +1 -1
  11. package/dist/hooks.cjs.map +1 -1
  12. package/dist/hooks.d.cts +0 -66
  13. package/dist/hooks.d.ts +0 -66
  14. package/dist/hooks.mjs.map +1 -1
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +0 -210
  17. package/dist/index.d.ts +0 -210
  18. package/dist/index.mjs.map +1 -1
  19. package/package.json +3 -3
  20. package/src/auth/context/AccountsContext.tsx +15 -15
  21. package/src/auth/context/AuthContext.tsx +6 -5
  22. package/src/auth/hooks/useAuthForm.ts +1 -1
  23. package/src/auth/hooks/useAuthGuard.ts +2 -1
  24. package/src/auth/hooks/useAutoAuth.ts +4 -2
  25. package/src/auth/hooks/useGithubAuth.ts +3 -2
  26. package/src/auth/hooks/useLocalStorage.ts +1 -0
  27. package/src/auth/hooks/useProfileCache.ts +1 -1
  28. package/src/auth/hooks/useSessionStorage.ts +1 -0
  29. package/src/clients.ts +1 -1
  30. package/src/generated/cfg_accounts/CLAUDE.md +92 -0
  31. package/src/generated/cfg_accounts/_utils/fetchers/accounts.ts +1 -8
  32. package/src/generated/cfg_accounts/_utils/fetchers/accounts__auth.ts +1 -8
  33. package/src/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +1 -8
  34. package/src/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts +1 -8
  35. package/src/generated/cfg_accounts/_utils/fetchers/index.ts +1 -8
  36. package/src/generated/cfg_accounts/_utils/hooks/accounts.ts +1 -8
  37. package/src/generated/cfg_accounts/_utils/hooks/accounts__auth.ts +1 -8
  38. package/src/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +1 -8
  39. package/src/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts +1 -8
  40. package/src/generated/cfg_accounts/_utils/hooks/index.ts +1 -8
  41. package/src/generated/cfg_accounts/_utils/schemas/index.ts +1 -8
  42. package/src/generated/cfg_accounts/accounts/index.ts +1 -8
  43. package/src/generated/cfg_accounts/accounts/models.ts +1 -8
  44. package/src/generated/cfg_accounts/accounts__auth/index.ts +1 -8
  45. package/src/generated/cfg_accounts/accounts__auth/models.ts +1 -8
  46. package/src/generated/cfg_accounts/accounts__oauth/index.ts +1 -8
  47. package/src/generated/cfg_accounts/accounts__oauth/models.ts +1 -8
  48. package/src/generated/cfg_accounts/accounts__user_profile/index.ts +1 -8
  49. package/src/generated/cfg_accounts/accounts__user_profile/models.ts +1 -8
  50. package/src/generated/cfg_accounts/api-instance.ts +1 -8
  51. package/src/generated/cfg_accounts/enums.ts +1 -8
  52. package/src/generated/cfg_accounts/errors.ts +1 -8
  53. package/src/generated/cfg_accounts/http.ts +1 -8
  54. package/src/generated/cfg_accounts/index.ts +1 -8
  55. package/src/generated/cfg_accounts/logger.ts +1 -8
  56. package/src/generated/cfg_accounts/retry.ts +1 -8
  57. package/src/generated/cfg_accounts/storage.ts +1 -8
  58. package/src/generated/cfg_accounts/validation-events.ts +1 -8
  59. package/src/generated/cfg_centrifugo/CLAUDE.md +92 -0
  60. package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts +1 -8
  61. package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts +1 -8
  62. package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts +1 -8
  63. package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts +1 -8
  64. package/src/generated/cfg_centrifugo/_utils/fetchers/index.ts +1 -8
  65. package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_admin_api.ts +1 -8
  66. package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts +1 -8
  67. package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts +1 -8
  68. package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_testing.ts +1 -8
  69. package/src/generated/cfg_centrifugo/_utils/hooks/index.ts +1 -8
  70. package/src/generated/cfg_centrifugo/_utils/schemas/index.ts +1 -8
  71. package/src/generated/cfg_centrifugo/api-instance.ts +1 -8
  72. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/index.ts +1 -8
  73. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/models.ts +1 -8
  74. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/index.ts +1 -8
  75. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/models.ts +1 -8
  76. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/index.ts +1 -8
  77. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/models.ts +1 -8
  78. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/index.ts +1 -8
  79. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/models.ts +1 -8
  80. package/src/generated/cfg_centrifugo/errors.ts +1 -8
  81. package/src/generated/cfg_centrifugo/http.ts +1 -8
  82. package/src/generated/cfg_centrifugo/index.ts +1 -8
  83. package/src/generated/cfg_centrifugo/logger.ts +1 -8
  84. package/src/generated/cfg_centrifugo/retry.ts +1 -8
  85. package/src/generated/cfg_centrifugo/storage.ts +1 -8
  86. package/src/generated/cfg_centrifugo/validation-events.ts +1 -8
  87. package/src/generated/cfg_webpush/CLAUDE.md +70 -0
  88. package/src/generated/cfg_webpush/_utils/fetchers/index.ts +1 -8
  89. package/src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts +1 -8
  90. package/src/generated/cfg_webpush/_utils/hooks/index.ts +1 -8
  91. package/src/generated/cfg_webpush/_utils/hooks/webpush__web_push.ts +1 -8
  92. package/src/generated/cfg_webpush/_utils/schemas/index.ts +1 -8
  93. package/src/generated/cfg_webpush/api-instance.ts +1 -8
  94. package/src/generated/cfg_webpush/errors.ts +1 -8
  95. package/src/generated/cfg_webpush/http.ts +1 -8
  96. package/src/generated/cfg_webpush/index.ts +1 -8
  97. package/src/generated/cfg_webpush/logger.ts +1 -8
  98. package/src/generated/cfg_webpush/retry.ts +1 -8
  99. package/src/generated/cfg_webpush/storage.ts +1 -8
  100. package/src/generated/cfg_webpush/validation-events.ts +1 -8
  101. package/src/generated/cfg_webpush/webpush__web_push/index.ts +1 -8
  102. package/src/generated/cfg_webpush/webpush__web_push/models.ts +1 -8
package/dist/clients.mjs CHANGED
@@ -1648,45 +1648,217 @@ var API = class {
1648
1648
  }
1649
1649
  };
1650
1650
 
1651
- // src/generated/cfg_webpush/webpush__web_push/client.ts
1652
- var WebPush = class {
1651
+ // src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/client.ts
1652
+ var CentrifugoAdminApi = class {
1653
1653
  static {
1654
- __name(this, "WebPush");
1654
+ __name(this, "CentrifugoAdminApi");
1655
1655
  }
1656
1656
  constructor(client) {
1657
1657
  this.client = client;
1658
1658
  }
1659
1659
  /**
1660
- * Send push notification
1660
+ * Get connection token for dashboard
1661
1661
  *
1662
- * Send push notification to all active subscriptions for the authenticated
1663
- * user.
1662
+ * Returns JWT token and config for WebSocket connection to Centrifugo.
1664
1663
  */
1665
- async webpushSendCreate(data) {
1666
- const response = await this.client.request("POST", "/cfg/webpush/send/", { body: data });
1664
+ async centrifugoServerAuthTokenCreate() {
1665
+ const response = await this.client.request("POST", "/cfg/centrifugo/server/auth/token/");
1667
1666
  return response;
1668
1667
  }
1669
1668
  /**
1670
- * Subscribe to push notifications
1669
+ * List active channels
1671
1670
  *
1672
- * Save push subscription from browser for the authenticated user.
1671
+ * Returns list of active channels with optional pattern filter.
1673
1672
  */
1674
- async webpushSubscribeCreate(data) {
1675
- const response = await this.client.request("POST", "/cfg/webpush/subscribe/", { body: data });
1673
+ async centrifugoServerChannelsCreate(data) {
1674
+ const response = await this.client.request("POST", "/cfg/centrifugo/server/channels/", { body: data });
1676
1675
  return response;
1677
1676
  }
1678
1677
  /**
1679
- * Get VAPID public key
1678
+ * Get channel history
1680
1679
  *
1681
- * Get VAPID public key for client subscription.
1680
+ * Returns message history for a channel.
1682
1681
  */
1683
- async webpushVapidRetrieve() {
1684
- const response = await this.client.request("GET", "/cfg/webpush/vapid/");
1682
+ async centrifugoServerHistoryCreate(data) {
1683
+ const response = await this.client.request("POST", "/cfg/centrifugo/server/history/", { body: data });
1684
+ return response;
1685
+ }
1686
+ /**
1687
+ * Get Centrifugo server info
1688
+ *
1689
+ * Returns server information including node count, version, and uptime.
1690
+ */
1691
+ async centrifugoServerInfoCreate() {
1692
+ const response = await this.client.request("POST", "/cfg/centrifugo/server/info/");
1693
+ return response;
1694
+ }
1695
+ /**
1696
+ * Get channel presence
1697
+ *
1698
+ * Returns list of clients currently subscribed to a channel.
1699
+ */
1700
+ async centrifugoServerPresenceCreate(data) {
1701
+ const response = await this.client.request("POST", "/cfg/centrifugo/server/presence/", { body: data });
1702
+ return response;
1703
+ }
1704
+ /**
1705
+ * Get channel presence statistics
1706
+ *
1707
+ * Returns quick statistics about channel presence (num_clients,
1708
+ * num_users).
1709
+ */
1710
+ async centrifugoServerPresenceStatsCreate(data) {
1711
+ const response = await this.client.request("POST", "/cfg/centrifugo/server/presence-stats/", { body: data });
1685
1712
  return response;
1686
1713
  }
1687
1714
  };
1688
1715
 
1689
- // src/generated/cfg_webpush/http.ts
1716
+ // src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/client.ts
1717
+ var CentrifugoAuth = class {
1718
+ static {
1719
+ __name(this, "CentrifugoAuth");
1720
+ }
1721
+ constructor(client) {
1722
+ this.client = client;
1723
+ }
1724
+ /**
1725
+ * Get Centrifugo connection token
1726
+ *
1727
+ * Generate JWT token for WebSocket connection to Centrifugo. Token
1728
+ * includes user's allowed channels based on their permissions. Requires
1729
+ * authentication.
1730
+ */
1731
+ async tokenRetrieve() {
1732
+ const response = await this.client.request("GET", "/cfg/centrifugo/auth/token/");
1733
+ return response;
1734
+ }
1735
+ };
1736
+
1737
+ // src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/client.ts
1738
+ var CentrifugoMonitoring = class {
1739
+ static {
1740
+ __name(this, "CentrifugoMonitoring");
1741
+ }
1742
+ constructor(client) {
1743
+ this.client = client;
1744
+ }
1745
+ /**
1746
+ * Get channel statistics
1747
+ *
1748
+ * Returns statistics grouped by channel.
1749
+ */
1750
+ async centrifugoMonitorChannelsRetrieve(...args) {
1751
+ const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
1752
+ let params;
1753
+ if (isParamsObject) {
1754
+ params = args[0];
1755
+ } else {
1756
+ params = { hours: args[0] };
1757
+ }
1758
+ const response = await this.client.request("GET", "/cfg/centrifugo/monitor/channels/", { params });
1759
+ return response.results || response;
1760
+ }
1761
+ /**
1762
+ * Get Centrifugo health status
1763
+ *
1764
+ * Returns the current health status of the Centrifugo client.
1765
+ */
1766
+ async centrifugoMonitorHealthRetrieve() {
1767
+ const response = await this.client.request("GET", "/cfg/centrifugo/monitor/health/");
1768
+ return response;
1769
+ }
1770
+ /**
1771
+ * Get overview statistics
1772
+ *
1773
+ * Returns overview statistics for Centrifugo publishes.
1774
+ */
1775
+ async centrifugoMonitorOverviewRetrieve(...args) {
1776
+ const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
1777
+ let params;
1778
+ if (isParamsObject) {
1779
+ params = args[0];
1780
+ } else {
1781
+ params = { hours: args[0] };
1782
+ }
1783
+ const response = await this.client.request("GET", "/cfg/centrifugo/monitor/overview/", { params });
1784
+ return response;
1785
+ }
1786
+ /**
1787
+ * Get recent publishes
1788
+ *
1789
+ * Returns a paginated list of recent Centrifugo publishes with their
1790
+ * details. Uses standard DRF pagination.
1791
+ */
1792
+ async centrifugoMonitorPublishesList(...args) {
1793
+ const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
1794
+ let params;
1795
+ if (isParamsObject) {
1796
+ params = args[0];
1797
+ } else {
1798
+ params = { channel: args[0], page: args[1], page_size: args[2], status: args[3] };
1799
+ }
1800
+ const response = await this.client.request("GET", "/cfg/centrifugo/monitor/publishes/", { params });
1801
+ return response;
1802
+ }
1803
+ /**
1804
+ * Get publish timeline
1805
+ *
1806
+ * Returns hourly or daily breakdown of publish counts for charts.
1807
+ */
1808
+ async centrifugoMonitorTimelineRetrieve(...args) {
1809
+ const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
1810
+ let params;
1811
+ if (isParamsObject) {
1812
+ params = args[0];
1813
+ } else {
1814
+ params = { hours: args[0], interval: args[1] };
1815
+ }
1816
+ const response = await this.client.request("GET", "/cfg/centrifugo/monitor/timeline/", { params });
1817
+ return response;
1818
+ }
1819
+ };
1820
+
1821
+ // src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/client.ts
1822
+ var CentrifugoTesting = class {
1823
+ static {
1824
+ __name(this, "CentrifugoTesting");
1825
+ }
1826
+ constructor(client) {
1827
+ this.client = client;
1828
+ }
1829
+ /**
1830
+ * Publish test message
1831
+ *
1832
+ * Publish test message to Centrifugo via wrapper with optional ACK
1833
+ * tracking.
1834
+ */
1835
+ async publishTestCreate(data) {
1836
+ const response = await this.client.request("POST", "/cfg/centrifugo/testing/publish-test/", { body: data });
1837
+ return response;
1838
+ }
1839
+ /**
1840
+ * Publish with database logging
1841
+ *
1842
+ * Publish message using CentrifugoClient with database logging. This will
1843
+ * create CentrifugoLog records.
1844
+ */
1845
+ async publishWithLoggingCreate(data) {
1846
+ const response = await this.client.request("POST", "/cfg/centrifugo/testing/publish-with-logging/", { body: data });
1847
+ return response;
1848
+ }
1849
+ /**
1850
+ * Send manual ACK
1851
+ *
1852
+ * Manually send ACK for a message to the wrapper. Pass message_id in
1853
+ * request body.
1854
+ */
1855
+ async sendAckCreate(data) {
1856
+ const response = await this.client.request("POST", "/cfg/centrifugo/testing/send-ack/", { body: data });
1857
+ return response;
1858
+ }
1859
+ };
1860
+
1861
+ // src/generated/cfg_centrifugo/http.ts
1690
1862
  var FetchAdapter2 = class {
1691
1863
  static {
1692
1864
  __name(this, "FetchAdapter");
@@ -1741,7 +1913,7 @@ var FetchAdapter2 = class {
1741
1913
  }
1742
1914
  };
1743
1915
 
1744
- // src/generated/cfg_webpush/errors.ts
1916
+ // src/generated/cfg_centrifugo/errors.ts
1745
1917
  var APIError2 = class extends Error {
1746
1918
  constructor(statusCode, statusText, response, url, message) {
1747
1919
  super(message || `HTTP ${statusCode}: ${statusText}`);
@@ -1830,7 +2002,7 @@ var NetworkError2 = class extends Error {
1830
2002
  }
1831
2003
  };
1832
2004
 
1833
- // src/generated/cfg_webpush/logger.ts
2005
+ // src/generated/cfg_centrifugo/logger.ts
1834
2006
  import { createConsola as createConsola2 } from "consola";
1835
2007
  var DEFAULT_CONFIG2 = {
1836
2008
  enabled: process.env.NODE_ENV !== "production",
@@ -1984,7 +2156,7 @@ var APILogger2 = class {
1984
2156
  };
1985
2157
  var defaultLogger2 = new APILogger2();
1986
2158
 
1987
- // src/generated/cfg_webpush/retry.ts
2159
+ // src/generated/cfg_centrifugo/retry.ts
1988
2160
  import pRetry2, { AbortError as AbortError2 } from "p-retry";
1989
2161
  var DEFAULT_RETRY_CONFIG2 = {
1990
2162
  retries: 3,
@@ -2044,7 +2216,7 @@ async function withRetry2(fn, config) {
2044
2216
  }
2045
2217
  __name(withRetry2, "withRetry");
2046
2218
 
2047
- // src/generated/cfg_webpush/client.ts
2219
+ // src/generated/cfg_centrifugo/client.ts
2048
2220
  var APIClient2 = class {
2049
2221
  constructor(baseUrl, options) {
2050
2222
  this.logger = null;
@@ -2057,7 +2229,10 @@ var APIClient2 = class {
2057
2229
  if (options?.retryConfig !== void 0) {
2058
2230
  this.retryConfig = options.retryConfig;
2059
2231
  }
2060
- this.web_push = new WebPush(this);
2232
+ this.centrifugo_admin_api = new CentrifugoAdminApi(this);
2233
+ this.centrifugo_auth = new CentrifugoAuth(this);
2234
+ this.centrifugo_monitoring = new CentrifugoMonitoring(this);
2235
+ this.centrifugo_testing = new CentrifugoTesting(this);
2061
2236
  }
2062
2237
  static {
2063
2238
  __name(this, "APIClient");
@@ -2239,7 +2414,7 @@ var APIClient2 = class {
2239
2414
  }
2240
2415
  };
2241
2416
 
2242
- // src/generated/cfg_webpush/storage.ts
2417
+ // src/generated/cfg_centrifugo/storage.ts
2243
2418
  var LocalStorageAdapter2 = class {
2244
2419
  static {
2245
2420
  __name(this, "LocalStorageAdapter");
@@ -2286,65 +2461,387 @@ var LocalStorageAdapter2 = class {
2286
2461
  }
2287
2462
  };
2288
2463
 
2289
- // src/generated/cfg_webpush/_utils/schemas/index.ts
2464
+ // src/generated/cfg_centrifugo/_utils/schemas/index.ts
2290
2465
  var schemas_exports2 = {};
2291
2466
  __export(schemas_exports2, {
2292
- SendPushRequestRequestSchema: () => SendPushRequestRequestSchema,
2293
- SendPushResponseSchema: () => SendPushResponseSchema,
2294
- SubscribeRequestRequestSchema: () => SubscribeRequestRequestSchema,
2295
- SubscribeResponseSchema: () => SubscribeResponseSchema,
2296
- VapidPublicKeyResponseSchema: () => VapidPublicKeyResponseSchema
2297
- });
2298
-
2299
- // src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts
2300
- import { z as z20 } from "zod";
2301
- var SendPushRequestRequestSchema = z20.object({
2302
- title: z20.string().min(1).max(255),
2303
- body: z20.string().min(1),
2304
- icon: z20.url().nullable().optional(),
2305
- url: z20.url().nullable().optional()
2306
- });
2307
-
2308
- // src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts
2309
- import { z as z21 } from "zod";
2310
- var SendPushResponseSchema = z21.object({
2311
- success: z21.boolean(),
2312
- sent_to: z21.int()
2313
- });
2314
-
2315
- // src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts
2316
- import { z as z22 } from "zod";
2317
- var SubscribeRequestRequestSchema = z22.object({
2318
- endpoint: z22.url(),
2319
- keys: z22.record(z22.string(), z22.string().min(1))
2320
- });
2321
-
2322
- // src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts
2323
- import { z as z23 } from "zod";
2324
- var SubscribeResponseSchema = z23.object({
2325
- success: z23.boolean(),
2326
- subscription_id: z23.int(),
2327
- created: z23.boolean()
2328
- });
2329
-
2330
- // src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts
2331
- import { z as z24 } from "zod";
2332
- var VapidPublicKeyResponseSchema = z24.object({
2333
- publicKey: z24.string()
2334
- });
2335
-
2336
- // src/generated/cfg_webpush/_utils/fetchers/index.ts
2337
- var fetchers_exports2 = {};
2338
- __export(fetchers_exports2, {
2339
- createWebpushSendCreate: () => createWebpushSendCreate,
2340
- createWebpushSubscribeCreate: () => createWebpushSubscribeCreate,
2341
- getWebpushVapidRetrieve: () => getWebpushVapidRetrieve
2467
+ CentrifugoChannelInfoSchema: () => CentrifugoChannelInfoSchema,
2468
+ CentrifugoChannelsRequestRequestSchema: () => CentrifugoChannelsRequestRequestSchema,
2469
+ CentrifugoChannelsResponseSchema: () => CentrifugoChannelsResponseSchema,
2470
+ CentrifugoChannelsResultSchema: () => CentrifugoChannelsResultSchema,
2471
+ CentrifugoClientInfoSchema: () => CentrifugoClientInfoSchema,
2472
+ CentrifugoErrorSchema: () => CentrifugoErrorSchema,
2473
+ CentrifugoHealthCheckSchema: () => CentrifugoHealthCheckSchema,
2474
+ CentrifugoHistoryRequestRequestSchema: () => CentrifugoHistoryRequestRequestSchema,
2475
+ CentrifugoHistoryResponseSchema: () => CentrifugoHistoryResponseSchema,
2476
+ CentrifugoHistoryResultSchema: () => CentrifugoHistoryResultSchema,
2477
+ CentrifugoInfoResponseSchema: () => CentrifugoInfoResponseSchema,
2478
+ CentrifugoInfoResultSchema: () => CentrifugoInfoResultSchema,
2479
+ CentrifugoMetricsSchema: () => CentrifugoMetricsSchema,
2480
+ CentrifugoNodeInfoSchema: () => CentrifugoNodeInfoSchema,
2481
+ CentrifugoOverviewStatsSchema: () => CentrifugoOverviewStatsSchema,
2482
+ CentrifugoPresenceRequestRequestSchema: () => CentrifugoPresenceRequestRequestSchema,
2483
+ CentrifugoPresenceResponseSchema: () => CentrifugoPresenceResponseSchema,
2484
+ CentrifugoPresenceResultSchema: () => CentrifugoPresenceResultSchema,
2485
+ CentrifugoPresenceStatsRequestRequestSchema: () => CentrifugoPresenceStatsRequestRequestSchema,
2486
+ CentrifugoPresenceStatsResponseSchema: () => CentrifugoPresenceStatsResponseSchema,
2487
+ CentrifugoPresenceStatsResultSchema: () => CentrifugoPresenceStatsResultSchema,
2488
+ CentrifugoProcessSchema: () => CentrifugoProcessSchema,
2489
+ CentrifugoPublicationSchema: () => CentrifugoPublicationSchema,
2490
+ CentrifugoStreamPositionSchema: () => CentrifugoStreamPositionSchema,
2491
+ ChannelListSchema: () => ChannelListSchema,
2492
+ ChannelStatsSchema: () => ChannelStatsSchema,
2493
+ ConnectionTokenResponseSchema: () => ConnectionTokenResponseSchema,
2494
+ ManualAckRequestRequestSchema: () => ManualAckRequestRequestSchema,
2495
+ ManualAckResponseSchema: () => ManualAckResponseSchema,
2496
+ PaginatedPublishListSchema: () => PaginatedPublishListSchema,
2497
+ PublishSchema: () => PublishSchema,
2498
+ PublishTestRequestRequestSchema: () => PublishTestRequestRequestSchema,
2499
+ PublishTestResponseSchema: () => PublishTestResponseSchema,
2500
+ TimelineItemSchema: () => TimelineItemSchema,
2501
+ TimelineResponseSchema: () => TimelineResponseSchema
2342
2502
  });
2343
2503
 
2344
- // src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
2504
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelInfo.schema.ts
2505
+ import { z as z20 } from "zod";
2506
+ var CentrifugoChannelInfoSchema = z20.object({
2507
+ num_clients: z20.int()
2508
+ });
2509
+
2510
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts
2511
+ import { z as z21 } from "zod";
2512
+ var CentrifugoChannelsRequestRequestSchema = z21.object({
2513
+ pattern: z21.string().nullable().optional()
2514
+ });
2515
+
2516
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResponse.schema.ts
2517
+ import { z as z24 } from "zod";
2518
+
2519
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResult.schema.ts
2520
+ import { z as z22 } from "zod";
2521
+ var CentrifugoChannelsResultSchema = z22.object({
2522
+ channels: z22.record(z22.string(), CentrifugoChannelInfoSchema)
2523
+ });
2524
+
2525
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoError.schema.ts
2526
+ import { z as z23 } from "zod";
2527
+ var CentrifugoErrorSchema = z23.object({
2528
+ code: z23.int().optional(),
2529
+ message: z23.string().optional()
2530
+ });
2531
+
2532
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResponse.schema.ts
2533
+ var CentrifugoChannelsResponseSchema = z24.object({
2534
+ error: CentrifugoErrorSchema.optional(),
2535
+ result: CentrifugoChannelsResultSchema.optional()
2536
+ });
2537
+
2538
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoClientInfo.schema.ts
2539
+ import { z as z25 } from "zod";
2540
+ var CentrifugoClientInfoSchema = z25.object({
2541
+ user: z25.string(),
2542
+ client: z25.string(),
2543
+ conn_info: z25.record(z25.string(), z25.any()).nullable().optional(),
2544
+ chan_info: z25.record(z25.string(), z25.any()).nullable().optional()
2545
+ });
2546
+
2547
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHealthCheck.schema.ts
2548
+ import { z as z26 } from "zod";
2549
+ var CentrifugoHealthCheckSchema = z26.object({
2550
+ status: z26.string(),
2551
+ wrapper_url: z26.string(),
2552
+ has_api_key: z26.boolean(),
2553
+ timestamp: z26.string()
2554
+ });
2555
+
2556
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts
2557
+ import { z as z28 } from "zod";
2558
+
2559
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoStreamPosition.schema.ts
2560
+ import { z as z27 } from "zod";
2561
+ var CentrifugoStreamPositionSchema = z27.object({
2562
+ offset: z27.int(),
2563
+ epoch: z27.string()
2564
+ });
2565
+
2566
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts
2567
+ var CentrifugoHistoryRequestRequestSchema = z28.object({
2568
+ channel: z28.string(),
2569
+ limit: z28.int().nullable().optional(),
2570
+ since: CentrifugoStreamPositionSchema.optional(),
2571
+ reverse: z28.boolean().nullable().optional()
2572
+ });
2573
+
2574
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResponse.schema.ts
2575
+ import { z as z31 } from "zod";
2576
+
2577
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResult.schema.ts
2578
+ import { z as z30 } from "zod";
2579
+
2580
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPublication.schema.ts
2581
+ import { z as z29 } from "zod";
2582
+ var CentrifugoPublicationSchema = z29.object({
2583
+ data: z29.record(z29.string(), z29.any()),
2584
+ info: CentrifugoClientInfoSchema.optional(),
2585
+ offset: z29.int(),
2586
+ tags: z29.record(z29.string(), z29.any()).nullable().optional()
2587
+ });
2588
+
2589
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResult.schema.ts
2590
+ var CentrifugoHistoryResultSchema = z30.object({
2591
+ publications: z30.array(CentrifugoPublicationSchema),
2592
+ epoch: z30.string(),
2593
+ offset: z30.int()
2594
+ });
2595
+
2596
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResponse.schema.ts
2597
+ var CentrifugoHistoryResponseSchema = z31.object({
2598
+ error: CentrifugoErrorSchema.optional(),
2599
+ result: CentrifugoHistoryResultSchema.optional()
2600
+ });
2601
+
2602
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResponse.schema.ts
2603
+ import { z as z36 } from "zod";
2604
+
2605
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResult.schema.ts
2606
+ import { z as z35 } from "zod";
2607
+
2608
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoNodeInfo.schema.ts
2609
+ import { z as z34 } from "zod";
2610
+
2611
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoMetrics.schema.ts
2612
+ import { z as z32 } from "zod";
2613
+ var CentrifugoMetricsSchema = z32.object({
2614
+ interval: z32.number(),
2615
+ items: z32.record(z32.string(), z32.number())
2616
+ });
2617
+
2618
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoProcess.schema.ts
2619
+ import { z as z33 } from "zod";
2620
+ var CentrifugoProcessSchema = z33.object({
2621
+ cpu: z33.number(),
2622
+ rss: z33.int()
2623
+ });
2624
+
2625
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoNodeInfo.schema.ts
2626
+ var CentrifugoNodeInfoSchema = z34.object({
2627
+ uid: z34.string(),
2628
+ name: z34.string(),
2629
+ version: z34.string(),
2630
+ num_clients: z34.int(),
2631
+ num_users: z34.int(),
2632
+ num_channels: z34.int(),
2633
+ uptime: z34.int(),
2634
+ num_subs: z34.int(),
2635
+ metrics: CentrifugoMetricsSchema.optional(),
2636
+ process: CentrifugoProcessSchema.optional()
2637
+ });
2638
+
2639
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResult.schema.ts
2640
+ var CentrifugoInfoResultSchema = z35.object({
2641
+ nodes: z35.array(CentrifugoNodeInfoSchema)
2642
+ });
2643
+
2644
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResponse.schema.ts
2645
+ var CentrifugoInfoResponseSchema = z36.object({
2646
+ error: CentrifugoErrorSchema.optional(),
2647
+ result: CentrifugoInfoResultSchema.optional()
2648
+ });
2649
+
2650
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoOverviewStats.schema.ts
2651
+ import { z as z37 } from "zod";
2652
+ var CentrifugoOverviewStatsSchema = z37.object({
2653
+ total: z37.int(),
2654
+ successful: z37.int(),
2655
+ failed: z37.int(),
2656
+ timeout: z37.int(),
2657
+ success_rate: z37.number(),
2658
+ avg_duration_ms: z37.number(),
2659
+ avg_acks_received: z37.number(),
2660
+ period_hours: z37.int()
2661
+ });
2662
+
2663
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceRequestRequest.schema.ts
2664
+ import { z as z38 } from "zod";
2665
+ var CentrifugoPresenceRequestRequestSchema = z38.object({
2666
+ channel: z38.string()
2667
+ });
2668
+
2669
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResponse.schema.ts
2670
+ import { z as z40 } from "zod";
2671
+
2672
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResult.schema.ts
2673
+ import { z as z39 } from "zod";
2674
+ var CentrifugoPresenceResultSchema = z39.object({
2675
+ presence: z39.record(z39.string(), CentrifugoClientInfoSchema)
2676
+ });
2677
+
2678
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResponse.schema.ts
2679
+ var CentrifugoPresenceResponseSchema = z40.object({
2680
+ error: CentrifugoErrorSchema.optional(),
2681
+ result: CentrifugoPresenceResultSchema.optional()
2682
+ });
2683
+
2684
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsRequestRequest.schema.ts
2685
+ import { z as z41 } from "zod";
2686
+ var CentrifugoPresenceStatsRequestRequestSchema = z41.object({
2687
+ channel: z41.string()
2688
+ });
2689
+
2690
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts
2691
+ import { z as z43 } from "zod";
2692
+
2693
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResult.schema.ts
2694
+ import { z as z42 } from "zod";
2695
+ var CentrifugoPresenceStatsResultSchema = z42.object({
2696
+ num_clients: z42.int(),
2697
+ num_users: z42.int()
2698
+ });
2699
+
2700
+ // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts
2701
+ var CentrifugoPresenceStatsResponseSchema = z43.object({
2702
+ error: CentrifugoErrorSchema.optional(),
2703
+ result: CentrifugoPresenceStatsResultSchema.optional()
2704
+ });
2705
+
2706
+ // src/generated/cfg_centrifugo/_utils/schemas/ChannelList.schema.ts
2707
+ import { z as z45 } from "zod";
2708
+
2709
+ // src/generated/cfg_centrifugo/_utils/schemas/ChannelStats.schema.ts
2710
+ import { z as z44 } from "zod";
2711
+ var ChannelStatsSchema = z44.object({
2712
+ channel: z44.string(),
2713
+ total: z44.int(),
2714
+ successful: z44.int(),
2715
+ failed: z44.int(),
2716
+ avg_duration_ms: z44.number(),
2717
+ avg_acks: z44.number(),
2718
+ last_activity_at: z44.string().nullable()
2719
+ });
2720
+
2721
+ // src/generated/cfg_centrifugo/_utils/schemas/ChannelList.schema.ts
2722
+ var ChannelListSchema = z45.object({
2723
+ channels: z45.array(ChannelStatsSchema),
2724
+ total_channels: z45.int()
2725
+ });
2726
+
2727
+ // src/generated/cfg_centrifugo/_utils/schemas/ConnectionTokenResponse.schema.ts
2728
+ import { z as z46 } from "zod";
2729
+ var ConnectionTokenResponseSchema = z46.object({
2730
+ token: z46.string(),
2731
+ centrifugo_url: z46.string(),
2732
+ expires_at: z46.string(),
2733
+ channels: z46.array(z46.string())
2734
+ });
2735
+
2736
+ // src/generated/cfg_centrifugo/_utils/schemas/ManualAckRequestRequest.schema.ts
2737
+ import { z as z47 } from "zod";
2738
+ var ManualAckRequestRequestSchema = z47.object({
2739
+ message_id: z47.string(),
2740
+ client_id: z47.string()
2741
+ });
2742
+
2743
+ // src/generated/cfg_centrifugo/_utils/schemas/ManualAckResponse.schema.ts
2744
+ import { z as z48 } from "zod";
2745
+ var ManualAckResponseSchema = z48.object({
2746
+ success: z48.boolean(),
2747
+ message_id: z48.string(),
2748
+ error: z48.string().nullable().optional()
2749
+ });
2750
+
2751
+ // src/generated/cfg_centrifugo/_utils/schemas/PaginatedPublishList.schema.ts
2752
+ import { z as z50 } from "zod";
2753
+
2754
+ // src/generated/cfg_centrifugo/_utils/schemas/Publish.schema.ts
2755
+ import { z as z49 } from "zod";
2756
+ var PublishSchema = z49.object({
2757
+ message_id: z49.string(),
2758
+ channel: z49.string(),
2759
+ status: z49.string(),
2760
+ wait_for_ack: z49.boolean(),
2761
+ acks_received: z49.int(),
2762
+ acks_expected: z49.int().nullable(),
2763
+ duration_ms: z49.number().nullable(),
2764
+ created_at: z49.iso.datetime(),
2765
+ completed_at: z49.iso.datetime().nullable(),
2766
+ error_code: z49.string().nullable(),
2767
+ error_message: z49.string().nullable()
2768
+ });
2769
+
2770
+ // src/generated/cfg_centrifugo/_utils/schemas/PaginatedPublishList.schema.ts
2771
+ var PaginatedPublishListSchema = z50.object({
2772
+ count: z50.int(),
2773
+ page: z50.int(),
2774
+ pages: z50.int(),
2775
+ page_size: z50.int(),
2776
+ has_next: z50.boolean(),
2777
+ has_previous: z50.boolean(),
2778
+ next_page: z50.int().nullable().optional(),
2779
+ previous_page: z50.int().nullable().optional(),
2780
+ results: z50.array(PublishSchema)
2781
+ });
2782
+
2783
+ // src/generated/cfg_centrifugo/_utils/schemas/PublishTestRequestRequest.schema.ts
2784
+ import { z as z51 } from "zod";
2785
+ var PublishTestRequestRequestSchema = z51.object({
2786
+ channel: z51.string(),
2787
+ data: z51.record(z51.string(), z51.any()),
2788
+ wait_for_ack: z51.boolean().optional(),
2789
+ ack_timeout: z51.int().min(1).max(60).optional()
2790
+ });
2791
+
2792
+ // src/generated/cfg_centrifugo/_utils/schemas/PublishTestResponse.schema.ts
2793
+ import { z as z52 } from "zod";
2794
+ var PublishTestResponseSchema = z52.object({
2795
+ success: z52.boolean(),
2796
+ message_id: z52.string(),
2797
+ channel: z52.string(),
2798
+ acks_received: z52.int().optional(),
2799
+ delivered: z52.boolean().optional(),
2800
+ error: z52.string().nullable().optional()
2801
+ });
2802
+
2803
+ // src/generated/cfg_centrifugo/_utils/schemas/TimelineItem.schema.ts
2804
+ import { z as z53 } from "zod";
2805
+ var TimelineItemSchema = z53.object({
2806
+ timestamp: z53.string(),
2807
+ count: z53.int(),
2808
+ successful: z53.int(),
2809
+ failed: z53.int(),
2810
+ timeout: z53.int()
2811
+ });
2812
+
2813
+ // src/generated/cfg_centrifugo/_utils/schemas/TimelineResponse.schema.ts
2814
+ import { z as z54 } from "zod";
2815
+ var TimelineResponseSchema = z54.object({
2816
+ timeline: z54.array(TimelineItemSchema),
2817
+ period_hours: z54.int(),
2818
+ interval: z54.string()
2819
+ });
2820
+
2821
+ // src/generated/cfg_centrifugo/_utils/fetchers/index.ts
2822
+ var fetchers_exports2 = {};
2823
+ __export(fetchers_exports2, {
2824
+ createCentrifugoServerAuthTokenCreate: () => createCentrifugoServerAuthTokenCreate,
2825
+ createCentrifugoServerChannelsCreate: () => createCentrifugoServerChannelsCreate,
2826
+ createCentrifugoServerHistoryCreate: () => createCentrifugoServerHistoryCreate,
2827
+ createCentrifugoServerInfoCreate: () => createCentrifugoServerInfoCreate,
2828
+ createCentrifugoServerPresenceCreate: () => createCentrifugoServerPresenceCreate,
2829
+ createCentrifugoServerPresenceStatsCreate: () => createCentrifugoServerPresenceStatsCreate,
2830
+ createCentrifugoTestingPublishTestCreate: () => createCentrifugoTestingPublishTestCreate,
2831
+ createCentrifugoTestingPublishWithLoggingCreate: () => createCentrifugoTestingPublishWithLoggingCreate,
2832
+ createCentrifugoTestingSendAckCreate: () => createCentrifugoTestingSendAckCreate,
2833
+ getCentrifugoAuthTokenRetrieve: () => getCentrifugoAuthTokenRetrieve,
2834
+ getCentrifugoMonitorChannelsRetrieve: () => getCentrifugoMonitorChannelsRetrieve,
2835
+ getCentrifugoMonitorHealthRetrieve: () => getCentrifugoMonitorHealthRetrieve,
2836
+ getCentrifugoMonitorOverviewRetrieve: () => getCentrifugoMonitorOverviewRetrieve,
2837
+ getCentrifugoMonitorPublishesList: () => getCentrifugoMonitorPublishesList,
2838
+ getCentrifugoMonitorTimelineRetrieve: () => getCentrifugoMonitorTimelineRetrieve
2839
+ });
2840
+
2841
+ // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts
2345
2842
  import { consola as consola5 } from "consola";
2346
2843
 
2347
- // src/generated/cfg_webpush/api-instance.ts
2844
+ // src/generated/cfg_centrifugo/api-instance.ts
2348
2845
  var globalAPI2 = null;
2349
2846
  function getAPIInstance2() {
2350
2847
  if (!globalAPI2) {
@@ -2356,16 +2853,22 @@ function getAPIInstance2() {
2356
2853
  }
2357
2854
  __name(getAPIInstance2, "getAPIInstance");
2358
2855
 
2359
- // src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
2360
- async function createWebpushSendCreate(data, client) {
2856
+ // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts
2857
+ async function createCentrifugoServerAuthTokenCreate(client) {
2361
2858
  const api = client || getAPIInstance2();
2362
- const response = await api.web_push.webpushSendCreate(data);
2859
+ const response = await api.centrifugo_admin_api.centrifugoServerAuthTokenCreate();
2860
+ return response;
2861
+ }
2862
+ __name(createCentrifugoServerAuthTokenCreate, "createCentrifugoServerAuthTokenCreate");
2863
+ async function createCentrifugoServerChannelsCreate(data, client) {
2864
+ const api = client || getAPIInstance2();
2865
+ const response = await api.centrifugo_admin_api.centrifugoServerChannelsCreate(data);
2363
2866
  try {
2364
- return SendPushResponseSchema.parse(response);
2867
+ return CentrifugoChannelsResponseSchema.parse(response);
2365
2868
  } catch (error) {
2366
2869
  consola5.error("\u274C Zod Validation Failed");
2367
- consola5.box(`createWebpushSendCreate
2368
- Path: /cfg/webpush/send/
2870
+ consola5.box(`createCentrifugoServerChannelsCreate
2871
+ Path: /cfg/centrifugo/server/channels/
2369
2872
  Method: POST`);
2370
2873
  if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2371
2874
  consola5.error("Validation Issues:");
@@ -2381,9 +2884,9 @@ Method: POST`);
2381
2884
  try {
2382
2885
  const event = new CustomEvent("zod-validation-error", {
2383
2886
  detail: {
2384
- operation: "createWebpushSendCreate",
2385
- path: "/cfg/webpush/send/",
2386
- method: "POST",
2887
+ operation: "createCentrifugoServerChannelsCreate",
2888
+ path: "/cfg/centrifugo/server/channels/",
2889
+ method: "POST",
2387
2890
  error,
2388
2891
  response,
2389
2892
  timestamp: /* @__PURE__ */ new Date()
@@ -2399,16 +2902,16 @@ Method: POST`);
2399
2902
  throw error;
2400
2903
  }
2401
2904
  }
2402
- __name(createWebpushSendCreate, "createWebpushSendCreate");
2403
- async function createWebpushSubscribeCreate(data, client) {
2905
+ __name(createCentrifugoServerChannelsCreate, "createCentrifugoServerChannelsCreate");
2906
+ async function createCentrifugoServerHistoryCreate(data, client) {
2404
2907
  const api = client || getAPIInstance2();
2405
- const response = await api.web_push.webpushSubscribeCreate(data);
2908
+ const response = await api.centrifugo_admin_api.centrifugoServerHistoryCreate(data);
2406
2909
  try {
2407
- return SubscribeResponseSchema.parse(response);
2910
+ return CentrifugoHistoryResponseSchema.parse(response);
2408
2911
  } catch (error) {
2409
2912
  consola5.error("\u274C Zod Validation Failed");
2410
- consola5.box(`createWebpushSubscribeCreate
2411
- Path: /cfg/webpush/subscribe/
2913
+ consola5.box(`createCentrifugoServerHistoryCreate
2914
+ Path: /cfg/centrifugo/server/history/
2412
2915
  Method: POST`);
2413
2916
  if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2414
2917
  consola5.error("Validation Issues:");
@@ -2424,8 +2927,8 @@ Method: POST`);
2424
2927
  try {
2425
2928
  const event = new CustomEvent("zod-validation-error", {
2426
2929
  detail: {
2427
- operation: "createWebpushSubscribeCreate",
2428
- path: "/cfg/webpush/subscribe/",
2930
+ operation: "createCentrifugoServerHistoryCreate",
2931
+ path: "/cfg/centrifugo/server/history/",
2429
2932
  method: "POST",
2430
2933
  error,
2431
2934
  response,
@@ -2442,17 +2945,17 @@ Method: POST`);
2442
2945
  throw error;
2443
2946
  }
2444
2947
  }
2445
- __name(createWebpushSubscribeCreate, "createWebpushSubscribeCreate");
2446
- async function getWebpushVapidRetrieve(client) {
2948
+ __name(createCentrifugoServerHistoryCreate, "createCentrifugoServerHistoryCreate");
2949
+ async function createCentrifugoServerInfoCreate(client) {
2447
2950
  const api = client || getAPIInstance2();
2448
- const response = await api.web_push.webpushVapidRetrieve();
2951
+ const response = await api.centrifugo_admin_api.centrifugoServerInfoCreate();
2449
2952
  try {
2450
- return VapidPublicKeyResponseSchema.parse(response);
2953
+ return CentrifugoInfoResponseSchema.parse(response);
2451
2954
  } catch (error) {
2452
2955
  consola5.error("\u274C Zod Validation Failed");
2453
- consola5.box(`getWebpushVapidRetrieve
2454
- Path: /cfg/webpush/vapid/
2455
- Method: GET`);
2956
+ consola5.box(`createCentrifugoServerInfoCreate
2957
+ Path: /cfg/centrifugo/server/info/
2958
+ Method: POST`);
2456
2959
  if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
2457
2960
  consola5.error("Validation Issues:");
2458
2961
  error.issues.forEach((issue, index) => {
@@ -2467,9 +2970,9 @@ Method: GET`);
2467
2970
  try {
2468
2971
  const event = new CustomEvent("zod-validation-error", {
2469
2972
  detail: {
2470
- operation: "getWebpushVapidRetrieve",
2471
- path: "/cfg/webpush/vapid/",
2472
- method: "GET",
2973
+ operation: "createCentrifugoServerInfoCreate",
2974
+ path: "/cfg/centrifugo/server/info/",
2975
+ method: "POST",
2473
2976
  error,
2474
2977
  response,
2475
2978
  timestamp: /* @__PURE__ */ new Date()
@@ -2485,1832 +2988,1335 @@ Method: GET`);
2485
2988
  throw error;
2486
2989
  }
2487
2990
  }
2488
- __name(getWebpushVapidRetrieve, "getWebpushVapidRetrieve");
2489
-
2490
- // src/generated/cfg_webpush/index.ts
2491
- var TOKEN_KEY2 = "auth_token";
2492
- var REFRESH_TOKEN_KEY2 = "refresh_token";
2493
- var API2 = class {
2494
- constructor(baseUrl, options) {
2495
- this._token = null;
2496
- this._refreshToken = null;
2497
- this.baseUrl = baseUrl;
2498
- this.options = options;
2499
- const logger = options?.loggerConfig ? new APILogger2(options.loggerConfig) : void 0;
2500
- this.storage = options?.storage || new LocalStorageAdapter2(logger);
2501
- this._loadTokensFromStorage();
2502
- this._client = new APIClient2(this.baseUrl, {
2503
- retryConfig: this.options?.retryConfig,
2504
- loggerConfig: this.options?.loggerConfig
2505
- });
2506
- this._injectAuthHeader();
2507
- this.web_push = this._client.web_push;
2508
- }
2509
- static {
2510
- __name(this, "API");
2511
- }
2512
- _loadTokensFromStorage() {
2513
- this._token = this.storage.getItem(TOKEN_KEY2);
2514
- this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY2);
2515
- }
2516
- _reinitClients() {
2517
- this._client = new APIClient2(this.baseUrl, {
2518
- retryConfig: this.options?.retryConfig,
2519
- loggerConfig: this.options?.loggerConfig
2520
- });
2521
- this._injectAuthHeader();
2522
- this.web_push = this._client.web_push;
2523
- }
2524
- _injectAuthHeader() {
2525
- const originalRequest = this._client.request.bind(this._client);
2526
- this._client.request = async (method, path, options) => {
2527
- const token = this.getToken();
2528
- const mergedOptions = {
2529
- ...options,
2530
- headers: {
2531
- ...options?.headers || {},
2532
- ...token ? { "Authorization": `Bearer ${token}` } : {}
2533
- }
2534
- };
2535
- return originalRequest(method, path, mergedOptions);
2536
- };
2537
- }
2538
- /**
2539
- * Get current JWT token
2540
- */
2541
- getToken() {
2542
- return this.storage.getItem(TOKEN_KEY2);
2543
- }
2544
- /**
2545
- * Get current refresh token
2546
- */
2547
- getRefreshToken() {
2548
- return this.storage.getItem(REFRESH_TOKEN_KEY2);
2549
- }
2550
- /**
2551
- * Set JWT token and refresh token
2552
- * @param token - JWT access token
2553
- * @param refreshToken - JWT refresh token (optional)
2554
- */
2555
- setToken(token, refreshToken) {
2556
- this._token = token;
2557
- this.storage.setItem(TOKEN_KEY2, token);
2558
- if (refreshToken) {
2559
- this._refreshToken = refreshToken;
2560
- this.storage.setItem(REFRESH_TOKEN_KEY2, refreshToken);
2991
+ __name(createCentrifugoServerInfoCreate, "createCentrifugoServerInfoCreate");
2992
+ async function createCentrifugoServerPresenceCreate(data, client) {
2993
+ const api = client || getAPIInstance2();
2994
+ const response = await api.centrifugo_admin_api.centrifugoServerPresenceCreate(data);
2995
+ try {
2996
+ return CentrifugoPresenceResponseSchema.parse(response);
2997
+ } catch (error) {
2998
+ consola5.error("\u274C Zod Validation Failed");
2999
+ consola5.box(`createCentrifugoServerPresenceCreate
3000
+ Path: /cfg/centrifugo/server/presence/
3001
+ Method: POST`);
3002
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3003
+ consola5.error("Validation Issues:");
3004
+ error.issues.forEach((issue, index) => {
3005
+ consola5.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3006
+ consola5.error(` \u251C\u2500 Message: ${issue.message}`);
3007
+ if (issue.expected) consola5.error(` \u251C\u2500 Expected: ${issue.expected}`);
3008
+ if (issue.received) consola5.error(` \u2514\u2500 Received: ${issue.received}`);
3009
+ });
2561
3010
  }
2562
- this._reinitClients();
2563
- }
2564
- /**
2565
- * Clear all tokens
2566
- */
2567
- clearTokens() {
2568
- this._token = null;
2569
- this._refreshToken = null;
2570
- this.storage.removeItem(TOKEN_KEY2);
2571
- this.storage.removeItem(REFRESH_TOKEN_KEY2);
2572
- this._reinitClients();
2573
- }
2574
- /**
2575
- * Check if user is authenticated
2576
- */
2577
- isAuthenticated() {
2578
- return !!this.getToken();
2579
- }
2580
- /**
2581
- * Update base URL and reinitialize clients
2582
- * @param url - New base URL
2583
- */
2584
- setBaseUrl(url) {
2585
- this.baseUrl = url;
2586
- this._reinitClients();
2587
- }
2588
- /**
2589
- * Get current base URL
2590
- */
2591
- getBaseUrl() {
2592
- return this.baseUrl;
3011
+ consola5.error("Response data:", response);
3012
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3013
+ try {
3014
+ const event = new CustomEvent("zod-validation-error", {
3015
+ detail: {
3016
+ operation: "createCentrifugoServerPresenceCreate",
3017
+ path: "/cfg/centrifugo/server/presence/",
3018
+ method: "POST",
3019
+ error,
3020
+ response,
3021
+ timestamp: /* @__PURE__ */ new Date()
3022
+ },
3023
+ bubbles: true,
3024
+ cancelable: false
3025
+ });
3026
+ window.dispatchEvent(event);
3027
+ } catch (eventError) {
3028
+ consola5.warn("Failed to dispatch validation error event:", eventError);
3029
+ }
3030
+ }
3031
+ throw error;
2593
3032
  }
2594
- /**
2595
- * Get OpenAPI schema path
2596
- * @returns Path to the OpenAPI schema JSON file
2597
- *
2598
- * Note: The OpenAPI schema is available in the schema.json file.
2599
- * You can load it dynamically using:
2600
- * ```typescript
2601
- * const schema = await fetch('./schema.json').then(r => r.json());
2602
- * // or using fs in Node.js:
2603
- * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));
2604
- * ```
2605
- */
2606
- getSchemaPath() {
2607
- return "./schema.json";
3033
+ }
3034
+ __name(createCentrifugoServerPresenceCreate, "createCentrifugoServerPresenceCreate");
3035
+ async function createCentrifugoServerPresenceStatsCreate(data, client) {
3036
+ const api = client || getAPIInstance2();
3037
+ const response = await api.centrifugo_admin_api.centrifugoServerPresenceStatsCreate(data);
3038
+ try {
3039
+ return CentrifugoPresenceStatsResponseSchema.parse(response);
3040
+ } catch (error) {
3041
+ consola5.error("\u274C Zod Validation Failed");
3042
+ consola5.box(`createCentrifugoServerPresenceStatsCreate
3043
+ Path: /cfg/centrifugo/server/presence-stats/
3044
+ Method: POST`);
3045
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3046
+ consola5.error("Validation Issues:");
3047
+ error.issues.forEach((issue, index) => {
3048
+ consola5.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3049
+ consola5.error(` \u251C\u2500 Message: ${issue.message}`);
3050
+ if (issue.expected) consola5.error(` \u251C\u2500 Expected: ${issue.expected}`);
3051
+ if (issue.received) consola5.error(` \u2514\u2500 Received: ${issue.received}`);
3052
+ });
3053
+ }
3054
+ consola5.error("Response data:", response);
3055
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3056
+ try {
3057
+ const event = new CustomEvent("zod-validation-error", {
3058
+ detail: {
3059
+ operation: "createCentrifugoServerPresenceStatsCreate",
3060
+ path: "/cfg/centrifugo/server/presence-stats/",
3061
+ method: "POST",
3062
+ error,
3063
+ response,
3064
+ timestamp: /* @__PURE__ */ new Date()
3065
+ },
3066
+ bubbles: true,
3067
+ cancelable: false
3068
+ });
3069
+ window.dispatchEvent(event);
3070
+ } catch (eventError) {
3071
+ consola5.warn("Failed to dispatch validation error event:", eventError);
3072
+ }
3073
+ }
3074
+ throw error;
2608
3075
  }
2609
- };
3076
+ }
3077
+ __name(createCentrifugoServerPresenceStatsCreate, "createCentrifugoServerPresenceStatsCreate");
2610
3078
 
2611
- // src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/client.ts
2612
- var CentrifugoAdminApi = class {
2613
- static {
2614
- __name(this, "CentrifugoAdminApi");
2615
- }
2616
- constructor(client) {
2617
- this.client = client;
2618
- }
2619
- /**
2620
- * Get connection token for dashboard
2621
- *
2622
- * Returns JWT token and config for WebSocket connection to Centrifugo.
2623
- */
2624
- async centrifugoServerAuthTokenCreate() {
2625
- const response = await this.client.request("POST", "/cfg/centrifugo/server/auth/token/");
2626
- return response;
2627
- }
2628
- /**
2629
- * List active channels
2630
- *
2631
- * Returns list of active channels with optional pattern filter.
2632
- */
2633
- async centrifugoServerChannelsCreate(data) {
2634
- const response = await this.client.request("POST", "/cfg/centrifugo/server/channels/", { body: data });
2635
- return response;
2636
- }
2637
- /**
2638
- * Get channel history
2639
- *
2640
- * Returns message history for a channel.
2641
- */
2642
- async centrifugoServerHistoryCreate(data) {
2643
- const response = await this.client.request("POST", "/cfg/centrifugo/server/history/", { body: data });
2644
- return response;
2645
- }
2646
- /**
2647
- * Get Centrifugo server info
2648
- *
2649
- * Returns server information including node count, version, and uptime.
2650
- */
2651
- async centrifugoServerInfoCreate() {
2652
- const response = await this.client.request("POST", "/cfg/centrifugo/server/info/");
2653
- return response;
2654
- }
2655
- /**
2656
- * Get channel presence
2657
- *
2658
- * Returns list of clients currently subscribed to a channel.
2659
- */
2660
- async centrifugoServerPresenceCreate(data) {
2661
- const response = await this.client.request("POST", "/cfg/centrifugo/server/presence/", { body: data });
2662
- return response;
2663
- }
2664
- /**
2665
- * Get channel presence statistics
2666
- *
2667
- * Returns quick statistics about channel presence (num_clients,
2668
- * num_users).
2669
- */
2670
- async centrifugoServerPresenceStatsCreate(data) {
2671
- const response = await this.client.request("POST", "/cfg/centrifugo/server/presence-stats/", { body: data });
2672
- return response;
2673
- }
2674
- };
2675
-
2676
- // src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/client.ts
2677
- var CentrifugoAuth = class {
2678
- static {
2679
- __name(this, "CentrifugoAuth");
2680
- }
2681
- constructor(client) {
2682
- this.client = client;
2683
- }
2684
- /**
2685
- * Get Centrifugo connection token
2686
- *
2687
- * Generate JWT token for WebSocket connection to Centrifugo. Token
2688
- * includes user's allowed channels based on their permissions. Requires
2689
- * authentication.
2690
- */
2691
- async tokenRetrieve() {
2692
- const response = await this.client.request("GET", "/cfg/centrifugo/auth/token/");
2693
- return response;
3079
+ // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts
3080
+ import { consola as consola6 } from "consola";
3081
+ async function getCentrifugoAuthTokenRetrieve(client) {
3082
+ const api = client || getAPIInstance2();
3083
+ const response = await api.centrifugo_auth.tokenRetrieve();
3084
+ try {
3085
+ return ConnectionTokenResponseSchema.parse(response);
3086
+ } catch (error) {
3087
+ consola6.error("\u274C Zod Validation Failed");
3088
+ consola6.box(`getCentrifugoAuthTokenRetrieve
3089
+ Path: /cfg/centrifugo/auth/token/
3090
+ Method: GET`);
3091
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3092
+ consola6.error("Validation Issues:");
3093
+ error.issues.forEach((issue, index) => {
3094
+ consola6.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3095
+ consola6.error(` \u251C\u2500 Message: ${issue.message}`);
3096
+ if (issue.expected) consola6.error(` \u251C\u2500 Expected: ${issue.expected}`);
3097
+ if (issue.received) consola6.error(` \u2514\u2500 Received: ${issue.received}`);
3098
+ });
3099
+ }
3100
+ consola6.error("Response data:", response);
3101
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3102
+ try {
3103
+ const event = new CustomEvent("zod-validation-error", {
3104
+ detail: {
3105
+ operation: "getCentrifugoAuthTokenRetrieve",
3106
+ path: "/cfg/centrifugo/auth/token/",
3107
+ method: "GET",
3108
+ error,
3109
+ response,
3110
+ timestamp: /* @__PURE__ */ new Date()
3111
+ },
3112
+ bubbles: true,
3113
+ cancelable: false
3114
+ });
3115
+ window.dispatchEvent(event);
3116
+ } catch (eventError) {
3117
+ consola6.warn("Failed to dispatch validation error event:", eventError);
3118
+ }
3119
+ }
3120
+ throw error;
2694
3121
  }
2695
- };
3122
+ }
3123
+ __name(getCentrifugoAuthTokenRetrieve, "getCentrifugoAuthTokenRetrieve");
2696
3124
 
2697
- // src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/client.ts
2698
- var CentrifugoMonitoring = class {
2699
- static {
2700
- __name(this, "CentrifugoMonitoring");
2701
- }
2702
- constructor(client) {
2703
- this.client = client;
2704
- }
2705
- /**
2706
- * Get channel statistics
2707
- *
2708
- * Returns statistics grouped by channel.
2709
- */
2710
- async centrifugoMonitorChannelsRetrieve(...args) {
2711
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
2712
- let params;
2713
- if (isParamsObject) {
2714
- params = args[0];
2715
- } else {
2716
- params = { hours: args[0] };
3125
+ // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts
3126
+ import { consola as consola7 } from "consola";
3127
+ async function getCentrifugoMonitorChannelsRetrieve(params, client) {
3128
+ const api = client || getAPIInstance2();
3129
+ const response = await api.centrifugo_monitoring.centrifugoMonitorChannelsRetrieve(params?.hours);
3130
+ try {
3131
+ return ChannelListSchema.parse(response);
3132
+ } catch (error) {
3133
+ consola7.error("\u274C Zod Validation Failed");
3134
+ consola7.box(`getCentrifugoMonitorChannelsRetrieve
3135
+ Path: /cfg/centrifugo/monitor/channels/
3136
+ Method: GET`);
3137
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3138
+ consola7.error("Validation Issues:");
3139
+ error.issues.forEach((issue, index) => {
3140
+ consola7.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3141
+ consola7.error(` \u251C\u2500 Message: ${issue.message}`);
3142
+ if (issue.expected) consola7.error(` \u251C\u2500 Expected: ${issue.expected}`);
3143
+ if (issue.received) consola7.error(` \u2514\u2500 Received: ${issue.received}`);
3144
+ });
2717
3145
  }
2718
- const response = await this.client.request("GET", "/cfg/centrifugo/monitor/channels/", { params });
2719
- return response.results || response;
2720
- }
2721
- /**
2722
- * Get Centrifugo health status
2723
- *
2724
- * Returns the current health status of the Centrifugo client.
2725
- */
2726
- async centrifugoMonitorHealthRetrieve() {
2727
- const response = await this.client.request("GET", "/cfg/centrifugo/monitor/health/");
2728
- return response;
2729
- }
2730
- /**
2731
- * Get overview statistics
2732
- *
2733
- * Returns overview statistics for Centrifugo publishes.
2734
- */
2735
- async centrifugoMonitorOverviewRetrieve(...args) {
2736
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
2737
- let params;
2738
- if (isParamsObject) {
2739
- params = args[0];
2740
- } else {
2741
- params = { hours: args[0] };
3146
+ consola7.error("Response data:", response);
3147
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3148
+ try {
3149
+ const event = new CustomEvent("zod-validation-error", {
3150
+ detail: {
3151
+ operation: "getCentrifugoMonitorChannelsRetrieve",
3152
+ path: "/cfg/centrifugo/monitor/channels/",
3153
+ method: "GET",
3154
+ error,
3155
+ response,
3156
+ timestamp: /* @__PURE__ */ new Date()
3157
+ },
3158
+ bubbles: true,
3159
+ cancelable: false
3160
+ });
3161
+ window.dispatchEvent(event);
3162
+ } catch (eventError) {
3163
+ consola7.warn("Failed to dispatch validation error event:", eventError);
3164
+ }
2742
3165
  }
2743
- const response = await this.client.request("GET", "/cfg/centrifugo/monitor/overview/", { params });
2744
- return response;
3166
+ throw error;
2745
3167
  }
2746
- /**
2747
- * Get recent publishes
2748
- *
2749
- * Returns a paginated list of recent Centrifugo publishes with their
2750
- * details. Uses standard DRF pagination.
2751
- */
2752
- async centrifugoMonitorPublishesList(...args) {
2753
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
2754
- let params;
2755
- if (isParamsObject) {
2756
- params = args[0];
2757
- } else {
2758
- params = { channel: args[0], page: args[1], page_size: args[2], status: args[3] };
3168
+ }
3169
+ __name(getCentrifugoMonitorChannelsRetrieve, "getCentrifugoMonitorChannelsRetrieve");
3170
+ async function getCentrifugoMonitorHealthRetrieve(client) {
3171
+ const api = client || getAPIInstance2();
3172
+ const response = await api.centrifugo_monitoring.centrifugoMonitorHealthRetrieve();
3173
+ try {
3174
+ return CentrifugoHealthCheckSchema.parse(response);
3175
+ } catch (error) {
3176
+ consola7.error("\u274C Zod Validation Failed");
3177
+ consola7.box(`getCentrifugoMonitorHealthRetrieve
3178
+ Path: /cfg/centrifugo/monitor/health/
3179
+ Method: GET`);
3180
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3181
+ consola7.error("Validation Issues:");
3182
+ error.issues.forEach((issue, index) => {
3183
+ consola7.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3184
+ consola7.error(` \u251C\u2500 Message: ${issue.message}`);
3185
+ if (issue.expected) consola7.error(` \u251C\u2500 Expected: ${issue.expected}`);
3186
+ if (issue.received) consola7.error(` \u2514\u2500 Received: ${issue.received}`);
3187
+ });
2759
3188
  }
2760
- const response = await this.client.request("GET", "/cfg/centrifugo/monitor/publishes/", { params });
2761
- return response;
3189
+ consola7.error("Response data:", response);
3190
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3191
+ try {
3192
+ const event = new CustomEvent("zod-validation-error", {
3193
+ detail: {
3194
+ operation: "getCentrifugoMonitorHealthRetrieve",
3195
+ path: "/cfg/centrifugo/monitor/health/",
3196
+ method: "GET",
3197
+ error,
3198
+ response,
3199
+ timestamp: /* @__PURE__ */ new Date()
3200
+ },
3201
+ bubbles: true,
3202
+ cancelable: false
3203
+ });
3204
+ window.dispatchEvent(event);
3205
+ } catch (eventError) {
3206
+ consola7.warn("Failed to dispatch validation error event:", eventError);
3207
+ }
3208
+ }
3209
+ throw error;
2762
3210
  }
2763
- /**
2764
- * Get publish timeline
2765
- *
2766
- * Returns hourly or daily breakdown of publish counts for charts.
2767
- */
2768
- async centrifugoMonitorTimelineRetrieve(...args) {
2769
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
2770
- let params;
2771
- if (isParamsObject) {
2772
- params = args[0];
2773
- } else {
2774
- params = { hours: args[0], interval: args[1] };
2775
- }
2776
- const response = await this.client.request("GET", "/cfg/centrifugo/monitor/timeline/", { params });
2777
- return response;
2778
- }
2779
- };
2780
-
2781
- // src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/client.ts
2782
- var CentrifugoTesting = class {
2783
- static {
2784
- __name(this, "CentrifugoTesting");
2785
- }
2786
- constructor(client) {
2787
- this.client = client;
2788
- }
2789
- /**
2790
- * Publish test message
2791
- *
2792
- * Publish test message to Centrifugo via wrapper with optional ACK
2793
- * tracking.
2794
- */
2795
- async publishTestCreate(data) {
2796
- const response = await this.client.request("POST", "/cfg/centrifugo/testing/publish-test/", { body: data });
2797
- return response;
2798
- }
2799
- /**
2800
- * Publish with database logging
2801
- *
2802
- * Publish message using CentrifugoClient with database logging. This will
2803
- * create CentrifugoLog records.
2804
- */
2805
- async publishWithLoggingCreate(data) {
2806
- const response = await this.client.request("POST", "/cfg/centrifugo/testing/publish-with-logging/", { body: data });
2807
- return response;
2808
- }
2809
- /**
2810
- * Send manual ACK
2811
- *
2812
- * Manually send ACK for a message to the wrapper. Pass message_id in
2813
- * request body.
2814
- */
2815
- async sendAckCreate(data) {
2816
- const response = await this.client.request("POST", "/cfg/centrifugo/testing/send-ack/", { body: data });
2817
- return response;
2818
- }
2819
- };
2820
-
2821
- // src/generated/cfg_centrifugo/http.ts
2822
- var FetchAdapter3 = class {
2823
- static {
2824
- __name(this, "FetchAdapter");
2825
- }
2826
- async request(request) {
2827
- const { method, url, headers, body, params, formData } = request;
2828
- let finalUrl = url;
2829
- if (params) {
2830
- const searchParams = new URLSearchParams();
2831
- Object.entries(params).forEach(([key, value]) => {
2832
- if (value !== null && value !== void 0) {
2833
- searchParams.append(key, String(value));
2834
- }
3211
+ }
3212
+ __name(getCentrifugoMonitorHealthRetrieve, "getCentrifugoMonitorHealthRetrieve");
3213
+ async function getCentrifugoMonitorOverviewRetrieve(params, client) {
3214
+ const api = client || getAPIInstance2();
3215
+ const response = await api.centrifugo_monitoring.centrifugoMonitorOverviewRetrieve(params?.hours);
3216
+ try {
3217
+ return CentrifugoOverviewStatsSchema.parse(response);
3218
+ } catch (error) {
3219
+ consola7.error("\u274C Zod Validation Failed");
3220
+ consola7.box(`getCentrifugoMonitorOverviewRetrieve
3221
+ Path: /cfg/centrifugo/monitor/overview/
3222
+ Method: GET`);
3223
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3224
+ consola7.error("Validation Issues:");
3225
+ error.issues.forEach((issue, index) => {
3226
+ consola7.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3227
+ consola7.error(` \u251C\u2500 Message: ${issue.message}`);
3228
+ if (issue.expected) consola7.error(` \u251C\u2500 Expected: ${issue.expected}`);
3229
+ if (issue.received) consola7.error(` \u2514\u2500 Received: ${issue.received}`);
2835
3230
  });
2836
- const queryString = searchParams.toString();
2837
- if (queryString) {
2838
- finalUrl = url.includes("?") ? `${url}&${queryString}` : `${url}?${queryString}`;
3231
+ }
3232
+ consola7.error("Response data:", response);
3233
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3234
+ try {
3235
+ const event = new CustomEvent("zod-validation-error", {
3236
+ detail: {
3237
+ operation: "getCentrifugoMonitorOverviewRetrieve",
3238
+ path: "/cfg/centrifugo/monitor/overview/",
3239
+ method: "GET",
3240
+ error,
3241
+ response,
3242
+ timestamp: /* @__PURE__ */ new Date()
3243
+ },
3244
+ bubbles: true,
3245
+ cancelable: false
3246
+ });
3247
+ window.dispatchEvent(event);
3248
+ } catch (eventError) {
3249
+ consola7.warn("Failed to dispatch validation error event:", eventError);
2839
3250
  }
2840
3251
  }
2841
- const finalHeaders = { ...headers };
2842
- let requestBody;
2843
- if (formData) {
2844
- requestBody = formData;
2845
- } else if (body) {
2846
- finalHeaders["Content-Type"] = "application/json";
2847
- requestBody = JSON.stringify(body);
3252
+ throw error;
3253
+ }
3254
+ }
3255
+ __name(getCentrifugoMonitorOverviewRetrieve, "getCentrifugoMonitorOverviewRetrieve");
3256
+ async function getCentrifugoMonitorPublishesList(params, client) {
3257
+ const api = client || getAPIInstance2();
3258
+ const response = await api.centrifugo_monitoring.centrifugoMonitorPublishesList(params?.channel, params?.page, params?.page_size, params?.status);
3259
+ try {
3260
+ return PaginatedPublishListSchema.parse(response);
3261
+ } catch (error) {
3262
+ consola7.error("\u274C Zod Validation Failed");
3263
+ consola7.box(`getCentrifugoMonitorPublishesList
3264
+ Path: /cfg/centrifugo/monitor/publishes/
3265
+ Method: GET`);
3266
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3267
+ consola7.error("Validation Issues:");
3268
+ error.issues.forEach((issue, index) => {
3269
+ consola7.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3270
+ consola7.error(` \u251C\u2500 Message: ${issue.message}`);
3271
+ if (issue.expected) consola7.error(` \u251C\u2500 Expected: ${issue.expected}`);
3272
+ if (issue.received) consola7.error(` \u2514\u2500 Received: ${issue.received}`);
3273
+ });
2848
3274
  }
2849
- const response = await fetch(finalUrl, {
2850
- method,
2851
- headers: finalHeaders,
2852
- body: requestBody,
2853
- credentials: "include"
2854
- // Include Django session cookies
2855
- });
2856
- let data = null;
2857
- const contentType = response.headers.get("content-type");
2858
- if (response.status !== 204 && contentType?.includes("application/json")) {
2859
- data = await response.json();
2860
- } else if (response.status !== 204) {
2861
- data = await response.text();
3275
+ consola7.error("Response data:", response);
3276
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3277
+ try {
3278
+ const event = new CustomEvent("zod-validation-error", {
3279
+ detail: {
3280
+ operation: "getCentrifugoMonitorPublishesList",
3281
+ path: "/cfg/centrifugo/monitor/publishes/",
3282
+ method: "GET",
3283
+ error,
3284
+ response,
3285
+ timestamp: /* @__PURE__ */ new Date()
3286
+ },
3287
+ bubbles: true,
3288
+ cancelable: false
3289
+ });
3290
+ window.dispatchEvent(event);
3291
+ } catch (eventError) {
3292
+ consola7.warn("Failed to dispatch validation error event:", eventError);
3293
+ }
2862
3294
  }
2863
- const responseHeaders = {};
2864
- response.headers.forEach((value, key) => {
2865
- responseHeaders[key] = value;
2866
- });
2867
- return {
2868
- data,
2869
- status: response.status,
2870
- statusText: response.statusText,
2871
- headers: responseHeaders
2872
- };
2873
- }
2874
- };
2875
-
2876
- // src/generated/cfg_centrifugo/errors.ts
2877
- var APIError3 = class extends Error {
2878
- constructor(statusCode, statusText, response, url, message) {
2879
- super(message || `HTTP ${statusCode}: ${statusText}`);
2880
- this.statusCode = statusCode;
2881
- this.statusText = statusText;
2882
- this.response = response;
2883
- this.url = url;
2884
- this.name = "APIError";
2885
- }
2886
- static {
2887
- __name(this, "APIError");
3295
+ throw error;
2888
3296
  }
2889
- /**
2890
- * Get error details from response.
2891
- * DRF typically returns: { "detail": "Error message" } or { "field": ["error1", "error2"] }
2892
- */
2893
- get details() {
2894
- if (typeof this.response === "object" && this.response !== null) {
2895
- return this.response;
3297
+ }
3298
+ __name(getCentrifugoMonitorPublishesList, "getCentrifugoMonitorPublishesList");
3299
+ async function getCentrifugoMonitorTimelineRetrieve(params, client) {
3300
+ const api = client || getAPIInstance2();
3301
+ const response = await api.centrifugo_monitoring.centrifugoMonitorTimelineRetrieve(params?.hours, params?.interval);
3302
+ try {
3303
+ return TimelineResponseSchema.parse(response);
3304
+ } catch (error) {
3305
+ consola7.error("\u274C Zod Validation Failed");
3306
+ consola7.box(`getCentrifugoMonitorTimelineRetrieve
3307
+ Path: /cfg/centrifugo/monitor/timeline/
3308
+ Method: GET`);
3309
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3310
+ consola7.error("Validation Issues:");
3311
+ error.issues.forEach((issue, index) => {
3312
+ consola7.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3313
+ consola7.error(` \u251C\u2500 Message: ${issue.message}`);
3314
+ if (issue.expected) consola7.error(` \u251C\u2500 Expected: ${issue.expected}`);
3315
+ if (issue.received) consola7.error(` \u2514\u2500 Received: ${issue.received}`);
3316
+ });
2896
3317
  }
2897
- return null;
2898
- }
2899
- /**
2900
- * Get field-specific validation errors from DRF.
2901
- * Returns: { "field_name": ["error1", "error2"], ... }
2902
- */
2903
- get fieldErrors() {
2904
- const details = this.details;
2905
- if (!details) return null;
2906
- const fieldErrors = {};
2907
- for (const [key, value] of Object.entries(details)) {
2908
- if (Array.isArray(value)) {
2909
- fieldErrors[key] = value;
3318
+ consola7.error("Response data:", response);
3319
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3320
+ try {
3321
+ const event = new CustomEvent("zod-validation-error", {
3322
+ detail: {
3323
+ operation: "getCentrifugoMonitorTimelineRetrieve",
3324
+ path: "/cfg/centrifugo/monitor/timeline/",
3325
+ method: "GET",
3326
+ error,
3327
+ response,
3328
+ timestamp: /* @__PURE__ */ new Date()
3329
+ },
3330
+ bubbles: true,
3331
+ cancelable: false
3332
+ });
3333
+ window.dispatchEvent(event);
3334
+ } catch (eventError) {
3335
+ consola7.warn("Failed to dispatch validation error event:", eventError);
2910
3336
  }
2911
3337
  }
2912
- return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
3338
+ throw error;
2913
3339
  }
2914
- /**
2915
- * Get single error message from DRF.
2916
- * Checks for "detail", "message", or first field error.
2917
- */
2918
- get errorMessage() {
2919
- const details = this.details;
2920
- if (!details) return this.message;
2921
- if (details.detail) {
2922
- return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
2923
- }
2924
- if (details.message) {
2925
- return String(details.message);
3340
+ }
3341
+ __name(getCentrifugoMonitorTimelineRetrieve, "getCentrifugoMonitorTimelineRetrieve");
3342
+
3343
+ // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts
3344
+ import { consola as consola8 } from "consola";
3345
+ async function createCentrifugoTestingPublishTestCreate(data, client) {
3346
+ const api = client || getAPIInstance2();
3347
+ const response = await api.centrifugo_testing.publishTestCreate(data);
3348
+ try {
3349
+ return PublishTestResponseSchema.parse(response);
3350
+ } catch (error) {
3351
+ consola8.error("\u274C Zod Validation Failed");
3352
+ consola8.box(`createCentrifugoTestingPublishTestCreate
3353
+ Path: /cfg/centrifugo/testing/publish-test/
3354
+ Method: POST`);
3355
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3356
+ consola8.error("Validation Issues:");
3357
+ error.issues.forEach((issue, index) => {
3358
+ consola8.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3359
+ consola8.error(` \u251C\u2500 Message: ${issue.message}`);
3360
+ if (issue.expected) consola8.error(` \u251C\u2500 Expected: ${issue.expected}`);
3361
+ if (issue.received) consola8.error(` \u2514\u2500 Received: ${issue.received}`);
3362
+ });
2926
3363
  }
2927
- const fieldErrors = this.fieldErrors;
2928
- if (fieldErrors) {
2929
- const firstField = Object.keys(fieldErrors)[0];
2930
- if (firstField) {
2931
- return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
3364
+ consola8.error("Response data:", response);
3365
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3366
+ try {
3367
+ const event = new CustomEvent("zod-validation-error", {
3368
+ detail: {
3369
+ operation: "createCentrifugoTestingPublishTestCreate",
3370
+ path: "/cfg/centrifugo/testing/publish-test/",
3371
+ method: "POST",
3372
+ error,
3373
+ response,
3374
+ timestamp: /* @__PURE__ */ new Date()
3375
+ },
3376
+ bubbles: true,
3377
+ cancelable: false
3378
+ });
3379
+ window.dispatchEvent(event);
3380
+ } catch (eventError) {
3381
+ consola8.warn("Failed to dispatch validation error event:", eventError);
2932
3382
  }
2933
3383
  }
2934
- return this.message;
2935
- }
2936
- // Helper methods for common HTTP status codes
2937
- get isValidationError() {
2938
- return this.statusCode === 400;
2939
- }
2940
- get isAuthError() {
2941
- return this.statusCode === 401;
2942
- }
2943
- get isPermissionError() {
2944
- return this.statusCode === 403;
3384
+ throw error;
2945
3385
  }
2946
- get isNotFoundError() {
2947
- return this.statusCode === 404;
3386
+ }
3387
+ __name(createCentrifugoTestingPublishTestCreate, "createCentrifugoTestingPublishTestCreate");
3388
+ async function createCentrifugoTestingPublishWithLoggingCreate(data, client) {
3389
+ const api = client || getAPIInstance2();
3390
+ const response = await api.centrifugo_testing.publishWithLoggingCreate(data);
3391
+ try {
3392
+ return PublishTestResponseSchema.parse(response);
3393
+ } catch (error) {
3394
+ consola8.error("\u274C Zod Validation Failed");
3395
+ consola8.box(`createCentrifugoTestingPublishWithLoggingCreate
3396
+ Path: /cfg/centrifugo/testing/publish-with-logging/
3397
+ Method: POST`);
3398
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3399
+ consola8.error("Validation Issues:");
3400
+ error.issues.forEach((issue, index) => {
3401
+ consola8.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3402
+ consola8.error(` \u251C\u2500 Message: ${issue.message}`);
3403
+ if (issue.expected) consola8.error(` \u251C\u2500 Expected: ${issue.expected}`);
3404
+ if (issue.received) consola8.error(` \u2514\u2500 Received: ${issue.received}`);
3405
+ });
3406
+ }
3407
+ consola8.error("Response data:", response);
3408
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3409
+ try {
3410
+ const event = new CustomEvent("zod-validation-error", {
3411
+ detail: {
3412
+ operation: "createCentrifugoTestingPublishWithLoggingCreate",
3413
+ path: "/cfg/centrifugo/testing/publish-with-logging/",
3414
+ method: "POST",
3415
+ error,
3416
+ response,
3417
+ timestamp: /* @__PURE__ */ new Date()
3418
+ },
3419
+ bubbles: true,
3420
+ cancelable: false
3421
+ });
3422
+ window.dispatchEvent(event);
3423
+ } catch (eventError) {
3424
+ consola8.warn("Failed to dispatch validation error event:", eventError);
3425
+ }
3426
+ }
3427
+ throw error;
2948
3428
  }
2949
- get isServerError() {
2950
- return this.statusCode >= 500 && this.statusCode < 600;
3429
+ }
3430
+ __name(createCentrifugoTestingPublishWithLoggingCreate, "createCentrifugoTestingPublishWithLoggingCreate");
3431
+ async function createCentrifugoTestingSendAckCreate(data, client) {
3432
+ const api = client || getAPIInstance2();
3433
+ const response = await api.centrifugo_testing.sendAckCreate(data);
3434
+ try {
3435
+ return ManualAckResponseSchema.parse(response);
3436
+ } catch (error) {
3437
+ consola8.error("\u274C Zod Validation Failed");
3438
+ consola8.box(`createCentrifugoTestingSendAckCreate
3439
+ Path: /cfg/centrifugo/testing/send-ack/
3440
+ Method: POST`);
3441
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3442
+ consola8.error("Validation Issues:");
3443
+ error.issues.forEach((issue, index) => {
3444
+ consola8.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3445
+ consola8.error(` \u251C\u2500 Message: ${issue.message}`);
3446
+ if (issue.expected) consola8.error(` \u251C\u2500 Expected: ${issue.expected}`);
3447
+ if (issue.received) consola8.error(` \u2514\u2500 Received: ${issue.received}`);
3448
+ });
3449
+ }
3450
+ consola8.error("Response data:", response);
3451
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3452
+ try {
3453
+ const event = new CustomEvent("zod-validation-error", {
3454
+ detail: {
3455
+ operation: "createCentrifugoTestingSendAckCreate",
3456
+ path: "/cfg/centrifugo/testing/send-ack/",
3457
+ method: "POST",
3458
+ error,
3459
+ response,
3460
+ timestamp: /* @__PURE__ */ new Date()
3461
+ },
3462
+ bubbles: true,
3463
+ cancelable: false
3464
+ });
3465
+ window.dispatchEvent(event);
3466
+ } catch (eventError) {
3467
+ consola8.warn("Failed to dispatch validation error event:", eventError);
3468
+ }
3469
+ }
3470
+ throw error;
2951
3471
  }
2952
- };
2953
- var NetworkError3 = class extends Error {
2954
- constructor(message, url, originalError) {
2955
- super(message);
2956
- this.url = url;
2957
- this.originalError = originalError;
2958
- this.name = "NetworkError";
3472
+ }
3473
+ __name(createCentrifugoTestingSendAckCreate, "createCentrifugoTestingSendAckCreate");
3474
+
3475
+ // src/generated/cfg_centrifugo/index.ts
3476
+ var TOKEN_KEY2 = "auth_token";
3477
+ var REFRESH_TOKEN_KEY2 = "refresh_token";
3478
+ var API2 = class {
3479
+ constructor(baseUrl, options) {
3480
+ this._token = null;
3481
+ this._refreshToken = null;
3482
+ this.baseUrl = baseUrl;
3483
+ this.options = options;
3484
+ const logger = options?.loggerConfig ? new APILogger2(options.loggerConfig) : void 0;
3485
+ this.storage = options?.storage || new LocalStorageAdapter2(logger);
3486
+ this._loadTokensFromStorage();
3487
+ this._client = new APIClient2(this.baseUrl, {
3488
+ retryConfig: this.options?.retryConfig,
3489
+ loggerConfig: this.options?.loggerConfig
3490
+ });
3491
+ this._injectAuthHeader();
3492
+ this.centrifugo_admin_api = this._client.centrifugo_admin_api;
3493
+ this.centrifugo_auth = this._client.centrifugo_auth;
3494
+ this.centrifugo_monitoring = this._client.centrifugo_monitoring;
3495
+ this.centrifugo_testing = this._client.centrifugo_testing;
2959
3496
  }
2960
3497
  static {
2961
- __name(this, "NetworkError");
3498
+ __name(this, "API");
2962
3499
  }
2963
- };
2964
-
2965
- // src/generated/cfg_centrifugo/logger.ts
2966
- import { createConsola as createConsola3 } from "consola";
2967
- var DEFAULT_CONFIG3 = {
2968
- enabled: process.env.NODE_ENV !== "production",
2969
- logRequests: true,
2970
- logResponses: true,
2971
- logErrors: true,
2972
- logBodies: true,
2973
- logHeaders: false
2974
- };
2975
- var SENSITIVE_HEADERS3 = [
2976
- "authorization",
2977
- "cookie",
2978
- "set-cookie",
2979
- "x-api-key",
2980
- "x-csrf-token"
2981
- ];
2982
- var APILogger3 = class {
2983
- static {
2984
- __name(this, "APILogger");
3500
+ _loadTokensFromStorage() {
3501
+ this._token = this.storage.getItem(TOKEN_KEY2);
3502
+ this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY2);
2985
3503
  }
2986
- constructor(config = {}) {
2987
- this.config = { ...DEFAULT_CONFIG3, ...config };
2988
- this.consola = config.consola || createConsola3({
2989
- level: this.config.enabled ? 4 : 0
3504
+ _reinitClients() {
3505
+ this._client = new APIClient2(this.baseUrl, {
3506
+ retryConfig: this.options?.retryConfig,
3507
+ loggerConfig: this.options?.loggerConfig
2990
3508
  });
3509
+ this._injectAuthHeader();
3510
+ this.centrifugo_admin_api = this._client.centrifugo_admin_api;
3511
+ this.centrifugo_auth = this._client.centrifugo_auth;
3512
+ this.centrifugo_monitoring = this._client.centrifugo_monitoring;
3513
+ this.centrifugo_testing = this._client.centrifugo_testing;
2991
3514
  }
2992
- /**
2993
- * Enable logging
2994
- */
2995
- enable() {
2996
- this.config.enabled = true;
3515
+ _injectAuthHeader() {
3516
+ const originalRequest = this._client.request.bind(this._client);
3517
+ this._client.request = async (method, path, options) => {
3518
+ const token = this.getToken();
3519
+ const mergedOptions = {
3520
+ ...options,
3521
+ headers: {
3522
+ ...options?.headers || {},
3523
+ ...token ? { "Authorization": `Bearer ${token}` } : {}
3524
+ }
3525
+ };
3526
+ return originalRequest(method, path, mergedOptions);
3527
+ };
2997
3528
  }
2998
3529
  /**
2999
- * Disable logging
3530
+ * Get current JWT token
3000
3531
  */
3001
- disable() {
3002
- this.config.enabled = false;
3532
+ getToken() {
3533
+ return this.storage.getItem(TOKEN_KEY2);
3003
3534
  }
3004
3535
  /**
3005
- * Update configuration
3536
+ * Get current refresh token
3006
3537
  */
3007
- setConfig(config) {
3008
- this.config = { ...this.config, ...config };
3538
+ getRefreshToken() {
3539
+ return this.storage.getItem(REFRESH_TOKEN_KEY2);
3009
3540
  }
3010
3541
  /**
3011
- * Filter sensitive headers
3542
+ * Set JWT token and refresh token
3543
+ * @param token - JWT access token
3544
+ * @param refreshToken - JWT refresh token (optional)
3012
3545
  */
3013
- filterHeaders(headers) {
3014
- if (!headers) return {};
3015
- const filtered = {};
3016
- Object.keys(headers).forEach((key) => {
3017
- const lowerKey = key.toLowerCase();
3018
- if (SENSITIVE_HEADERS3.includes(lowerKey)) {
3019
- filtered[key] = "***";
3020
- } else {
3021
- filtered[key] = headers[key] || "";
3022
- }
3023
- });
3024
- return filtered;
3025
- }
3026
- /**
3027
- * Log request
3028
- */
3029
- logRequest(request) {
3030
- if (!this.config.enabled || !this.config.logRequests) return;
3031
- const { method, url, headers, body } = request;
3032
- this.consola.start(`${method} ${url}`);
3033
- if (this.config.logHeaders && headers) {
3034
- this.consola.debug("Headers:", this.filterHeaders(headers));
3035
- }
3036
- if (this.config.logBodies && body) {
3037
- this.consola.debug("Body:", body);
3546
+ setToken(token, refreshToken) {
3547
+ this._token = token;
3548
+ this.storage.setItem(TOKEN_KEY2, token);
3549
+ if (refreshToken) {
3550
+ this._refreshToken = refreshToken;
3551
+ this.storage.setItem(REFRESH_TOKEN_KEY2, refreshToken);
3038
3552
  }
3553
+ this._reinitClients();
3039
3554
  }
3040
3555
  /**
3041
- * Log response
3556
+ * Clear all tokens
3042
3557
  */
3043
- logResponse(request, response) {
3044
- if (!this.config.enabled || !this.config.logResponses) return;
3045
- const { method, url } = request;
3046
- const { status, statusText, data, duration } = response;
3047
- const statusColor = status >= 500 ? "red" : status >= 400 ? "yellow" : status >= 300 ? "cyan" : "green";
3048
- this.consola.success(
3049
- `${method} ${url} ${status} ${statusText} (${duration}ms)`
3050
- );
3051
- if (this.config.logBodies && data) {
3052
- this.consola.debug("Response:", data);
3053
- }
3558
+ clearTokens() {
3559
+ this._token = null;
3560
+ this._refreshToken = null;
3561
+ this.storage.removeItem(TOKEN_KEY2);
3562
+ this.storage.removeItem(REFRESH_TOKEN_KEY2);
3563
+ this._reinitClients();
3054
3564
  }
3055
3565
  /**
3056
- * Log error
3566
+ * Check if user is authenticated
3057
3567
  */
3058
- logError(request, error) {
3059
- if (!this.config.enabled || !this.config.logErrors) return;
3060
- const { method, url } = request;
3061
- const { message, statusCode, fieldErrors, duration } = error;
3062
- this.consola.error(
3063
- `${method} ${url} ${statusCode || "Network"} Error (${duration}ms)`
3064
- );
3065
- this.consola.error("Message:", message);
3066
- if (fieldErrors && Object.keys(fieldErrors).length > 0) {
3067
- this.consola.error("Field Errors:");
3068
- Object.entries(fieldErrors).forEach(([field, errors]) => {
3069
- errors.forEach((err) => {
3070
- this.consola.error(` \u2022 ${field}: ${err}`);
3071
- });
3072
- });
3073
- }
3568
+ isAuthenticated() {
3569
+ return !!this.getToken();
3074
3570
  }
3075
3571
  /**
3076
- * Log general info
3572
+ * Update base URL and reinitialize clients
3573
+ * @param url - New base URL
3077
3574
  */
3078
- info(message, ...args) {
3079
- if (!this.config.enabled) return;
3080
- this.consola.info(message, ...args);
3575
+ setBaseUrl(url) {
3576
+ this.baseUrl = url;
3577
+ this._reinitClients();
3081
3578
  }
3082
3579
  /**
3083
- * Log warning
3580
+ * Get current base URL
3084
3581
  */
3085
- warn(message, ...args) {
3086
- if (!this.config.enabled) return;
3087
- this.consola.warn(message, ...args);
3582
+ getBaseUrl() {
3583
+ return this.baseUrl;
3088
3584
  }
3089
3585
  /**
3090
- * Log error
3586
+ * Get OpenAPI schema path
3587
+ * @returns Path to the OpenAPI schema JSON file
3588
+ *
3589
+ * Note: The OpenAPI schema is available in the schema.json file.
3590
+ * You can load it dynamically using:
3591
+ * ```typescript
3592
+ * const schema = await fetch('./schema.json').then(r => r.json());
3593
+ * // or using fs in Node.js:
3594
+ * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));
3595
+ * ```
3091
3596
  */
3092
- error(message, ...args) {
3093
- if (!this.config.enabled) return;
3094
- this.consola.error(message, ...args);
3597
+ getSchemaPath() {
3598
+ return "./schema.json";
3599
+ }
3600
+ };
3601
+
3602
+ // src/generated/cfg_webpush/webpush__web_push/client.ts
3603
+ var WebPush = class {
3604
+ static {
3605
+ __name(this, "WebPush");
3606
+ }
3607
+ constructor(client) {
3608
+ this.client = client;
3095
3609
  }
3096
3610
  /**
3097
- * Log debug
3611
+ * Send push notification
3612
+ *
3613
+ * Send push notification to all active subscriptions for the authenticated
3614
+ * user.
3098
3615
  */
3099
- debug(message, ...args) {
3100
- if (!this.config.enabled) return;
3101
- this.consola.debug(message, ...args);
3616
+ async webpushSendCreate(data) {
3617
+ const response = await this.client.request("POST", "/cfg/webpush/send/", { body: data });
3618
+ return response;
3102
3619
  }
3103
3620
  /**
3104
- * Log success
3621
+ * Subscribe to push notifications
3622
+ *
3623
+ * Save push subscription from browser for the authenticated user.
3105
3624
  */
3106
- success(message, ...args) {
3107
- if (!this.config.enabled) return;
3108
- this.consola.success(message, ...args);
3625
+ async webpushSubscribeCreate(data) {
3626
+ const response = await this.client.request("POST", "/cfg/webpush/subscribe/", { body: data });
3627
+ return response;
3109
3628
  }
3110
3629
  /**
3111
- * Create a sub-logger with prefix
3630
+ * Get VAPID public key
3631
+ *
3632
+ * Get VAPID public key for client subscription.
3112
3633
  */
3113
- withTag(tag) {
3114
- return this.consola.withTag(tag);
3634
+ async webpushVapidRetrieve() {
3635
+ const response = await this.client.request("GET", "/cfg/webpush/vapid/");
3636
+ return response;
3115
3637
  }
3116
3638
  };
3117
- var defaultLogger3 = new APILogger3();
3118
3639
 
3119
- // src/generated/cfg_centrifugo/retry.ts
3120
- import pRetry3, { AbortError as AbortError3 } from "p-retry";
3121
- var DEFAULT_RETRY_CONFIG3 = {
3122
- retries: 3,
3123
- factor: 2,
3124
- minTimeout: 1e3,
3125
- maxTimeout: 6e4,
3126
- randomize: true,
3127
- onFailedAttempt: /* @__PURE__ */ __name(() => {
3128
- }, "onFailedAttempt")
3129
- };
3130
- function shouldRetry3(error) {
3131
- if (error instanceof NetworkError3) {
3132
- return true;
3133
- }
3134
- if (error instanceof APIError3) {
3135
- const status = error.statusCode;
3136
- if (status >= 500 && status < 600) {
3137
- return true;
3138
- }
3139
- if (status === 429) {
3140
- return true;
3141
- }
3142
- return false;
3640
+ // src/generated/cfg_webpush/http.ts
3641
+ var FetchAdapter3 = class {
3642
+ static {
3643
+ __name(this, "FetchAdapter");
3143
3644
  }
3144
- return true;
3145
- }
3146
- __name(shouldRetry3, "shouldRetry");
3147
- async function withRetry3(fn, config) {
3148
- const finalConfig = { ...DEFAULT_RETRY_CONFIG3, ...config };
3149
- return pRetry3(
3150
- async () => {
3151
- try {
3152
- return await fn();
3153
- } catch (error) {
3154
- if (!shouldRetry3(error)) {
3155
- throw new AbortError3(error);
3645
+ async request(request) {
3646
+ const { method, url, headers, body, params, formData } = request;
3647
+ let finalUrl = url;
3648
+ if (params) {
3649
+ const searchParams = new URLSearchParams();
3650
+ Object.entries(params).forEach(([key, value]) => {
3651
+ if (value !== null && value !== void 0) {
3652
+ searchParams.append(key, String(value));
3156
3653
  }
3157
- throw error;
3654
+ });
3655
+ const queryString = searchParams.toString();
3656
+ if (queryString) {
3657
+ finalUrl = url.includes("?") ? `${url}&${queryString}` : `${url}?${queryString}`;
3158
3658
  }
3159
- },
3160
- {
3161
- retries: finalConfig.retries,
3162
- factor: finalConfig.factor,
3163
- minTimeout: finalConfig.minTimeout,
3164
- maxTimeout: finalConfig.maxTimeout,
3165
- randomize: finalConfig.randomize,
3166
- onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {
3167
- const pRetryError = error;
3168
- finalConfig.onFailedAttempt({
3169
- error: pRetryError,
3170
- attemptNumber: pRetryError.attemptNumber,
3171
- retriesLeft: pRetryError.retriesLeft
3172
- });
3173
- } : void 0
3174
3659
  }
3175
- );
3176
- }
3177
- __name(withRetry3, "withRetry");
3178
-
3179
- // src/generated/cfg_centrifugo/client.ts
3180
- var APIClient3 = class {
3181
- constructor(baseUrl, options) {
3182
- this.logger = null;
3183
- this.retryConfig = null;
3184
- this.baseUrl = baseUrl.replace(/\/$/, "");
3185
- this.httpClient = options?.httpClient || new FetchAdapter3();
3186
- if (options?.loggerConfig !== void 0) {
3187
- this.logger = new APILogger3(options.loggerConfig);
3660
+ const finalHeaders = { ...headers };
3661
+ let requestBody;
3662
+ if (formData) {
3663
+ requestBody = formData;
3664
+ } else if (body) {
3665
+ finalHeaders["Content-Type"] = "application/json";
3666
+ requestBody = JSON.stringify(body);
3188
3667
  }
3189
- if (options?.retryConfig !== void 0) {
3190
- this.retryConfig = options.retryConfig;
3668
+ const response = await fetch(finalUrl, {
3669
+ method,
3670
+ headers: finalHeaders,
3671
+ body: requestBody,
3672
+ credentials: "include"
3673
+ // Include Django session cookies
3674
+ });
3675
+ let data = null;
3676
+ const contentType = response.headers.get("content-type");
3677
+ if (response.status !== 204 && contentType?.includes("application/json")) {
3678
+ data = await response.json();
3679
+ } else if (response.status !== 204) {
3680
+ data = await response.text();
3191
3681
  }
3192
- this.centrifugo_admin_api = new CentrifugoAdminApi(this);
3193
- this.centrifugo_auth = new CentrifugoAuth(this);
3194
- this.centrifugo_monitoring = new CentrifugoMonitoring(this);
3195
- this.centrifugo_testing = new CentrifugoTesting(this);
3196
- }
3197
- static {
3198
- __name(this, "APIClient");
3199
- }
3200
- /**
3201
- * Get CSRF token from cookies (for SessionAuthentication).
3202
- *
3203
- * Returns null if cookie doesn't exist (JWT-only auth).
3204
- */
3205
- getCsrfToken() {
3206
- const name = "csrftoken";
3207
- const value = `; ${document.cookie}`;
3208
- const parts = value.split(`; ${name}=`);
3209
- if (parts.length === 2) {
3210
- return parts.pop()?.split(";").shift() || null;
3211
- }
3212
- return null;
3213
- }
3214
- /**
3215
- * Make HTTP request with Django CSRF and session handling.
3216
- * Automatically retries on network errors and 5xx server errors.
3217
- */
3218
- async request(method, path, options) {
3219
- if (this.retryConfig) {
3220
- return withRetry3(() => this._makeRequest(method, path, options), {
3221
- ...this.retryConfig,
3222
- onFailedAttempt: /* @__PURE__ */ __name((info) => {
3223
- if (this.logger) {
3224
- this.logger.warn(
3225
- `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} for ${method} ${path}: ${info.error.message}`
3226
- );
3227
- }
3228
- this.retryConfig?.onFailedAttempt?.(info);
3229
- }, "onFailedAttempt")
3230
- });
3231
- }
3232
- return this._makeRequest(method, path, options);
3233
- }
3234
- /**
3235
- * Internal request method (without retry wrapper).
3236
- * Used by request() method with optional retry logic.
3237
- */
3238
- async _makeRequest(method, path, options) {
3239
- const url = this.baseUrl ? `${this.baseUrl}${path}` : path;
3240
- const startTime = Date.now();
3241
- const headers = {
3242
- ...options?.headers || {}
3682
+ const responseHeaders = {};
3683
+ response.headers.forEach((value, key) => {
3684
+ responseHeaders[key] = value;
3685
+ });
3686
+ return {
3687
+ data,
3688
+ status: response.status,
3689
+ statusText: response.statusText,
3690
+ headers: responseHeaders
3243
3691
  };
3244
- if (!options?.formData && !headers["Content-Type"]) {
3245
- headers["Content-Type"] = "application/json";
3246
- }
3247
- if (this.logger) {
3248
- this.logger.logRequest({
3249
- method,
3250
- url,
3251
- headers,
3252
- body: options?.formData || options?.body,
3253
- timestamp: startTime
3254
- });
3255
- }
3256
- try {
3257
- const response = await this.httpClient.request({
3258
- method,
3259
- url,
3260
- headers,
3261
- params: options?.params,
3262
- body: options?.body,
3263
- formData: options?.formData
3264
- });
3265
- const duration = Date.now() - startTime;
3266
- if (response.status >= 400) {
3267
- const error = new APIError3(
3268
- response.status,
3269
- response.statusText,
3270
- response.data,
3271
- url
3272
- );
3273
- if (this.logger) {
3274
- this.logger.logError(
3275
- {
3276
- method,
3277
- url,
3278
- headers,
3279
- body: options?.formData || options?.body,
3280
- timestamp: startTime
3281
- },
3282
- {
3283
- message: error.message,
3284
- statusCode: response.status,
3285
- duration,
3286
- timestamp: Date.now()
3287
- }
3288
- );
3289
- }
3290
- throw error;
3291
- }
3292
- if (this.logger) {
3293
- this.logger.logResponse(
3294
- {
3295
- method,
3296
- url,
3297
- headers,
3298
- body: options?.formData || options?.body,
3299
- timestamp: startTime
3300
- },
3301
- {
3302
- status: response.status,
3303
- statusText: response.statusText,
3304
- data: response.data,
3305
- duration,
3306
- timestamp: Date.now()
3307
- }
3308
- );
3309
- }
3310
- return response.data;
3311
- } catch (error) {
3312
- const duration = Date.now() - startTime;
3313
- if (error instanceof APIError3) {
3314
- throw error;
3315
- }
3316
- const isCORSError = error instanceof TypeError && (error.message.toLowerCase().includes("cors") || error.message.toLowerCase().includes("failed to fetch") || error.message.toLowerCase().includes("network request failed"));
3317
- if (this.logger) {
3318
- if (isCORSError) {
3319
- this.logger.error(`\u{1F6AB} CORS Error: ${method} ${url}`);
3320
- this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
3321
- this.logger.error(` \u2192 Configure security_domains parameter on the server`);
3322
- } else {
3323
- this.logger.error(`\u26A0\uFE0F Network Error: ${method} ${url}`);
3324
- this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
3325
- }
3326
- }
3327
- if (typeof window !== "undefined") {
3328
- try {
3329
- if (isCORSError) {
3330
- window.dispatchEvent(new CustomEvent("cors-error", {
3331
- detail: {
3332
- url,
3333
- method,
3334
- error: error instanceof Error ? error.message : String(error),
3335
- timestamp: /* @__PURE__ */ new Date()
3336
- },
3337
- bubbles: true,
3338
- cancelable: false
3339
- }));
3340
- } else {
3341
- window.dispatchEvent(new CustomEvent("network-error", {
3342
- detail: {
3343
- url,
3344
- method,
3345
- error: error instanceof Error ? error.message : String(error),
3346
- timestamp: /* @__PURE__ */ new Date()
3347
- },
3348
- bubbles: true,
3349
- cancelable: false
3350
- }));
3351
- }
3352
- } catch (eventError) {
3353
- }
3354
- }
3355
- const networkError = error instanceof Error ? new NetworkError3(error.message, url, error) : new NetworkError3("Unknown error", url);
3356
- if (this.logger) {
3357
- this.logger.logError(
3358
- {
3359
- method,
3360
- url,
3361
- headers,
3362
- body: options?.formData || options?.body,
3363
- timestamp: startTime
3364
- },
3365
- {
3366
- message: networkError.message,
3367
- duration,
3368
- timestamp: Date.now()
3369
- }
3370
- );
3371
- }
3372
- throw networkError;
3373
- }
3374
3692
  }
3375
3693
  };
3376
-
3377
- // src/generated/cfg_centrifugo/storage.ts
3378
- var LocalStorageAdapter3 = class {
3379
- static {
3380
- __name(this, "LocalStorageAdapter");
3381
- }
3382
- constructor(logger) {
3383
- this.logger = logger;
3384
- }
3385
- getItem(key) {
3386
- try {
3387
- if (typeof window !== "undefined" && window.localStorage) {
3388
- const value = localStorage.getItem(key);
3389
- this.logger?.debug(`LocalStorage.getItem("${key}"): ${value ? "found" : "not found"}`);
3390
- return value;
3391
- }
3392
- this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
3393
- } catch (error) {
3394
- this.logger?.error("LocalStorage.getItem failed:", error);
3395
- }
3396
- return null;
3397
- }
3398
- setItem(key, value) {
3399
- try {
3400
- if (typeof window !== "undefined" && window.localStorage) {
3401
- localStorage.setItem(key, value);
3402
- this.logger?.debug(`LocalStorage.setItem("${key}"): success`);
3403
- } else {
3404
- this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
3405
- }
3406
- } catch (error) {
3407
- this.logger?.error("LocalStorage.setItem failed:", error);
3408
- }
3409
- }
3410
- removeItem(key) {
3411
- try {
3412
- if (typeof window !== "undefined" && window.localStorage) {
3413
- localStorage.removeItem(key);
3414
- this.logger?.debug(`LocalStorage.removeItem("${key}"): success`);
3415
- } else {
3416
- this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
3417
- }
3418
- } catch (error) {
3419
- this.logger?.error("LocalStorage.removeItem failed:", error);
3420
- }
3421
- }
3422
- };
3423
-
3424
- // src/generated/cfg_centrifugo/_utils/schemas/index.ts
3425
- var schemas_exports3 = {};
3426
- __export(schemas_exports3, {
3427
- CentrifugoChannelInfoSchema: () => CentrifugoChannelInfoSchema,
3428
- CentrifugoChannelsRequestRequestSchema: () => CentrifugoChannelsRequestRequestSchema,
3429
- CentrifugoChannelsResponseSchema: () => CentrifugoChannelsResponseSchema,
3430
- CentrifugoChannelsResultSchema: () => CentrifugoChannelsResultSchema,
3431
- CentrifugoClientInfoSchema: () => CentrifugoClientInfoSchema,
3432
- CentrifugoErrorSchema: () => CentrifugoErrorSchema,
3433
- CentrifugoHealthCheckSchema: () => CentrifugoHealthCheckSchema,
3434
- CentrifugoHistoryRequestRequestSchema: () => CentrifugoHistoryRequestRequestSchema,
3435
- CentrifugoHistoryResponseSchema: () => CentrifugoHistoryResponseSchema,
3436
- CentrifugoHistoryResultSchema: () => CentrifugoHistoryResultSchema,
3437
- CentrifugoInfoResponseSchema: () => CentrifugoInfoResponseSchema,
3438
- CentrifugoInfoResultSchema: () => CentrifugoInfoResultSchema,
3439
- CentrifugoMetricsSchema: () => CentrifugoMetricsSchema,
3440
- CentrifugoNodeInfoSchema: () => CentrifugoNodeInfoSchema,
3441
- CentrifugoOverviewStatsSchema: () => CentrifugoOverviewStatsSchema,
3442
- CentrifugoPresenceRequestRequestSchema: () => CentrifugoPresenceRequestRequestSchema,
3443
- CentrifugoPresenceResponseSchema: () => CentrifugoPresenceResponseSchema,
3444
- CentrifugoPresenceResultSchema: () => CentrifugoPresenceResultSchema,
3445
- CentrifugoPresenceStatsRequestRequestSchema: () => CentrifugoPresenceStatsRequestRequestSchema,
3446
- CentrifugoPresenceStatsResponseSchema: () => CentrifugoPresenceStatsResponseSchema,
3447
- CentrifugoPresenceStatsResultSchema: () => CentrifugoPresenceStatsResultSchema,
3448
- CentrifugoProcessSchema: () => CentrifugoProcessSchema,
3449
- CentrifugoPublicationSchema: () => CentrifugoPublicationSchema,
3450
- CentrifugoStreamPositionSchema: () => CentrifugoStreamPositionSchema,
3451
- ChannelListSchema: () => ChannelListSchema,
3452
- ChannelStatsSchema: () => ChannelStatsSchema,
3453
- ConnectionTokenResponseSchema: () => ConnectionTokenResponseSchema,
3454
- ManualAckRequestRequestSchema: () => ManualAckRequestRequestSchema,
3455
- ManualAckResponseSchema: () => ManualAckResponseSchema,
3456
- PaginatedPublishListSchema: () => PaginatedPublishListSchema,
3457
- PublishSchema: () => PublishSchema,
3458
- PublishTestRequestRequestSchema: () => PublishTestRequestRequestSchema,
3459
- PublishTestResponseSchema: () => PublishTestResponseSchema,
3460
- TimelineItemSchema: () => TimelineItemSchema,
3461
- TimelineResponseSchema: () => TimelineResponseSchema
3462
- });
3463
-
3464
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelInfo.schema.ts
3465
- import { z as z25 } from "zod";
3466
- var CentrifugoChannelInfoSchema = z25.object({
3467
- num_clients: z25.int()
3468
- });
3469
-
3470
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts
3471
- import { z as z26 } from "zod";
3472
- var CentrifugoChannelsRequestRequestSchema = z26.object({
3473
- pattern: z26.string().nullable().optional()
3474
- });
3475
-
3476
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResponse.schema.ts
3477
- import { z as z29 } from "zod";
3478
-
3479
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResult.schema.ts
3480
- import { z as z27 } from "zod";
3481
- var CentrifugoChannelsResultSchema = z27.object({
3482
- channels: z27.record(z27.string(), CentrifugoChannelInfoSchema)
3483
- });
3484
-
3485
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoError.schema.ts
3486
- import { z as z28 } from "zod";
3487
- var CentrifugoErrorSchema = z28.object({
3488
- code: z28.int().optional(),
3489
- message: z28.string().optional()
3490
- });
3491
-
3492
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResponse.schema.ts
3493
- var CentrifugoChannelsResponseSchema = z29.object({
3494
- error: CentrifugoErrorSchema.optional(),
3495
- result: CentrifugoChannelsResultSchema.optional()
3496
- });
3497
-
3498
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoClientInfo.schema.ts
3499
- import { z as z30 } from "zod";
3500
- var CentrifugoClientInfoSchema = z30.object({
3501
- user: z30.string(),
3502
- client: z30.string(),
3503
- conn_info: z30.record(z30.string(), z30.any()).nullable().optional(),
3504
- chan_info: z30.record(z30.string(), z30.any()).nullable().optional()
3505
- });
3506
-
3507
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHealthCheck.schema.ts
3508
- import { z as z31 } from "zod";
3509
- var CentrifugoHealthCheckSchema = z31.object({
3510
- status: z31.string(),
3511
- wrapper_url: z31.string(),
3512
- has_api_key: z31.boolean(),
3513
- timestamp: z31.string()
3514
- });
3515
-
3516
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts
3517
- import { z as z33 } from "zod";
3518
-
3519
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoStreamPosition.schema.ts
3520
- import { z as z32 } from "zod";
3521
- var CentrifugoStreamPositionSchema = z32.object({
3522
- offset: z32.int(),
3523
- epoch: z32.string()
3524
- });
3525
-
3526
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts
3527
- var CentrifugoHistoryRequestRequestSchema = z33.object({
3528
- channel: z33.string(),
3529
- limit: z33.int().nullable().optional(),
3530
- since: CentrifugoStreamPositionSchema.optional(),
3531
- reverse: z33.boolean().nullable().optional()
3532
- });
3533
-
3534
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResponse.schema.ts
3535
- import { z as z36 } from "zod";
3536
-
3537
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResult.schema.ts
3538
- import { z as z35 } from "zod";
3539
-
3540
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPublication.schema.ts
3541
- import { z as z34 } from "zod";
3542
- var CentrifugoPublicationSchema = z34.object({
3543
- data: z34.record(z34.string(), z34.any()),
3544
- info: CentrifugoClientInfoSchema.optional(),
3545
- offset: z34.int(),
3546
- tags: z34.record(z34.string(), z34.any()).nullable().optional()
3547
- });
3548
-
3549
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResult.schema.ts
3550
- var CentrifugoHistoryResultSchema = z35.object({
3551
- publications: z35.array(CentrifugoPublicationSchema),
3552
- epoch: z35.string(),
3553
- offset: z35.int()
3554
- });
3555
-
3556
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResponse.schema.ts
3557
- var CentrifugoHistoryResponseSchema = z36.object({
3558
- error: CentrifugoErrorSchema.optional(),
3559
- result: CentrifugoHistoryResultSchema.optional()
3560
- });
3561
-
3562
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResponse.schema.ts
3563
- import { z as z41 } from "zod";
3564
-
3565
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResult.schema.ts
3566
- import { z as z40 } from "zod";
3567
-
3568
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoNodeInfo.schema.ts
3569
- import { z as z39 } from "zod";
3570
-
3571
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoMetrics.schema.ts
3572
- import { z as z37 } from "zod";
3573
- var CentrifugoMetricsSchema = z37.object({
3574
- interval: z37.number(),
3575
- items: z37.record(z37.string(), z37.number())
3576
- });
3577
-
3578
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoProcess.schema.ts
3579
- import { z as z38 } from "zod";
3580
- var CentrifugoProcessSchema = z38.object({
3581
- cpu: z38.number(),
3582
- rss: z38.int()
3583
- });
3584
-
3585
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoNodeInfo.schema.ts
3586
- var CentrifugoNodeInfoSchema = z39.object({
3587
- uid: z39.string(),
3588
- name: z39.string(),
3589
- version: z39.string(),
3590
- num_clients: z39.int(),
3591
- num_users: z39.int(),
3592
- num_channels: z39.int(),
3593
- uptime: z39.int(),
3594
- num_subs: z39.int(),
3595
- metrics: CentrifugoMetricsSchema.optional(),
3596
- process: CentrifugoProcessSchema.optional()
3597
- });
3598
-
3599
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResult.schema.ts
3600
- var CentrifugoInfoResultSchema = z40.object({
3601
- nodes: z40.array(CentrifugoNodeInfoSchema)
3602
- });
3603
-
3604
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResponse.schema.ts
3605
- var CentrifugoInfoResponseSchema = z41.object({
3606
- error: CentrifugoErrorSchema.optional(),
3607
- result: CentrifugoInfoResultSchema.optional()
3608
- });
3609
-
3610
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoOverviewStats.schema.ts
3611
- import { z as z42 } from "zod";
3612
- var CentrifugoOverviewStatsSchema = z42.object({
3613
- total: z42.int(),
3614
- successful: z42.int(),
3615
- failed: z42.int(),
3616
- timeout: z42.int(),
3617
- success_rate: z42.number(),
3618
- avg_duration_ms: z42.number(),
3619
- avg_acks_received: z42.number(),
3620
- period_hours: z42.int()
3621
- });
3622
-
3623
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceRequestRequest.schema.ts
3624
- import { z as z43 } from "zod";
3625
- var CentrifugoPresenceRequestRequestSchema = z43.object({
3626
- channel: z43.string()
3627
- });
3628
-
3629
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResponse.schema.ts
3630
- import { z as z45 } from "zod";
3631
-
3632
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResult.schema.ts
3633
- import { z as z44 } from "zod";
3634
- var CentrifugoPresenceResultSchema = z44.object({
3635
- presence: z44.record(z44.string(), CentrifugoClientInfoSchema)
3636
- });
3637
-
3638
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResponse.schema.ts
3639
- var CentrifugoPresenceResponseSchema = z45.object({
3640
- error: CentrifugoErrorSchema.optional(),
3641
- result: CentrifugoPresenceResultSchema.optional()
3642
- });
3643
-
3644
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsRequestRequest.schema.ts
3645
- import { z as z46 } from "zod";
3646
- var CentrifugoPresenceStatsRequestRequestSchema = z46.object({
3647
- channel: z46.string()
3648
- });
3649
-
3650
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts
3651
- import { z as z48 } from "zod";
3652
-
3653
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResult.schema.ts
3654
- import { z as z47 } from "zod";
3655
- var CentrifugoPresenceStatsResultSchema = z47.object({
3656
- num_clients: z47.int(),
3657
- num_users: z47.int()
3658
- });
3659
-
3660
- // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts
3661
- var CentrifugoPresenceStatsResponseSchema = z48.object({
3662
- error: CentrifugoErrorSchema.optional(),
3663
- result: CentrifugoPresenceStatsResultSchema.optional()
3664
- });
3665
-
3666
- // src/generated/cfg_centrifugo/_utils/schemas/ChannelList.schema.ts
3667
- import { z as z50 } from "zod";
3668
-
3669
- // src/generated/cfg_centrifugo/_utils/schemas/ChannelStats.schema.ts
3670
- import { z as z49 } from "zod";
3671
- var ChannelStatsSchema = z49.object({
3672
- channel: z49.string(),
3673
- total: z49.int(),
3674
- successful: z49.int(),
3675
- failed: z49.int(),
3676
- avg_duration_ms: z49.number(),
3677
- avg_acks: z49.number(),
3678
- last_activity_at: z49.string().nullable()
3679
- });
3680
-
3681
- // src/generated/cfg_centrifugo/_utils/schemas/ChannelList.schema.ts
3682
- var ChannelListSchema = z50.object({
3683
- channels: z50.array(ChannelStatsSchema),
3684
- total_channels: z50.int()
3685
- });
3686
-
3687
- // src/generated/cfg_centrifugo/_utils/schemas/ConnectionTokenResponse.schema.ts
3688
- import { z as z51 } from "zod";
3689
- var ConnectionTokenResponseSchema = z51.object({
3690
- token: z51.string(),
3691
- centrifugo_url: z51.string(),
3692
- expires_at: z51.string(),
3693
- channels: z51.array(z51.string())
3694
- });
3695
-
3696
- // src/generated/cfg_centrifugo/_utils/schemas/ManualAckRequestRequest.schema.ts
3697
- import { z as z52 } from "zod";
3698
- var ManualAckRequestRequestSchema = z52.object({
3699
- message_id: z52.string(),
3700
- client_id: z52.string()
3701
- });
3702
-
3703
- // src/generated/cfg_centrifugo/_utils/schemas/ManualAckResponse.schema.ts
3704
- import { z as z53 } from "zod";
3705
- var ManualAckResponseSchema = z53.object({
3706
- success: z53.boolean(),
3707
- message_id: z53.string(),
3708
- error: z53.string().nullable().optional()
3709
- });
3710
-
3711
- // src/generated/cfg_centrifugo/_utils/schemas/PaginatedPublishList.schema.ts
3712
- import { z as z55 } from "zod";
3713
-
3714
- // src/generated/cfg_centrifugo/_utils/schemas/Publish.schema.ts
3715
- import { z as z54 } from "zod";
3716
- var PublishSchema = z54.object({
3717
- message_id: z54.string(),
3718
- channel: z54.string(),
3719
- status: z54.string(),
3720
- wait_for_ack: z54.boolean(),
3721
- acks_received: z54.int(),
3722
- acks_expected: z54.int().nullable(),
3723
- duration_ms: z54.number().nullable(),
3724
- created_at: z54.iso.datetime(),
3725
- completed_at: z54.iso.datetime().nullable(),
3726
- error_code: z54.string().nullable(),
3727
- error_message: z54.string().nullable()
3728
- });
3729
-
3730
- // src/generated/cfg_centrifugo/_utils/schemas/PaginatedPublishList.schema.ts
3731
- var PaginatedPublishListSchema = z55.object({
3732
- count: z55.int(),
3733
- page: z55.int(),
3734
- pages: z55.int(),
3735
- page_size: z55.int(),
3736
- has_next: z55.boolean(),
3737
- has_previous: z55.boolean(),
3738
- next_page: z55.int().nullable().optional(),
3739
- previous_page: z55.int().nullable().optional(),
3740
- results: z55.array(PublishSchema)
3741
- });
3742
-
3743
- // src/generated/cfg_centrifugo/_utils/schemas/PublishTestRequestRequest.schema.ts
3744
- import { z as z56 } from "zod";
3745
- var PublishTestRequestRequestSchema = z56.object({
3746
- channel: z56.string(),
3747
- data: z56.record(z56.string(), z56.any()),
3748
- wait_for_ack: z56.boolean().optional(),
3749
- ack_timeout: z56.int().min(1).max(60).optional()
3750
- });
3751
-
3752
- // src/generated/cfg_centrifugo/_utils/schemas/PublishTestResponse.schema.ts
3753
- import { z as z57 } from "zod";
3754
- var PublishTestResponseSchema = z57.object({
3755
- success: z57.boolean(),
3756
- message_id: z57.string(),
3757
- channel: z57.string(),
3758
- acks_received: z57.int().optional(),
3759
- delivered: z57.boolean().optional(),
3760
- error: z57.string().nullable().optional()
3761
- });
3762
-
3763
- // src/generated/cfg_centrifugo/_utils/schemas/TimelineItem.schema.ts
3764
- import { z as z58 } from "zod";
3765
- var TimelineItemSchema = z58.object({
3766
- timestamp: z58.string(),
3767
- count: z58.int(),
3768
- successful: z58.int(),
3769
- failed: z58.int(),
3770
- timeout: z58.int()
3771
- });
3772
-
3773
- // src/generated/cfg_centrifugo/_utils/schemas/TimelineResponse.schema.ts
3774
- import { z as z59 } from "zod";
3775
- var TimelineResponseSchema = z59.object({
3776
- timeline: z59.array(TimelineItemSchema),
3777
- period_hours: z59.int(),
3778
- interval: z59.string()
3779
- });
3780
-
3781
- // src/generated/cfg_centrifugo/_utils/fetchers/index.ts
3782
- var fetchers_exports3 = {};
3783
- __export(fetchers_exports3, {
3784
- createCentrifugoServerAuthTokenCreate: () => createCentrifugoServerAuthTokenCreate,
3785
- createCentrifugoServerChannelsCreate: () => createCentrifugoServerChannelsCreate,
3786
- createCentrifugoServerHistoryCreate: () => createCentrifugoServerHistoryCreate,
3787
- createCentrifugoServerInfoCreate: () => createCentrifugoServerInfoCreate,
3788
- createCentrifugoServerPresenceCreate: () => createCentrifugoServerPresenceCreate,
3789
- createCentrifugoServerPresenceStatsCreate: () => createCentrifugoServerPresenceStatsCreate,
3790
- createCentrifugoTestingPublishTestCreate: () => createCentrifugoTestingPublishTestCreate,
3791
- createCentrifugoTestingPublishWithLoggingCreate: () => createCentrifugoTestingPublishWithLoggingCreate,
3792
- createCentrifugoTestingSendAckCreate: () => createCentrifugoTestingSendAckCreate,
3793
- getCentrifugoAuthTokenRetrieve: () => getCentrifugoAuthTokenRetrieve,
3794
- getCentrifugoMonitorChannelsRetrieve: () => getCentrifugoMonitorChannelsRetrieve,
3795
- getCentrifugoMonitorHealthRetrieve: () => getCentrifugoMonitorHealthRetrieve,
3796
- getCentrifugoMonitorOverviewRetrieve: () => getCentrifugoMonitorOverviewRetrieve,
3797
- getCentrifugoMonitorPublishesList: () => getCentrifugoMonitorPublishesList,
3798
- getCentrifugoMonitorTimelineRetrieve: () => getCentrifugoMonitorTimelineRetrieve
3799
- });
3800
-
3801
- // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts
3802
- import { consola as consola6 } from "consola";
3803
-
3804
- // src/generated/cfg_centrifugo/api-instance.ts
3805
- var globalAPI3 = null;
3806
- function getAPIInstance3() {
3807
- if (!globalAPI3) {
3808
- throw new Error(
3809
- 'API not configured. Call configureAPI() with your base URL before using fetchers or hooks.\n\nExample:\n import { configureAPI } from "./api-instance"\n configureAPI({ baseUrl: "https://api.example.com" })'
3810
- );
3811
- }
3812
- return globalAPI3;
3813
- }
3814
- __name(getAPIInstance3, "getAPIInstance");
3815
-
3816
- // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts
3817
- async function createCentrifugoServerAuthTokenCreate(client) {
3818
- const api = client || getAPIInstance3();
3819
- const response = await api.centrifugo_admin_api.centrifugoServerAuthTokenCreate();
3820
- return response;
3821
- }
3822
- __name(createCentrifugoServerAuthTokenCreate, "createCentrifugoServerAuthTokenCreate");
3823
- async function createCentrifugoServerChannelsCreate(data, client) {
3824
- const api = client || getAPIInstance3();
3825
- const response = await api.centrifugo_admin_api.centrifugoServerChannelsCreate(data);
3826
- try {
3827
- return CentrifugoChannelsResponseSchema.parse(response);
3828
- } catch (error) {
3829
- consola6.error("\u274C Zod Validation Failed");
3830
- consola6.box(`createCentrifugoServerChannelsCreate
3831
- Path: /cfg/centrifugo/server/channels/
3832
- Method: POST`);
3833
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3834
- consola6.error("Validation Issues:");
3835
- error.issues.forEach((issue, index) => {
3836
- consola6.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3837
- consola6.error(` \u251C\u2500 Message: ${issue.message}`);
3838
- if (issue.expected) consola6.error(` \u251C\u2500 Expected: ${issue.expected}`);
3839
- if (issue.received) consola6.error(` \u2514\u2500 Received: ${issue.received}`);
3840
- });
3694
+
3695
+ // src/generated/cfg_webpush/errors.ts
3696
+ var APIError3 = class extends Error {
3697
+ constructor(statusCode, statusText, response, url, message) {
3698
+ super(message || `HTTP ${statusCode}: ${statusText}`);
3699
+ this.statusCode = statusCode;
3700
+ this.statusText = statusText;
3701
+ this.response = response;
3702
+ this.url = url;
3703
+ this.name = "APIError";
3704
+ }
3705
+ static {
3706
+ __name(this, "APIError");
3707
+ }
3708
+ /**
3709
+ * Get error details from response.
3710
+ * DRF typically returns: { "detail": "Error message" } or { "field": ["error1", "error2"] }
3711
+ */
3712
+ get details() {
3713
+ if (typeof this.response === "object" && this.response !== null) {
3714
+ return this.response;
3841
3715
  }
3842
- consola6.error("Response data:", response);
3843
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3844
- try {
3845
- const event = new CustomEvent("zod-validation-error", {
3846
- detail: {
3847
- operation: "createCentrifugoServerChannelsCreate",
3848
- path: "/cfg/centrifugo/server/channels/",
3849
- method: "POST",
3850
- error,
3851
- response,
3852
- timestamp: /* @__PURE__ */ new Date()
3853
- },
3854
- bubbles: true,
3855
- cancelable: false
3856
- });
3857
- window.dispatchEvent(event);
3858
- } catch (eventError) {
3859
- consola6.warn("Failed to dispatch validation error event:", eventError);
3716
+ return null;
3717
+ }
3718
+ /**
3719
+ * Get field-specific validation errors from DRF.
3720
+ * Returns: { "field_name": ["error1", "error2"], ... }
3721
+ */
3722
+ get fieldErrors() {
3723
+ const details = this.details;
3724
+ if (!details) return null;
3725
+ const fieldErrors = {};
3726
+ for (const [key, value] of Object.entries(details)) {
3727
+ if (Array.isArray(value)) {
3728
+ fieldErrors[key] = value;
3860
3729
  }
3861
3730
  }
3862
- throw error;
3731
+ return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
3863
3732
  }
3864
- }
3865
- __name(createCentrifugoServerChannelsCreate, "createCentrifugoServerChannelsCreate");
3866
- async function createCentrifugoServerHistoryCreate(data, client) {
3867
- const api = client || getAPIInstance3();
3868
- const response = await api.centrifugo_admin_api.centrifugoServerHistoryCreate(data);
3869
- try {
3870
- return CentrifugoHistoryResponseSchema.parse(response);
3871
- } catch (error) {
3872
- consola6.error("\u274C Zod Validation Failed");
3873
- consola6.box(`createCentrifugoServerHistoryCreate
3874
- Path: /cfg/centrifugo/server/history/
3875
- Method: POST`);
3876
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3877
- consola6.error("Validation Issues:");
3878
- error.issues.forEach((issue, index) => {
3879
- consola6.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3880
- consola6.error(` \u251C\u2500 Message: ${issue.message}`);
3881
- if (issue.expected) consola6.error(` \u251C\u2500 Expected: ${issue.expected}`);
3882
- if (issue.received) consola6.error(` \u2514\u2500 Received: ${issue.received}`);
3883
- });
3733
+ /**
3734
+ * Get single error message from DRF.
3735
+ * Checks for "detail", "message", or first field error.
3736
+ */
3737
+ get errorMessage() {
3738
+ const details = this.details;
3739
+ if (!details) return this.message;
3740
+ if (details.detail) {
3741
+ return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
3884
3742
  }
3885
- consola6.error("Response data:", response);
3886
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3887
- try {
3888
- const event = new CustomEvent("zod-validation-error", {
3889
- detail: {
3890
- operation: "createCentrifugoServerHistoryCreate",
3891
- path: "/cfg/centrifugo/server/history/",
3892
- method: "POST",
3893
- error,
3894
- response,
3895
- timestamp: /* @__PURE__ */ new Date()
3896
- },
3897
- bubbles: true,
3898
- cancelable: false
3899
- });
3900
- window.dispatchEvent(event);
3901
- } catch (eventError) {
3902
- consola6.warn("Failed to dispatch validation error event:", eventError);
3743
+ if (details.message) {
3744
+ return String(details.message);
3745
+ }
3746
+ const fieldErrors = this.fieldErrors;
3747
+ if (fieldErrors) {
3748
+ const firstField = Object.keys(fieldErrors)[0];
3749
+ if (firstField) {
3750
+ return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
3903
3751
  }
3904
3752
  }
3905
- throw error;
3753
+ return this.message;
3906
3754
  }
3907
- }
3908
- __name(createCentrifugoServerHistoryCreate, "createCentrifugoServerHistoryCreate");
3909
- async function createCentrifugoServerInfoCreate(client) {
3910
- const api = client || getAPIInstance3();
3911
- const response = await api.centrifugo_admin_api.centrifugoServerInfoCreate();
3912
- try {
3913
- return CentrifugoInfoResponseSchema.parse(response);
3914
- } catch (error) {
3915
- consola6.error("\u274C Zod Validation Failed");
3916
- consola6.box(`createCentrifugoServerInfoCreate
3917
- Path: /cfg/centrifugo/server/info/
3918
- Method: POST`);
3919
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3920
- consola6.error("Validation Issues:");
3921
- error.issues.forEach((issue, index) => {
3922
- consola6.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3923
- consola6.error(` \u251C\u2500 Message: ${issue.message}`);
3924
- if (issue.expected) consola6.error(` \u251C\u2500 Expected: ${issue.expected}`);
3925
- if (issue.received) consola6.error(` \u2514\u2500 Received: ${issue.received}`);
3926
- });
3927
- }
3928
- consola6.error("Response data:", response);
3929
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3930
- try {
3931
- const event = new CustomEvent("zod-validation-error", {
3932
- detail: {
3933
- operation: "createCentrifugoServerInfoCreate",
3934
- path: "/cfg/centrifugo/server/info/",
3935
- method: "POST",
3936
- error,
3937
- response,
3938
- timestamp: /* @__PURE__ */ new Date()
3939
- },
3940
- bubbles: true,
3941
- cancelable: false
3942
- });
3943
- window.dispatchEvent(event);
3944
- } catch (eventError) {
3945
- consola6.warn("Failed to dispatch validation error event:", eventError);
3755
+ // Helper methods for common HTTP status codes
3756
+ get isValidationError() {
3757
+ return this.statusCode === 400;
3758
+ }
3759
+ get isAuthError() {
3760
+ return this.statusCode === 401;
3761
+ }
3762
+ get isPermissionError() {
3763
+ return this.statusCode === 403;
3764
+ }
3765
+ get isNotFoundError() {
3766
+ return this.statusCode === 404;
3767
+ }
3768
+ get isServerError() {
3769
+ return this.statusCode >= 500 && this.statusCode < 600;
3770
+ }
3771
+ };
3772
+ var NetworkError3 = class extends Error {
3773
+ constructor(message, url, originalError) {
3774
+ super(message);
3775
+ this.url = url;
3776
+ this.originalError = originalError;
3777
+ this.name = "NetworkError";
3778
+ }
3779
+ static {
3780
+ __name(this, "NetworkError");
3781
+ }
3782
+ };
3783
+
3784
+ // src/generated/cfg_webpush/logger.ts
3785
+ import { createConsola as createConsola3 } from "consola";
3786
+ var DEFAULT_CONFIG3 = {
3787
+ enabled: process.env.NODE_ENV !== "production",
3788
+ logRequests: true,
3789
+ logResponses: true,
3790
+ logErrors: true,
3791
+ logBodies: true,
3792
+ logHeaders: false
3793
+ };
3794
+ var SENSITIVE_HEADERS3 = [
3795
+ "authorization",
3796
+ "cookie",
3797
+ "set-cookie",
3798
+ "x-api-key",
3799
+ "x-csrf-token"
3800
+ ];
3801
+ var APILogger3 = class {
3802
+ static {
3803
+ __name(this, "APILogger");
3804
+ }
3805
+ constructor(config = {}) {
3806
+ this.config = { ...DEFAULT_CONFIG3, ...config };
3807
+ this.consola = config.consola || createConsola3({
3808
+ level: this.config.enabled ? 4 : 0
3809
+ });
3810
+ }
3811
+ /**
3812
+ * Enable logging
3813
+ */
3814
+ enable() {
3815
+ this.config.enabled = true;
3816
+ }
3817
+ /**
3818
+ * Disable logging
3819
+ */
3820
+ disable() {
3821
+ this.config.enabled = false;
3822
+ }
3823
+ /**
3824
+ * Update configuration
3825
+ */
3826
+ setConfig(config) {
3827
+ this.config = { ...this.config, ...config };
3828
+ }
3829
+ /**
3830
+ * Filter sensitive headers
3831
+ */
3832
+ filterHeaders(headers) {
3833
+ if (!headers) return {};
3834
+ const filtered = {};
3835
+ Object.keys(headers).forEach((key) => {
3836
+ const lowerKey = key.toLowerCase();
3837
+ if (SENSITIVE_HEADERS3.includes(lowerKey)) {
3838
+ filtered[key] = "***";
3839
+ } else {
3840
+ filtered[key] = headers[key] || "";
3946
3841
  }
3842
+ });
3843
+ return filtered;
3844
+ }
3845
+ /**
3846
+ * Log request
3847
+ */
3848
+ logRequest(request) {
3849
+ if (!this.config.enabled || !this.config.logRequests) return;
3850
+ const { method, url, headers, body } = request;
3851
+ this.consola.start(`${method} ${url}`);
3852
+ if (this.config.logHeaders && headers) {
3853
+ this.consola.debug("Headers:", this.filterHeaders(headers));
3854
+ }
3855
+ if (this.config.logBodies && body) {
3856
+ this.consola.debug("Body:", body);
3857
+ }
3858
+ }
3859
+ /**
3860
+ * Log response
3861
+ */
3862
+ logResponse(request, response) {
3863
+ if (!this.config.enabled || !this.config.logResponses) return;
3864
+ const { method, url } = request;
3865
+ const { status, statusText, data, duration } = response;
3866
+ const statusColor = status >= 500 ? "red" : status >= 400 ? "yellow" : status >= 300 ? "cyan" : "green";
3867
+ this.consola.success(
3868
+ `${method} ${url} ${status} ${statusText} (${duration}ms)`
3869
+ );
3870
+ if (this.config.logBodies && data) {
3871
+ this.consola.debug("Response:", data);
3947
3872
  }
3948
- throw error;
3949
3873
  }
3950
- }
3951
- __name(createCentrifugoServerInfoCreate, "createCentrifugoServerInfoCreate");
3952
- async function createCentrifugoServerPresenceCreate(data, client) {
3953
- const api = client || getAPIInstance3();
3954
- const response = await api.centrifugo_admin_api.centrifugoServerPresenceCreate(data);
3955
- try {
3956
- return CentrifugoPresenceResponseSchema.parse(response);
3957
- } catch (error) {
3958
- consola6.error("\u274C Zod Validation Failed");
3959
- consola6.box(`createCentrifugoServerPresenceCreate
3960
- Path: /cfg/centrifugo/server/presence/
3961
- Method: POST`);
3962
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
3963
- consola6.error("Validation Issues:");
3964
- error.issues.forEach((issue, index) => {
3965
- consola6.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
3966
- consola6.error(` \u251C\u2500 Message: ${issue.message}`);
3967
- if (issue.expected) consola6.error(` \u251C\u2500 Expected: ${issue.expected}`);
3968
- if (issue.received) consola6.error(` \u2514\u2500 Received: ${issue.received}`);
3874
+ /**
3875
+ * Log error
3876
+ */
3877
+ logError(request, error) {
3878
+ if (!this.config.enabled || !this.config.logErrors) return;
3879
+ const { method, url } = request;
3880
+ const { message, statusCode, fieldErrors, duration } = error;
3881
+ this.consola.error(
3882
+ `${method} ${url} ${statusCode || "Network"} Error (${duration}ms)`
3883
+ );
3884
+ this.consola.error("Message:", message);
3885
+ if (fieldErrors && Object.keys(fieldErrors).length > 0) {
3886
+ this.consola.error("Field Errors:");
3887
+ Object.entries(fieldErrors).forEach(([field, errors]) => {
3888
+ errors.forEach((err) => {
3889
+ this.consola.error(` \u2022 ${field}: ${err}`);
3890
+ });
3969
3891
  });
3970
3892
  }
3971
- consola6.error("Response data:", response);
3972
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3973
- try {
3974
- const event = new CustomEvent("zod-validation-error", {
3975
- detail: {
3976
- operation: "createCentrifugoServerPresenceCreate",
3977
- path: "/cfg/centrifugo/server/presence/",
3978
- method: "POST",
3979
- error,
3980
- response,
3981
- timestamp: /* @__PURE__ */ new Date()
3982
- },
3983
- bubbles: true,
3984
- cancelable: false
3985
- });
3986
- window.dispatchEvent(event);
3987
- } catch (eventError) {
3988
- consola6.warn("Failed to dispatch validation error event:", eventError);
3989
- }
3893
+ }
3894
+ /**
3895
+ * Log general info
3896
+ */
3897
+ info(message, ...args) {
3898
+ if (!this.config.enabled) return;
3899
+ this.consola.info(message, ...args);
3900
+ }
3901
+ /**
3902
+ * Log warning
3903
+ */
3904
+ warn(message, ...args) {
3905
+ if (!this.config.enabled) return;
3906
+ this.consola.warn(message, ...args);
3907
+ }
3908
+ /**
3909
+ * Log error
3910
+ */
3911
+ error(message, ...args) {
3912
+ if (!this.config.enabled) return;
3913
+ this.consola.error(message, ...args);
3914
+ }
3915
+ /**
3916
+ * Log debug
3917
+ */
3918
+ debug(message, ...args) {
3919
+ if (!this.config.enabled) return;
3920
+ this.consola.debug(message, ...args);
3921
+ }
3922
+ /**
3923
+ * Log success
3924
+ */
3925
+ success(message, ...args) {
3926
+ if (!this.config.enabled) return;
3927
+ this.consola.success(message, ...args);
3928
+ }
3929
+ /**
3930
+ * Create a sub-logger with prefix
3931
+ */
3932
+ withTag(tag) {
3933
+ return this.consola.withTag(tag);
3934
+ }
3935
+ };
3936
+ var defaultLogger3 = new APILogger3();
3937
+
3938
+ // src/generated/cfg_webpush/retry.ts
3939
+ import pRetry3, { AbortError as AbortError3 } from "p-retry";
3940
+ var DEFAULT_RETRY_CONFIG3 = {
3941
+ retries: 3,
3942
+ factor: 2,
3943
+ minTimeout: 1e3,
3944
+ maxTimeout: 6e4,
3945
+ randomize: true,
3946
+ onFailedAttempt: /* @__PURE__ */ __name(() => {
3947
+ }, "onFailedAttempt")
3948
+ };
3949
+ function shouldRetry3(error) {
3950
+ if (error instanceof NetworkError3) {
3951
+ return true;
3952
+ }
3953
+ if (error instanceof APIError3) {
3954
+ const status = error.statusCode;
3955
+ if (status >= 500 && status < 600) {
3956
+ return true;
3990
3957
  }
3991
- throw error;
3958
+ if (status === 429) {
3959
+ return true;
3960
+ }
3961
+ return false;
3992
3962
  }
3963
+ return true;
3993
3964
  }
3994
- __name(createCentrifugoServerPresenceCreate, "createCentrifugoServerPresenceCreate");
3995
- async function createCentrifugoServerPresenceStatsCreate(data, client) {
3996
- const api = client || getAPIInstance3();
3997
- const response = await api.centrifugo_admin_api.centrifugoServerPresenceStatsCreate(data);
3998
- try {
3999
- return CentrifugoPresenceStatsResponseSchema.parse(response);
4000
- } catch (error) {
4001
- consola6.error("\u274C Zod Validation Failed");
4002
- consola6.box(`createCentrifugoServerPresenceStatsCreate
4003
- Path: /cfg/centrifugo/server/presence-stats/
4004
- Method: POST`);
4005
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4006
- consola6.error("Validation Issues:");
4007
- error.issues.forEach((issue, index) => {
4008
- consola6.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4009
- consola6.error(` \u251C\u2500 Message: ${issue.message}`);
4010
- if (issue.expected) consola6.error(` \u251C\u2500 Expected: ${issue.expected}`);
4011
- if (issue.received) consola6.error(` \u2514\u2500 Received: ${issue.received}`);
4012
- });
4013
- }
4014
- consola6.error("Response data:", response);
4015
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
3965
+ __name(shouldRetry3, "shouldRetry");
3966
+ async function withRetry3(fn, config) {
3967
+ const finalConfig = { ...DEFAULT_RETRY_CONFIG3, ...config };
3968
+ return pRetry3(
3969
+ async () => {
4016
3970
  try {
4017
- const event = new CustomEvent("zod-validation-error", {
4018
- detail: {
4019
- operation: "createCentrifugoServerPresenceStatsCreate",
4020
- path: "/cfg/centrifugo/server/presence-stats/",
4021
- method: "POST",
4022
- error,
4023
- response,
4024
- timestamp: /* @__PURE__ */ new Date()
4025
- },
4026
- bubbles: true,
4027
- cancelable: false
4028
- });
4029
- window.dispatchEvent(event);
4030
- } catch (eventError) {
4031
- consola6.warn("Failed to dispatch validation error event:", eventError);
3971
+ return await fn();
3972
+ } catch (error) {
3973
+ if (!shouldRetry3(error)) {
3974
+ throw new AbortError3(error);
3975
+ }
3976
+ throw error;
4032
3977
  }
3978
+ },
3979
+ {
3980
+ retries: finalConfig.retries,
3981
+ factor: finalConfig.factor,
3982
+ minTimeout: finalConfig.minTimeout,
3983
+ maxTimeout: finalConfig.maxTimeout,
3984
+ randomize: finalConfig.randomize,
3985
+ onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {
3986
+ const pRetryError = error;
3987
+ finalConfig.onFailedAttempt({
3988
+ error: pRetryError,
3989
+ attemptNumber: pRetryError.attemptNumber,
3990
+ retriesLeft: pRetryError.retriesLeft
3991
+ });
3992
+ } : void 0
4033
3993
  }
4034
- throw error;
4035
- }
3994
+ );
4036
3995
  }
4037
- __name(createCentrifugoServerPresenceStatsCreate, "createCentrifugoServerPresenceStatsCreate");
3996
+ __name(withRetry3, "withRetry");
4038
3997
 
4039
- // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts
4040
- import { consola as consola7 } from "consola";
4041
- async function getCentrifugoAuthTokenRetrieve(client) {
4042
- const api = client || getAPIInstance3();
4043
- const response = await api.centrifugo_auth.tokenRetrieve();
4044
- try {
4045
- return ConnectionTokenResponseSchema.parse(response);
4046
- } catch (error) {
4047
- consola7.error("\u274C Zod Validation Failed");
4048
- consola7.box(`getCentrifugoAuthTokenRetrieve
4049
- Path: /cfg/centrifugo/auth/token/
4050
- Method: GET`);
4051
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4052
- consola7.error("Validation Issues:");
4053
- error.issues.forEach((issue, index) => {
4054
- consola7.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4055
- consola7.error(` \u251C\u2500 Message: ${issue.message}`);
4056
- if (issue.expected) consola7.error(` \u251C\u2500 Expected: ${issue.expected}`);
4057
- if (issue.received) consola7.error(` \u2514\u2500 Received: ${issue.received}`);
4058
- });
3998
+ // src/generated/cfg_webpush/client.ts
3999
+ var APIClient3 = class {
4000
+ constructor(baseUrl, options) {
4001
+ this.logger = null;
4002
+ this.retryConfig = null;
4003
+ this.baseUrl = baseUrl.replace(/\/$/, "");
4004
+ this.httpClient = options?.httpClient || new FetchAdapter3();
4005
+ if (options?.loggerConfig !== void 0) {
4006
+ this.logger = new APILogger3(options.loggerConfig);
4059
4007
  }
4060
- consola7.error("Response data:", response);
4061
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
4062
- try {
4063
- const event = new CustomEvent("zod-validation-error", {
4064
- detail: {
4065
- operation: "getCentrifugoAuthTokenRetrieve",
4066
- path: "/cfg/centrifugo/auth/token/",
4067
- method: "GET",
4068
- error,
4069
- response,
4070
- timestamp: /* @__PURE__ */ new Date()
4071
- },
4072
- bubbles: true,
4073
- cancelable: false
4074
- });
4075
- window.dispatchEvent(event);
4076
- } catch (eventError) {
4077
- consola7.warn("Failed to dispatch validation error event:", eventError);
4078
- }
4008
+ if (options?.retryConfig !== void 0) {
4009
+ this.retryConfig = options.retryConfig;
4010
+ }
4011
+ this.web_push = new WebPush(this);
4012
+ }
4013
+ static {
4014
+ __name(this, "APIClient");
4015
+ }
4016
+ /**
4017
+ * Get CSRF token from cookies (for SessionAuthentication).
4018
+ *
4019
+ * Returns null if cookie doesn't exist (JWT-only auth).
4020
+ */
4021
+ getCsrfToken() {
4022
+ const name = "csrftoken";
4023
+ const value = `; ${document.cookie}`;
4024
+ const parts = value.split(`; ${name}=`);
4025
+ if (parts.length === 2) {
4026
+ return parts.pop()?.split(";").shift() || null;
4079
4027
  }
4080
- throw error;
4028
+ return null;
4081
4029
  }
4082
- }
4083
- __name(getCentrifugoAuthTokenRetrieve, "getCentrifugoAuthTokenRetrieve");
4084
-
4085
- // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts
4086
- import { consola as consola8 } from "consola";
4087
- async function getCentrifugoMonitorChannelsRetrieve(params, client) {
4088
- const api = client || getAPIInstance3();
4089
- const response = await api.centrifugo_monitoring.centrifugoMonitorChannelsRetrieve(params?.hours);
4090
- try {
4091
- return ChannelListSchema.parse(response);
4092
- } catch (error) {
4093
- consola8.error("\u274C Zod Validation Failed");
4094
- consola8.box(`getCentrifugoMonitorChannelsRetrieve
4095
- Path: /cfg/centrifugo/monitor/channels/
4096
- Method: GET`);
4097
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4098
- consola8.error("Validation Issues:");
4099
- error.issues.forEach((issue, index) => {
4100
- consola8.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4101
- consola8.error(` \u251C\u2500 Message: ${issue.message}`);
4102
- if (issue.expected) consola8.error(` \u251C\u2500 Expected: ${issue.expected}`);
4103
- if (issue.received) consola8.error(` \u2514\u2500 Received: ${issue.received}`);
4030
+ /**
4031
+ * Make HTTP request with Django CSRF and session handling.
4032
+ * Automatically retries on network errors and 5xx server errors.
4033
+ */
4034
+ async request(method, path, options) {
4035
+ if (this.retryConfig) {
4036
+ return withRetry3(() => this._makeRequest(method, path, options), {
4037
+ ...this.retryConfig,
4038
+ onFailedAttempt: /* @__PURE__ */ __name((info) => {
4039
+ if (this.logger) {
4040
+ this.logger.warn(
4041
+ `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} for ${method} ${path}: ${info.error.message}`
4042
+ );
4043
+ }
4044
+ this.retryConfig?.onFailedAttempt?.(info);
4045
+ }, "onFailedAttempt")
4104
4046
  });
4105
4047
  }
4106
- consola8.error("Response data:", response);
4107
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
4108
- try {
4109
- const event = new CustomEvent("zod-validation-error", {
4110
- detail: {
4111
- operation: "getCentrifugoMonitorChannelsRetrieve",
4112
- path: "/cfg/centrifugo/monitor/channels/",
4113
- method: "GET",
4114
- error,
4115
- response,
4116
- timestamp: /* @__PURE__ */ new Date()
4117
- },
4118
- bubbles: true,
4119
- cancelable: false
4120
- });
4121
- window.dispatchEvent(event);
4122
- } catch (eventError) {
4123
- consola8.warn("Failed to dispatch validation error event:", eventError);
4124
- }
4125
- }
4126
- throw error;
4048
+ return this._makeRequest(method, path, options);
4127
4049
  }
4128
- }
4129
- __name(getCentrifugoMonitorChannelsRetrieve, "getCentrifugoMonitorChannelsRetrieve");
4130
- async function getCentrifugoMonitorHealthRetrieve(client) {
4131
- const api = client || getAPIInstance3();
4132
- const response = await api.centrifugo_monitoring.centrifugoMonitorHealthRetrieve();
4133
- try {
4134
- return CentrifugoHealthCheckSchema.parse(response);
4135
- } catch (error) {
4136
- consola8.error("\u274C Zod Validation Failed");
4137
- consola8.box(`getCentrifugoMonitorHealthRetrieve
4138
- Path: /cfg/centrifugo/monitor/health/
4139
- Method: GET`);
4140
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4141
- consola8.error("Validation Issues:");
4142
- error.issues.forEach((issue, index) => {
4143
- consola8.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4144
- consola8.error(` \u251C\u2500 Message: ${issue.message}`);
4145
- if (issue.expected) consola8.error(` \u251C\u2500 Expected: ${issue.expected}`);
4146
- if (issue.received) consola8.error(` \u2514\u2500 Received: ${issue.received}`);
4050
+ /**
4051
+ * Internal request method (without retry wrapper).
4052
+ * Used by request() method with optional retry logic.
4053
+ */
4054
+ async _makeRequest(method, path, options) {
4055
+ const url = this.baseUrl ? `${this.baseUrl}${path}` : path;
4056
+ const startTime = Date.now();
4057
+ const headers = {
4058
+ ...options?.headers || {}
4059
+ };
4060
+ if (!options?.formData && !headers["Content-Type"]) {
4061
+ headers["Content-Type"] = "application/json";
4062
+ }
4063
+ if (this.logger) {
4064
+ this.logger.logRequest({
4065
+ method,
4066
+ url,
4067
+ headers,
4068
+ body: options?.formData || options?.body,
4069
+ timestamp: startTime
4147
4070
  });
4148
4071
  }
4149
- consola8.error("Response data:", response);
4150
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
4151
- try {
4152
- const event = new CustomEvent("zod-validation-error", {
4153
- detail: {
4154
- operation: "getCentrifugoMonitorHealthRetrieve",
4155
- path: "/cfg/centrifugo/monitor/health/",
4156
- method: "GET",
4157
- error,
4158
- response,
4159
- timestamp: /* @__PURE__ */ new Date()
4072
+ try {
4073
+ const response = await this.httpClient.request({
4074
+ method,
4075
+ url,
4076
+ headers,
4077
+ params: options?.params,
4078
+ body: options?.body,
4079
+ formData: options?.formData
4080
+ });
4081
+ const duration = Date.now() - startTime;
4082
+ if (response.status >= 400) {
4083
+ const error = new APIError3(
4084
+ response.status,
4085
+ response.statusText,
4086
+ response.data,
4087
+ url
4088
+ );
4089
+ if (this.logger) {
4090
+ this.logger.logError(
4091
+ {
4092
+ method,
4093
+ url,
4094
+ headers,
4095
+ body: options?.formData || options?.body,
4096
+ timestamp: startTime
4097
+ },
4098
+ {
4099
+ message: error.message,
4100
+ statusCode: response.status,
4101
+ duration,
4102
+ timestamp: Date.now()
4103
+ }
4104
+ );
4105
+ }
4106
+ throw error;
4107
+ }
4108
+ if (this.logger) {
4109
+ this.logger.logResponse(
4110
+ {
4111
+ method,
4112
+ url,
4113
+ headers,
4114
+ body: options?.formData || options?.body,
4115
+ timestamp: startTime
4160
4116
  },
4161
- bubbles: true,
4162
- cancelable: false
4163
- });
4164
- window.dispatchEvent(event);
4165
- } catch (eventError) {
4166
- consola8.warn("Failed to dispatch validation error event:", eventError);
4117
+ {
4118
+ status: response.status,
4119
+ statusText: response.statusText,
4120
+ data: response.data,
4121
+ duration,
4122
+ timestamp: Date.now()
4123
+ }
4124
+ );
4167
4125
  }
4168
- }
4169
- throw error;
4170
- }
4171
- }
4172
- __name(getCentrifugoMonitorHealthRetrieve, "getCentrifugoMonitorHealthRetrieve");
4173
- async function getCentrifugoMonitorOverviewRetrieve(params, client) {
4174
- const api = client || getAPIInstance3();
4175
- const response = await api.centrifugo_monitoring.centrifugoMonitorOverviewRetrieve(params?.hours);
4176
- try {
4177
- return CentrifugoOverviewStatsSchema.parse(response);
4178
- } catch (error) {
4179
- consola8.error("\u274C Zod Validation Failed");
4180
- consola8.box(`getCentrifugoMonitorOverviewRetrieve
4181
- Path: /cfg/centrifugo/monitor/overview/
4182
- Method: GET`);
4183
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4184
- consola8.error("Validation Issues:");
4185
- error.issues.forEach((issue, index) => {
4186
- consola8.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4187
- consola8.error(` \u251C\u2500 Message: ${issue.message}`);
4188
- if (issue.expected) consola8.error(` \u251C\u2500 Expected: ${issue.expected}`);
4189
- if (issue.received) consola8.error(` \u2514\u2500 Received: ${issue.received}`);
4190
- });
4191
- }
4192
- consola8.error("Response data:", response);
4193
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
4194
- try {
4195
- const event = new CustomEvent("zod-validation-error", {
4196
- detail: {
4197
- operation: "getCentrifugoMonitorOverviewRetrieve",
4198
- path: "/cfg/centrifugo/monitor/overview/",
4199
- method: "GET",
4200
- error,
4201
- response,
4202
- timestamp: /* @__PURE__ */ new Date()
4126
+ return response.data;
4127
+ } catch (error) {
4128
+ const duration = Date.now() - startTime;
4129
+ if (error instanceof APIError3) {
4130
+ throw error;
4131
+ }
4132
+ const isCORSError = error instanceof TypeError && (error.message.toLowerCase().includes("cors") || error.message.toLowerCase().includes("failed to fetch") || error.message.toLowerCase().includes("network request failed"));
4133
+ if (this.logger) {
4134
+ if (isCORSError) {
4135
+ this.logger.error(`\u{1F6AB} CORS Error: ${method} ${url}`);
4136
+ this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
4137
+ this.logger.error(` \u2192 Configure security_domains parameter on the server`);
4138
+ } else {
4139
+ this.logger.error(`\u26A0\uFE0F Network Error: ${method} ${url}`);
4140
+ this.logger.error(` \u2192 ${error instanceof Error ? error.message : String(error)}`);
4141
+ }
4142
+ }
4143
+ if (typeof window !== "undefined") {
4144
+ try {
4145
+ if (isCORSError) {
4146
+ window.dispatchEvent(new CustomEvent("cors-error", {
4147
+ detail: {
4148
+ url,
4149
+ method,
4150
+ error: error instanceof Error ? error.message : String(error),
4151
+ timestamp: /* @__PURE__ */ new Date()
4152
+ },
4153
+ bubbles: true,
4154
+ cancelable: false
4155
+ }));
4156
+ } else {
4157
+ window.dispatchEvent(new CustomEvent("network-error", {
4158
+ detail: {
4159
+ url,
4160
+ method,
4161
+ error: error instanceof Error ? error.message : String(error),
4162
+ timestamp: /* @__PURE__ */ new Date()
4163
+ },
4164
+ bubbles: true,
4165
+ cancelable: false
4166
+ }));
4167
+ }
4168
+ } catch (eventError) {
4169
+ }
4170
+ }
4171
+ const networkError = error instanceof Error ? new NetworkError3(error.message, url, error) : new NetworkError3("Unknown error", url);
4172
+ if (this.logger) {
4173
+ this.logger.logError(
4174
+ {
4175
+ method,
4176
+ url,
4177
+ headers,
4178
+ body: options?.formData || options?.body,
4179
+ timestamp: startTime
4203
4180
  },
4204
- bubbles: true,
4205
- cancelable: false
4206
- });
4207
- window.dispatchEvent(event);
4208
- } catch (eventError) {
4209
- consola8.warn("Failed to dispatch validation error event:", eventError);
4181
+ {
4182
+ message: networkError.message,
4183
+ duration,
4184
+ timestamp: Date.now()
4185
+ }
4186
+ );
4210
4187
  }
4188
+ throw networkError;
4211
4189
  }
4212
- throw error;
4213
4190
  }
4214
- }
4215
- __name(getCentrifugoMonitorOverviewRetrieve, "getCentrifugoMonitorOverviewRetrieve");
4216
- async function getCentrifugoMonitorPublishesList(params, client) {
4217
- const api = client || getAPIInstance3();
4218
- const response = await api.centrifugo_monitoring.centrifugoMonitorPublishesList(params?.channel, params?.page, params?.page_size, params?.status);
4219
- try {
4220
- return PaginatedPublishListSchema.parse(response);
4221
- } catch (error) {
4222
- consola8.error("\u274C Zod Validation Failed");
4223
- consola8.box(`getCentrifugoMonitorPublishesList
4224
- Path: /cfg/centrifugo/monitor/publishes/
4225
- Method: GET`);
4226
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4227
- consola8.error("Validation Issues:");
4228
- error.issues.forEach((issue, index) => {
4229
- consola8.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4230
- consola8.error(` \u251C\u2500 Message: ${issue.message}`);
4231
- if (issue.expected) consola8.error(` \u251C\u2500 Expected: ${issue.expected}`);
4232
- if (issue.received) consola8.error(` \u2514\u2500 Received: ${issue.received}`);
4233
- });
4234
- }
4235
- consola8.error("Response data:", response);
4236
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
4237
- try {
4238
- const event = new CustomEvent("zod-validation-error", {
4239
- detail: {
4240
- operation: "getCentrifugoMonitorPublishesList",
4241
- path: "/cfg/centrifugo/monitor/publishes/",
4242
- method: "GET",
4243
- error,
4244
- response,
4245
- timestamp: /* @__PURE__ */ new Date()
4246
- },
4247
- bubbles: true,
4248
- cancelable: false
4249
- });
4250
- window.dispatchEvent(event);
4251
- } catch (eventError) {
4252
- consola8.warn("Failed to dispatch validation error event:", eventError);
4191
+ };
4192
+
4193
+ // src/generated/cfg_webpush/storage.ts
4194
+ var LocalStorageAdapter3 = class {
4195
+ static {
4196
+ __name(this, "LocalStorageAdapter");
4197
+ }
4198
+ constructor(logger) {
4199
+ this.logger = logger;
4200
+ }
4201
+ getItem(key) {
4202
+ try {
4203
+ if (typeof window !== "undefined" && window.localStorage) {
4204
+ const value = localStorage.getItem(key);
4205
+ this.logger?.debug(`LocalStorage.getItem("${key}"): ${value ? "found" : "not found"}`);
4206
+ return value;
4253
4207
  }
4208
+ this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
4209
+ } catch (error) {
4210
+ this.logger?.error("LocalStorage.getItem failed:", error);
4254
4211
  }
4255
- throw error;
4212
+ return null;
4256
4213
  }
4257
- }
4258
- __name(getCentrifugoMonitorPublishesList, "getCentrifugoMonitorPublishesList");
4259
- async function getCentrifugoMonitorTimelineRetrieve(params, client) {
4260
- const api = client || getAPIInstance3();
4261
- const response = await api.centrifugo_monitoring.centrifugoMonitorTimelineRetrieve(params?.hours, params?.interval);
4262
- try {
4263
- return TimelineResponseSchema.parse(response);
4264
- } catch (error) {
4265
- consola8.error("\u274C Zod Validation Failed");
4266
- consola8.box(`getCentrifugoMonitorTimelineRetrieve
4267
- Path: /cfg/centrifugo/monitor/timeline/
4268
- Method: GET`);
4269
- if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4270
- consola8.error("Validation Issues:");
4271
- error.issues.forEach((issue, index) => {
4272
- consola8.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
4273
- consola8.error(` \u251C\u2500 Message: ${issue.message}`);
4274
- if (issue.expected) consola8.error(` \u251C\u2500 Expected: ${issue.expected}`);
4275
- if (issue.received) consola8.error(` \u2514\u2500 Received: ${issue.received}`);
4276
- });
4214
+ setItem(key, value) {
4215
+ try {
4216
+ if (typeof window !== "undefined" && window.localStorage) {
4217
+ localStorage.setItem(key, value);
4218
+ this.logger?.debug(`LocalStorage.setItem("${key}"): success`);
4219
+ } else {
4220
+ this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
4221
+ }
4222
+ } catch (error) {
4223
+ this.logger?.error("LocalStorage.setItem failed:", error);
4277
4224
  }
4278
- consola8.error("Response data:", response);
4279
- if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
4280
- try {
4281
- const event = new CustomEvent("zod-validation-error", {
4282
- detail: {
4283
- operation: "getCentrifugoMonitorTimelineRetrieve",
4284
- path: "/cfg/centrifugo/monitor/timeline/",
4285
- method: "GET",
4286
- error,
4287
- response,
4288
- timestamp: /* @__PURE__ */ new Date()
4289
- },
4290
- bubbles: true,
4291
- cancelable: false
4292
- });
4293
- window.dispatchEvent(event);
4294
- } catch (eventError) {
4295
- consola8.warn("Failed to dispatch validation error event:", eventError);
4225
+ }
4226
+ removeItem(key) {
4227
+ try {
4228
+ if (typeof window !== "undefined" && window.localStorage) {
4229
+ localStorage.removeItem(key);
4230
+ this.logger?.debug(`LocalStorage.removeItem("${key}"): success`);
4231
+ } else {
4232
+ this.logger?.warn("LocalStorage not available: window.localStorage is undefined");
4296
4233
  }
4234
+ } catch (error) {
4235
+ this.logger?.error("LocalStorage.removeItem failed:", error);
4297
4236
  }
4298
- throw error;
4299
4237
  }
4300
- }
4301
- __name(getCentrifugoMonitorTimelineRetrieve, "getCentrifugoMonitorTimelineRetrieve");
4238
+ };
4302
4239
 
4303
- // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts
4240
+ // src/generated/cfg_webpush/_utils/schemas/index.ts
4241
+ var schemas_exports3 = {};
4242
+ __export(schemas_exports3, {
4243
+ SendPushRequestRequestSchema: () => SendPushRequestRequestSchema,
4244
+ SendPushResponseSchema: () => SendPushResponseSchema,
4245
+ SubscribeRequestRequestSchema: () => SubscribeRequestRequestSchema,
4246
+ SubscribeResponseSchema: () => SubscribeResponseSchema,
4247
+ VapidPublicKeyResponseSchema: () => VapidPublicKeyResponseSchema
4248
+ });
4249
+
4250
+ // src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts
4251
+ import { z as z55 } from "zod";
4252
+ var SendPushRequestRequestSchema = z55.object({
4253
+ title: z55.string().min(1).max(255),
4254
+ body: z55.string().min(1),
4255
+ icon: z55.url().nullable().optional(),
4256
+ url: z55.url().nullable().optional()
4257
+ });
4258
+
4259
+ // src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts
4260
+ import { z as z56 } from "zod";
4261
+ var SendPushResponseSchema = z56.object({
4262
+ success: z56.boolean(),
4263
+ sent_to: z56.int()
4264
+ });
4265
+
4266
+ // src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts
4267
+ import { z as z57 } from "zod";
4268
+ var SubscribeRequestRequestSchema = z57.object({
4269
+ endpoint: z57.url(),
4270
+ keys: z57.record(z57.string(), z57.string().min(1))
4271
+ });
4272
+
4273
+ // src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts
4274
+ import { z as z58 } from "zod";
4275
+ var SubscribeResponseSchema = z58.object({
4276
+ success: z58.boolean(),
4277
+ subscription_id: z58.int(),
4278
+ created: z58.boolean()
4279
+ });
4280
+
4281
+ // src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts
4282
+ import { z as z59 } from "zod";
4283
+ var VapidPublicKeyResponseSchema = z59.object({
4284
+ publicKey: z59.string()
4285
+ });
4286
+
4287
+ // src/generated/cfg_webpush/_utils/fetchers/index.ts
4288
+ var fetchers_exports3 = {};
4289
+ __export(fetchers_exports3, {
4290
+ createWebpushSendCreate: () => createWebpushSendCreate,
4291
+ createWebpushSubscribeCreate: () => createWebpushSubscribeCreate,
4292
+ getWebpushVapidRetrieve: () => getWebpushVapidRetrieve
4293
+ });
4294
+
4295
+ // src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
4304
4296
  import { consola as consola9 } from "consola";
4305
- async function createCentrifugoTestingPublishTestCreate(data, client) {
4297
+
4298
+ // src/generated/cfg_webpush/api-instance.ts
4299
+ var globalAPI3 = null;
4300
+ function getAPIInstance3() {
4301
+ if (!globalAPI3) {
4302
+ throw new Error(
4303
+ 'API not configured. Call configureAPI() with your base URL before using fetchers or hooks.\n\nExample:\n import { configureAPI } from "./api-instance"\n configureAPI({ baseUrl: "https://api.example.com" })'
4304
+ );
4305
+ }
4306
+ return globalAPI3;
4307
+ }
4308
+ __name(getAPIInstance3, "getAPIInstance");
4309
+
4310
+ // src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
4311
+ async function createWebpushSendCreate(data, client) {
4306
4312
  const api = client || getAPIInstance3();
4307
- const response = await api.centrifugo_testing.publishTestCreate(data);
4313
+ const response = await api.web_push.webpushSendCreate(data);
4308
4314
  try {
4309
- return PublishTestResponseSchema.parse(response);
4315
+ return SendPushResponseSchema.parse(response);
4310
4316
  } catch (error) {
4311
4317
  consola9.error("\u274C Zod Validation Failed");
4312
- consola9.box(`createCentrifugoTestingPublishTestCreate
4313
- Path: /cfg/centrifugo/testing/publish-test/
4318
+ consola9.box(`createWebpushSendCreate
4319
+ Path: /cfg/webpush/send/
4314
4320
  Method: POST`);
4315
4321
  if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4316
4322
  consola9.error("Validation Issues:");
@@ -4326,8 +4332,8 @@ Method: POST`);
4326
4332
  try {
4327
4333
  const event = new CustomEvent("zod-validation-error", {
4328
4334
  detail: {
4329
- operation: "createCentrifugoTestingPublishTestCreate",
4330
- path: "/cfg/centrifugo/testing/publish-test/",
4335
+ operation: "createWebpushSendCreate",
4336
+ path: "/cfg/webpush/send/",
4331
4337
  method: "POST",
4332
4338
  error,
4333
4339
  response,
@@ -4344,16 +4350,16 @@ Method: POST`);
4344
4350
  throw error;
4345
4351
  }
4346
4352
  }
4347
- __name(createCentrifugoTestingPublishTestCreate, "createCentrifugoTestingPublishTestCreate");
4348
- async function createCentrifugoTestingPublishWithLoggingCreate(data, client) {
4353
+ __name(createWebpushSendCreate, "createWebpushSendCreate");
4354
+ async function createWebpushSubscribeCreate(data, client) {
4349
4355
  const api = client || getAPIInstance3();
4350
- const response = await api.centrifugo_testing.publishWithLoggingCreate(data);
4356
+ const response = await api.web_push.webpushSubscribeCreate(data);
4351
4357
  try {
4352
- return PublishTestResponseSchema.parse(response);
4358
+ return SubscribeResponseSchema.parse(response);
4353
4359
  } catch (error) {
4354
4360
  consola9.error("\u274C Zod Validation Failed");
4355
- consola9.box(`createCentrifugoTestingPublishWithLoggingCreate
4356
- Path: /cfg/centrifugo/testing/publish-with-logging/
4361
+ consola9.box(`createWebpushSubscribeCreate
4362
+ Path: /cfg/webpush/subscribe/
4357
4363
  Method: POST`);
4358
4364
  if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4359
4365
  consola9.error("Validation Issues:");
@@ -4369,8 +4375,8 @@ Method: POST`);
4369
4375
  try {
4370
4376
  const event = new CustomEvent("zod-validation-error", {
4371
4377
  detail: {
4372
- operation: "createCentrifugoTestingPublishWithLoggingCreate",
4373
- path: "/cfg/centrifugo/testing/publish-with-logging/",
4378
+ operation: "createWebpushSubscribeCreate",
4379
+ path: "/cfg/webpush/subscribe/",
4374
4380
  method: "POST",
4375
4381
  error,
4376
4382
  response,
@@ -4387,17 +4393,17 @@ Method: POST`);
4387
4393
  throw error;
4388
4394
  }
4389
4395
  }
4390
- __name(createCentrifugoTestingPublishWithLoggingCreate, "createCentrifugoTestingPublishWithLoggingCreate");
4391
- async function createCentrifugoTestingSendAckCreate(data, client) {
4396
+ __name(createWebpushSubscribeCreate, "createWebpushSubscribeCreate");
4397
+ async function getWebpushVapidRetrieve(client) {
4392
4398
  const api = client || getAPIInstance3();
4393
- const response = await api.centrifugo_testing.sendAckCreate(data);
4399
+ const response = await api.web_push.webpushVapidRetrieve();
4394
4400
  try {
4395
- return ManualAckResponseSchema.parse(response);
4401
+ return VapidPublicKeyResponseSchema.parse(response);
4396
4402
  } catch (error) {
4397
4403
  consola9.error("\u274C Zod Validation Failed");
4398
- consola9.box(`createCentrifugoTestingSendAckCreate
4399
- Path: /cfg/centrifugo/testing/send-ack/
4400
- Method: POST`);
4404
+ consola9.box(`getWebpushVapidRetrieve
4405
+ Path: /cfg/webpush/vapid/
4406
+ Method: GET`);
4401
4407
  if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
4402
4408
  consola9.error("Validation Issues:");
4403
4409
  error.issues.forEach((issue, index) => {
@@ -4412,9 +4418,9 @@ Method: POST`);
4412
4418
  try {
4413
4419
  const event = new CustomEvent("zod-validation-error", {
4414
4420
  detail: {
4415
- operation: "createCentrifugoTestingSendAckCreate",
4416
- path: "/cfg/centrifugo/testing/send-ack/",
4417
- method: "POST",
4421
+ operation: "getWebpushVapidRetrieve",
4422
+ path: "/cfg/webpush/vapid/",
4423
+ method: "GET",
4418
4424
  error,
4419
4425
  response,
4420
4426
  timestamp: /* @__PURE__ */ new Date()
@@ -4430,9 +4436,9 @@ Method: POST`);
4430
4436
  throw error;
4431
4437
  }
4432
4438
  }
4433
- __name(createCentrifugoTestingSendAckCreate, "createCentrifugoTestingSendAckCreate");
4439
+ __name(getWebpushVapidRetrieve, "getWebpushVapidRetrieve");
4434
4440
 
4435
- // src/generated/cfg_centrifugo/index.ts
4441
+ // src/generated/cfg_webpush/index.ts
4436
4442
  var TOKEN_KEY3 = "auth_token";
4437
4443
  var REFRESH_TOKEN_KEY3 = "refresh_token";
4438
4444
  var API3 = class {
@@ -4449,10 +4455,7 @@ var API3 = class {
4449
4455
  loggerConfig: this.options?.loggerConfig
4450
4456
  });
4451
4457
  this._injectAuthHeader();
4452
- this.centrifugo_admin_api = this._client.centrifugo_admin_api;
4453
- this.centrifugo_auth = this._client.centrifugo_auth;
4454
- this.centrifugo_monitoring = this._client.centrifugo_monitoring;
4455
- this.centrifugo_testing = this._client.centrifugo_testing;
4458
+ this.web_push = this._client.web_push;
4456
4459
  }
4457
4460
  static {
4458
4461
  __name(this, "API");
@@ -4467,10 +4470,7 @@ var API3 = class {
4467
4470
  loggerConfig: this.options?.loggerConfig
4468
4471
  });
4469
4472
  this._injectAuthHeader();
4470
- this.centrifugo_admin_api = this._client.centrifugo_admin_api;
4471
- this.centrifugo_auth = this._client.centrifugo_auth;
4472
- this.centrifugo_monitoring = this._client.centrifugo_monitoring;
4473
- this.centrifugo_testing = this._client.centrifugo_testing;
4473
+ this.web_push = this._client.web_push;
4474
4474
  }
4475
4475
  _injectAuthHeader() {
4476
4476
  const originalRequest = this._client.request.bind(this._client);
@@ -4890,15 +4890,15 @@ var isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
4890
4890
  var apiUrl = isStaticBuild ? "" : process.env.NEXT_PUBLIC_API_URL || "";
4891
4891
  var storage = new LocalStorageAdapter();
4892
4892
  var apiAccounts = new API(apiUrl, { storage });
4893
- var apiWebPush = new API2(apiUrl, { storage });
4894
- var apiCentrifugo = new API3(apiUrl, { storage });
4893
+ var apiWebPush = new API3(apiUrl, { storage });
4894
+ var apiCentrifugo = new API2(apiUrl, { storage });
4895
4895
  export {
4896
4896
  API as AccountsAPI,
4897
- API3 as CentrifugoAPI,
4898
- fetchers_exports3 as CentrifugoFetchers,
4897
+ API2 as CentrifugoAPI,
4898
+ fetchers_exports2 as CentrifugoFetchers,
4899
4899
  hooks_exports2 as CentrifugoHooks,
4900
4900
  CentrifugoTokenSchema,
4901
- schemas_exports3 as CentrifugoTypes,
4901
+ schemas_exports2 as CentrifugoTypes,
4902
4902
  enums_exports as Enums,
4903
4903
  OAuthAuthorizeRequestRequestSchema,
4904
4904
  OAuthAuthorizeResponseSchema,
@@ -4918,10 +4918,10 @@ export {
4918
4918
  TokenRefreshSchema,
4919
4919
  UserProfileUpdateRequestSchema,
4920
4920
  UserSchema,
4921
- API2 as WebPushAPI,
4922
- fetchers_exports2 as WebPushFetchers,
4921
+ API3 as WebPushAPI,
4922
+ fetchers_exports3 as WebPushFetchers,
4923
4923
  hooks_exports as WebPushHooks,
4924
- schemas_exports2 as WebPushTypes,
4924
+ schemas_exports3 as WebPushTypes,
4925
4925
  apiAccounts,
4926
4926
  apiCentrifugo,
4927
4927
  apiWebPush,