@djangocfg/api 2.1.327 → 2.1.331

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 (170) hide show
  1. package/dist/auth-server.cjs +185 -3471
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +185 -3471
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +952 -3305
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.d.cts +35 -35
  8. package/dist/auth.d.ts +35 -35
  9. package/dist/auth.mjs +952 -3305
  10. package/dist/auth.mjs.map +1 -1
  11. package/dist/clients.cjs +90 -3396
  12. package/dist/clients.cjs.map +1 -1
  13. package/dist/clients.d.cts +4 -2508
  14. package/dist/clients.d.ts +4 -2508
  15. package/dist/clients.mjs +90 -3396
  16. package/dist/clients.mjs.map +1 -1
  17. package/dist/index.cjs +985 -3052
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1544 -1938
  20. package/dist/index.d.ts +1544 -1938
  21. package/dist/index.mjs +985 -3052
  22. package/dist/index.mjs.map +1 -1
  23. package/package.json +2 -2
  24. package/src/_api/generated/{cfg_centrifugo → _cfg_accounts}/api.ts +11 -55
  25. package/src/_api/generated/{cfg_totp → _cfg_accounts}/events.ts +3 -3
  26. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/index.ts +1 -1
  27. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthConnectionsList.ts +5 -6
  28. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthDisconnectCreate.ts +3 -3
  29. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +3 -3
  30. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +3 -3
  31. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthProvidersRetrieve.ts +5 -6
  32. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOtpRequestCreate.ts +3 -3
  33. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOtpVerifyCreate.ts +3 -3
  34. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileAvatarCreate.ts +3 -3
  35. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileDeleteCreate.ts +3 -3
  36. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +3 -3
  37. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfilePartialUpdate.ts +3 -3
  38. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileRetrieve.ts +5 -6
  39. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +3 -3
  40. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileUpdateUpdate.ts +3 -3
  41. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsTokenRefreshCreate.ts +3 -3
  42. package/src/_api/generated/{cfg_centrifugo → _cfg_accounts}/index.ts +3 -3
  43. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/AccountDeleteResponse.ts +3 -3
  44. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/CentrifugoToken.ts +4 -4
  45. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/CfgUserUpdateRequest.ts +4 -4
  46. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthAuthorizeRequestRequest.ts +2 -2
  47. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthAuthorizeResponse.ts +2 -2
  48. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthCallbackRequestRequest.ts +3 -3
  49. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthConnection.ts +6 -6
  50. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthDisconnectRequestRequest.ts +2 -2
  51. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthError.ts +2 -2
  52. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthProvidersResponse.ts +3 -3
  53. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthTokenResponse.ts +7 -7
  54. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPErrorResponse.ts +2 -2
  55. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPRequestRequest.ts +2 -2
  56. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPRequestResponse.ts +2 -2
  57. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPVerifyRequest.ts +2 -2
  58. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPVerifyResponse.ts +6 -6
  59. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/PatchedCfgUserUpdateRequest.ts +4 -4
  60. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/ProviderEnum.ts +2 -2
  61. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/TokenRefresh.ts +2 -2
  62. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/TokenRefreshRequest.ts +2 -2
  63. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/User.ts +13 -13
  64. package/src/_api/generated/_cfg_accounts/sdk.gen.ts +5 -0
  65. package/src/_api/generated/_cfg_accounts/types.gen.ts +5 -0
  66. package/src/_api/generated/{cfg_totp → _cfg_centrifugo}/api.ts +11 -72
  67. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/events.ts +3 -3
  68. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/hooks/index.ts +1 -1
  69. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +5 -6
  70. package/src/_api/generated/{cfg_accounts → _cfg_centrifugo}/index.ts +3 -3
  71. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/schemas/ConnectionTokenResponse.ts +4 -4
  72. package/src/_api/generated/_cfg_centrifugo/sdk.gen.ts +5 -0
  73. package/src/_api/generated/_cfg_centrifugo/types.gen.ts +5 -0
  74. package/src/_api/generated/{cfg_accounts → _cfg_totp}/api.ts +11 -78
  75. package/src/_api/generated/{cfg_accounts → _cfg_totp}/events.ts +3 -3
  76. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/index.ts +1 -1
  77. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +3 -3
  78. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpBackupCodesRetrieve.ts +5 -6
  79. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDevicesDestroy.ts +3 -3
  80. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDevicesRetrieve.ts +5 -6
  81. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDisableCreate.ts +3 -3
  82. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpSetupConfirmCreate.ts +3 -3
  83. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpSetupCreate.ts +3 -3
  84. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpVerifyBackupCreate.ts +3 -3
  85. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpVerifyCreate.ts +3 -3
  86. package/src/_api/generated/{cfg_totp → _cfg_totp}/index.ts +3 -3
  87. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesRegenerateRequest.ts +2 -2
  88. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesRegenerateResponse.ts +2 -2
  89. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesStatus.ts +2 -2
  90. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/ConfirmSetupRequest.ts +3 -3
  91. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/ConfirmSetupResponse.ts +3 -3
  92. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceList.ts +6 -6
  93. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceListResponse.ts +2 -2
  94. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceListStatusEnum.ts +2 -2
  95. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DisableRequest.ts +2 -2
  96. package/src/_api/generated/_cfg_totp/schemas/SetupRequest.ts +11 -0
  97. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/SetupResponse.ts +4 -4
  98. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/TotpVerifyUser.ts +12 -12
  99. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyBackupRequest.ts +3 -3
  100. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyRequest.ts +3 -3
  101. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyResponse.ts +4 -4
  102. package/src/_api/generated/_cfg_totp/sdk.gen.ts +5 -0
  103. package/src/_api/generated/_cfg_totp/types.gen.ts +5 -0
  104. package/src/_api/generated/index.ts +11 -13
  105. package/src/_api/generated/{cfg_accounts/sdk.gen.ts → sdk.gen.ts} +455 -1
  106. package/src/_api/generated/{cfg_accounts/types.gen.ts → types.gen.ts} +607 -77
  107. package/src/auth/context/AccountsContext.tsx +10 -10
  108. package/src/auth/context/AuthContext.tsx +1 -1
  109. package/src/auth/hooks/useDeleteAccount.ts +2 -1
  110. package/src/auth/hooks/useGithubAuth.ts +3 -2
  111. package/src/auth/hooks/useTokenRefresh.ts +2 -1
  112. package/src/auth/hooks/useTwoFactor.ts +4 -3
  113. package/src/auth/hooks/useTwoFactorSetup.ts +3 -2
  114. package/src/auth/hooks/useTwoFactorStatus.ts +4 -3
  115. package/src/auth/middlewares/tokenRefresh.ts +2 -1
  116. package/src/clients.ts +3 -3
  117. package/src/index.ts +22 -5
  118. package/src/server.ts +9 -9
  119. package/src/_api/generated/cfg_centrifugo/client/client.gen.ts +0 -280
  120. package/src/_api/generated/cfg_centrifugo/client/index.ts +0 -25
  121. package/src/_api/generated/cfg_centrifugo/client/types.gen.ts +0 -217
  122. package/src/_api/generated/cfg_centrifugo/client/utils.gen.ts +0 -318
  123. package/src/_api/generated/cfg_centrifugo/client.gen.ts +0 -16
  124. package/src/_api/generated/cfg_centrifugo/core/auth.gen.ts +0 -41
  125. package/src/_api/generated/cfg_centrifugo/core/bodySerializer.gen.ts +0 -82
  126. package/src/_api/generated/cfg_centrifugo/core/params.gen.ts +0 -169
  127. package/src/_api/generated/cfg_centrifugo/core/pathSerializer.gen.ts +0 -171
  128. package/src/_api/generated/cfg_centrifugo/core/queryKeySerializer.gen.ts +0 -117
  129. package/src/_api/generated/cfg_centrifugo/core/serverSentEvents.gen.ts +0 -242
  130. package/src/_api/generated/cfg_centrifugo/core/types.gen.ts +0 -104
  131. package/src/_api/generated/cfg_centrifugo/core/utils.gen.ts +0 -140
  132. package/src/_api/generated/cfg_centrifugo/sdk.gen.ts +0 -64
  133. package/src/_api/generated/cfg_centrifugo/types.gen.ts +0 -61
  134. package/src/_api/generated/cfg_totp/client/client.gen.ts +0 -280
  135. package/src/_api/generated/cfg_totp/client/index.ts +0 -25
  136. package/src/_api/generated/cfg_totp/client/types.gen.ts +0 -217
  137. package/src/_api/generated/cfg_totp/client/utils.gen.ts +0 -318
  138. package/src/_api/generated/cfg_totp/client.gen.ts +0 -16
  139. package/src/_api/generated/cfg_totp/core/auth.gen.ts +0 -41
  140. package/src/_api/generated/cfg_totp/core/bodySerializer.gen.ts +0 -82
  141. package/src/_api/generated/cfg_totp/core/params.gen.ts +0 -169
  142. package/src/_api/generated/cfg_totp/core/pathSerializer.gen.ts +0 -171
  143. package/src/_api/generated/cfg_totp/core/queryKeySerializer.gen.ts +0 -117
  144. package/src/_api/generated/cfg_totp/core/serverSentEvents.gen.ts +0 -242
  145. package/src/_api/generated/cfg_totp/core/types.gen.ts +0 -104
  146. package/src/_api/generated/cfg_totp/core/utils.gen.ts +0 -140
  147. package/src/_api/generated/cfg_totp/schemas/SetupRequest.ts +0 -11
  148. package/src/_api/generated/cfg_totp/sdk.gen.ts +0 -432
  149. package/src/_api/generated/cfg_totp/types.gen.ts +0 -479
  150. /package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/index.ts +0 -0
  151. /package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/schemas/index.ts +0 -0
  152. /package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/index.ts +0 -0
  153. /package/src/_api/generated/{cfg_accounts/client → client}/client.gen.ts +0 -0
  154. /package/src/_api/generated/{cfg_accounts/client → client}/index.ts +0 -0
  155. /package/src/_api/generated/{cfg_accounts/client → client}/types.gen.ts +0 -0
  156. /package/src/_api/generated/{cfg_accounts/client → client}/utils.gen.ts +0 -0
  157. /package/src/_api/generated/{cfg_accounts/client.gen.ts → client.gen.ts} +0 -0
  158. /package/src/_api/generated/{cfg_accounts/core → core}/auth.gen.ts +0 -0
  159. /package/src/_api/generated/{cfg_accounts/core → core}/bodySerializer.gen.ts +0 -0
  160. /package/src/_api/generated/{cfg_accounts/core → core}/params.gen.ts +0 -0
  161. /package/src/_api/generated/{cfg_accounts/core → core}/pathSerializer.gen.ts +0 -0
  162. /package/src/_api/generated/{cfg_accounts/core → core}/queryKeySerializer.gen.ts +0 -0
  163. /package/src/_api/generated/{cfg_accounts/core → core}/serverSentEvents.gen.ts +0 -0
  164. /package/src/_api/generated/{cfg_accounts/core → core}/types.gen.ts +0 -0
  165. /package/src/_api/generated/{cfg_accounts/core → core}/utils.gen.ts +0 -0
  166. /package/src/_api/generated/{_shared → helpers}/errors.ts +0 -0
  167. /package/src/_api/generated/{_shared → helpers}/index.ts +0 -0
  168. /package/src/_api/generated/{_shared → helpers}/logger.ts +0 -0
  169. /package/src/_api/generated/{_shared → helpers}/storage.ts +0 -0
  170. /package/src/_api/generated/{_shared → helpers}/validation-events.ts +0 -0
package/dist/index.cjs CHANGED
@@ -27,9 +27,13 @@ __export(index_exports, {
27
27
  BackupCodes: () => BackupCodes,
28
28
  Centrifugo: () => Centrifugo,
29
29
  CentrifugoAuth: () => CentrifugoAuth,
30
+ Cfg: () => Cfg,
30
31
  CfgAccountsAPI: () => API,
32
+ CfgAccountsApi: () => CfgAccountsApi,
31
33
  CfgCentrifugoAPI: () => API2,
34
+ CfgCentrifugoApi: () => CfgCentrifugoApi,
32
35
  CfgTotpAPI: () => API3,
36
+ CfgTotpApi: () => CfgTotpApi,
33
37
  CookieStorageAdapter: () => CookieStorageAdapter,
34
38
  LocalStorageAdapter: () => LocalStorageAdapter,
35
39
  MemoryStorageAdapter: () => MemoryStorageAdapter,
@@ -40,10 +44,7 @@ __export(index_exports, {
40
44
  TotpSetup: () => TotpSetup,
41
45
  TotpVerification: () => TotpVerification,
42
46
  UserProfile: () => UserProfile,
43
- api: () => cfgAccountsApi,
44
- cfgAccountsApi: () => cfgAccountsApi,
45
- cfgCentrifugoApi: () => cfgCentrifugoApi,
46
- cfgTotpApi: () => cfgTotpApi,
47
+ api: () => CfgAccountsApi,
47
48
  defaultLogger: () => defaultLogger,
48
49
  dispatchValidationError: () => dispatchValidationError,
49
50
  formatZodError: () => formatZodError,
@@ -51,7 +52,7 @@ __export(index_exports, {
51
52
  });
52
53
  module.exports = __toCommonJS(index_exports);
53
54
 
54
- // src/_api/generated/cfg_accounts/core/bodySerializer.gen.ts
55
+ // src/_api/generated/core/bodySerializer.gen.ts
55
56
  var serializeFormDataPair = /* @__PURE__ */ __name((data, key, value) => {
56
57
  if (typeof value === "string" || value instanceof Blob) {
57
58
  data.append(key, value);
@@ -81,7 +82,7 @@ var jsonBodySerializer = {
81
82
  bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
82
83
  };
83
84
 
84
- // src/_api/generated/cfg_accounts/core/params.gen.ts
85
+ // src/_api/generated/core/params.gen.ts
85
86
  var extraPrefixesMap = {
86
87
  $body_: "body",
87
88
  $headers_: "headers",
@@ -90,7 +91,7 @@ var extraPrefixesMap = {
90
91
  };
91
92
  var extraPrefixes = Object.entries(extraPrefixesMap);
92
93
 
93
- // src/_api/generated/cfg_accounts/core/serverSentEvents.gen.ts
94
+ // src/_api/generated/core/serverSentEvents.gen.ts
94
95
  function createSseClient({
95
96
  onRequest,
96
97
  onSseError,
@@ -218,7 +219,7 @@ function createSseClient({
218
219
  }
219
220
  __name(createSseClient, "createSseClient");
220
221
 
221
- // src/_api/generated/cfg_accounts/core/pathSerializer.gen.ts
222
+ // src/_api/generated/core/pathSerializer.gen.ts
222
223
  var separatorArrayExplode = /* @__PURE__ */ __name((style) => {
223
224
  switch (style) {
224
225
  case "label":
@@ -342,7 +343,7 @@ var serializeObjectParam = /* @__PURE__ */ __name(({
342
343
  return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
343
344
  }, "serializeObjectParam");
344
345
 
345
- // src/_api/generated/cfg_accounts/core/utils.gen.ts
346
+ // src/_api/generated/core/utils.gen.ts
346
347
  var PATH_PARAM_RE = /\{[^{}]+\}/g;
347
348
  var defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
348
349
  let url = _url;
@@ -440,7 +441,7 @@ function getValidRequestBody(options) {
440
441
  }
441
442
  __name(getValidRequestBody, "getValidRequestBody");
442
443
 
443
- // src/_api/generated/cfg_accounts/core/auth.gen.ts
444
+ // src/_api/generated/core/auth.gen.ts
444
445
  var getAuthToken = /* @__PURE__ */ __name(async (auth, callback) => {
445
446
  const token = typeof callback === "function" ? await callback(auth) : callback;
446
447
  if (!token) {
@@ -455,7 +456,7 @@ var getAuthToken = /* @__PURE__ */ __name(async (auth, callback) => {
455
456
  return token;
456
457
  }, "getAuthToken");
457
458
 
458
- // src/_api/generated/cfg_accounts/client/utils.gen.ts
459
+ // src/_api/generated/client/utils.gen.ts
459
460
  var createQuerySerializer = /* @__PURE__ */ __name(({
460
461
  parameters = {},
461
462
  ...args
@@ -674,7 +675,7 @@ var createConfig = /* @__PURE__ */ __name((override = {}) => ({
674
675
  ...override
675
676
  }), "createConfig");
676
677
 
677
- // src/_api/generated/cfg_accounts/client/client.gen.ts
678
+ // src/_api/generated/client/client.gen.ts
678
679
  var createClient = /* @__PURE__ */ __name((config = {}) => {
679
680
  let _config = mergeConfigs(createConfig(), config);
680
681
  const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
@@ -872,10 +873,10 @@ var createClient = /* @__PURE__ */ __name((config = {}) => {
872
873
  };
873
874
  }, "createClient");
874
875
 
875
- // src/_api/generated/cfg_accounts/client.gen.ts
876
+ // src/_api/generated/client.gen.ts
876
877
  var client = createClient(createConfig({ baseUrl: "http://localhost:8000" }));
877
878
 
878
- // src/_api/generated/_shared/storage.ts
879
+ // src/_api/generated/helpers/storage.ts
879
880
  var LocalStorageAdapter = class {
880
881
  static {
881
882
  __name(this, "LocalStorageAdapter");
@@ -965,7 +966,7 @@ var CookieStorageAdapter = class {
965
966
  }
966
967
  };
967
968
 
968
- // src/_api/generated/_shared/logger.ts
969
+ // src/_api/generated/helpers/logger.ts
969
970
  var import_consola = require("consola");
970
971
  var DEFAULT_CONFIG = {
971
972
  enabled: typeof process !== "undefined" && process.env.NODE_ENV !== "production",
@@ -1059,482 +1060,426 @@ var APILogger = class {
1059
1060
  };
1060
1061
  var defaultLogger = new APILogger();
1061
1062
 
1062
- // src/_api/generated/cfg_accounts/sdk.gen.ts
1063
- var Cfg = class {
1063
+ // src/_api/generated/_cfg_accounts/api.ts
1064
+ var ACCESS_KEY = "cfg.access_token";
1065
+ var REFRESH_KEY = "cfg.refresh_token";
1066
+ function detectLocale() {
1067
+ try {
1068
+ if (typeof document !== "undefined") {
1069
+ const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
1070
+ if (m) return decodeURIComponent(m[1]);
1071
+ }
1072
+ if (typeof navigator !== "undefined" && navigator.language) {
1073
+ return navigator.language;
1074
+ }
1075
+ } catch {
1076
+ }
1077
+ return null;
1078
+ }
1079
+ __name(detectLocale, "detectLocale");
1080
+ var API = class {
1064
1081
  static {
1065
- __name(this, "Cfg");
1082
+ __name(this, "API");
1066
1083
  }
1067
- /**
1068
- * List OAuth connections
1069
- *
1070
- * Get all OAuth connections for the current user.
1071
- */
1072
- static cfgAccountsOauthConnectionsList(options) {
1073
- return (options?.client ?? client).get({
1074
- security: [{ scheme: "bearer", type: "http" }],
1075
- url: "/cfg/accounts/oauth/connections/",
1076
- ...options
1084
+ baseUrl;
1085
+ storage;
1086
+ locale;
1087
+ apiKey;
1088
+ logger;
1089
+ constructor(baseUrl2, opts = {}) {
1090
+ this.baseUrl = baseUrl2.replace(/\/$/, "");
1091
+ this.storage = opts.storage ?? new LocalStorageAdapter();
1092
+ this.logger = new APILogger(opts.logger);
1093
+ this.locale = opts.locale ?? null;
1094
+ this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
1095
+ const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
1096
+ client.setConfig({ baseUrl: this.baseUrl, credentials });
1097
+ client.interceptors.request.use((request) => {
1098
+ const access = this.getToken();
1099
+ if (access) request.headers.set("Authorization", `Bearer ${access}`);
1100
+ const locale = this.locale ?? detectLocale();
1101
+ if (locale) request.headers.set("Accept-Language", locale);
1102
+ if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
1103
+ return request;
1077
1104
  });
1078
1105
  }
1079
- /**
1080
- * Disconnect OAuth provider
1081
- *
1082
- * Remove OAuth connection for the specified provider.
1083
- */
1084
- static cfgAccountsOauthDisconnectCreate(options) {
1085
- return (options.client ?? client).post({
1086
- security: [{ scheme: "bearer", type: "http" }],
1087
- url: "/cfg/accounts/oauth/disconnect/",
1088
- ...options,
1089
- headers: {
1090
- "Content-Type": "application/json",
1091
- ...options.headers
1092
- }
1093
- });
1106
+ // ── Base URL ────────────────────────────────────────────────────────────
1107
+ getBaseUrl() {
1108
+ return this.baseUrl;
1094
1109
  }
1095
- /**
1096
- * Start GitHub OAuth
1097
- *
1098
- * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
1099
- */
1100
- static cfgAccountsOauthGithubAuthorizeCreate(options) {
1101
- return (options?.client ?? client).post({
1102
- url: "/cfg/accounts/oauth/github/authorize/",
1103
- ...options,
1104
- headers: {
1105
- "Content-Type": "application/json",
1106
- ...options?.headers
1107
- }
1108
- });
1110
+ setBaseUrl(url) {
1111
+ this.baseUrl = url.replace(/\/$/, "");
1112
+ client.setConfig({ baseUrl: this.baseUrl });
1109
1113
  }
1110
- /**
1111
- * Complete GitHub OAuth
1112
- *
1113
- * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
1114
- */
1115
- static cfgAccountsOauthGithubCallbackCreate(options) {
1116
- return (options.client ?? client).post({
1117
- url: "/cfg/accounts/oauth/github/callback/",
1118
- ...options,
1119
- headers: {
1120
- "Content-Type": "application/json",
1121
- ...options.headers
1122
- }
1123
- });
1114
+ // ── Tokens ──────────────────────────────────────────────────────────────
1115
+ getToken() {
1116
+ return this.storage.getItem(ACCESS_KEY);
1124
1117
  }
1125
- /**
1126
- * List OAuth providers
1127
- *
1128
- * Get list of available OAuth providers for authentication.
1129
- */
1130
- static cfgAccountsOauthProvidersRetrieve(options) {
1131
- return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
1118
+ setToken(token) {
1119
+ if (token) this.storage.setItem(ACCESS_KEY, token);
1120
+ else this.storage.removeItem(ACCESS_KEY);
1132
1121
  }
1133
- /**
1134
- * Request OTP code to email.
1135
- */
1136
- static cfgAccountsOtpRequestCreate(options) {
1137
- return (options.client ?? client).post({
1138
- security: [{ scheme: "bearer", type: "http" }],
1139
- url: "/cfg/accounts/otp/request/",
1140
- ...options,
1141
- headers: {
1142
- "Content-Type": "application/json",
1143
- ...options.headers
1144
- }
1145
- });
1122
+ getRefreshToken() {
1123
+ return this.storage.getItem(REFRESH_KEY);
1146
1124
  }
1147
- /**
1148
- * Verify OTP code and return JWT tokens or 2FA session.
1149
- *
1150
- * If user has 2FA enabled:
1151
- * - Returns requires_2fa=True with session_id
1152
- * - Client must complete 2FA verification at /cfg/totp/verify/
1153
- *
1154
- * If user has no 2FA:
1155
- * - Returns JWT tokens and user data directly
1156
- */
1157
- static cfgAccountsOtpVerifyCreate(options) {
1158
- return (options.client ?? client).post({
1159
- security: [{ scheme: "bearer", type: "http" }],
1160
- url: "/cfg/accounts/otp/verify/",
1161
- ...options,
1162
- headers: {
1163
- "Content-Type": "application/json",
1164
- ...options.headers
1165
- }
1166
- });
1125
+ setRefreshToken(token) {
1126
+ if (token) this.storage.setItem(REFRESH_KEY, token);
1127
+ else this.storage.removeItem(REFRESH_KEY);
1167
1128
  }
1168
- /**
1169
- * Get current user profile
1170
- *
1171
- * Retrieve the current authenticated user's profile information.
1172
- */
1173
- static cfgAccountsProfileRetrieve(options) {
1174
- return (options?.client ?? client).get({
1175
- security: [{ scheme: "bearer", type: "http" }, {
1176
- in: "cookie",
1177
- name: "sessionid",
1178
- type: "apiKey"
1179
- }],
1180
- url: "/cfg/accounts/profile/",
1181
- ...options
1182
- });
1129
+ clearToken() {
1130
+ this.storage.removeItem(ACCESS_KEY);
1131
+ this.storage.removeItem(REFRESH_KEY);
1183
1132
  }
1184
- /**
1185
- * Upload user avatar
1186
- *
1187
- * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
1188
- */
1189
- static cfgAccountsProfileAvatarCreate(options) {
1190
- return (options?.client ?? client).post({
1191
- ...formDataBodySerializer,
1192
- security: [{ scheme: "bearer", type: "http" }],
1193
- url: "/cfg/accounts/profile/avatar/",
1194
- ...options,
1195
- headers: {
1196
- "Content-Type": null,
1197
- ...options?.headers
1198
- }
1199
- });
1133
+ isAuthenticated() {
1134
+ return this.getToken() !== null;
1200
1135
  }
1201
- /**
1202
- * Delete user account
1203
- *
1204
- *
1205
- * Permanently delete the current user's account.
1206
- *
1207
- * This operation:
1208
- * - Deactivates the account (user cannot log in)
1209
- * - Anonymizes personal data (GDPR compliance)
1210
- * - Frees up the email address for re-registration
1211
- * - Preserves audit trail
1212
- *
1213
- * The account can be restored by an administrator if needed.
1214
- *
1215
- */
1216
- static cfgAccountsProfileDeleteCreate(options) {
1217
- return (options?.client ?? client).post({
1218
- security: [{ scheme: "bearer", type: "http" }, {
1219
- in: "cookie",
1220
- name: "sessionid",
1221
- type: "apiKey"
1222
- }],
1223
- url: "/cfg/accounts/profile/delete/",
1224
- ...options
1225
- });
1136
+ // ── Locale / API key ────────────────────────────────────────────────────
1137
+ getLocale() {
1138
+ return this.locale ?? detectLocale();
1226
1139
  }
1227
- /**
1228
- * Partial update user profile
1229
- *
1230
- * Partially update the current authenticated user's profile information. Supports avatar upload.
1231
- */
1232
- static cfgAccountsProfilePartialPartialUpdate(options) {
1233
- return (options?.client ?? client).patch({
1234
- security: [{ scheme: "bearer", type: "http" }, {
1235
- in: "cookie",
1236
- name: "sessionid",
1237
- type: "apiKey"
1238
- }],
1239
- url: "/cfg/accounts/profile/partial/",
1240
- ...options,
1241
- headers: {
1242
- "Content-Type": "application/json",
1243
- ...options?.headers
1244
- }
1245
- });
1140
+ setLocale(locale) {
1141
+ this.locale = locale;
1246
1142
  }
1247
- /**
1248
- * Partial update user profile
1249
- *
1250
- * Partially update the current authenticated user's profile information. Supports avatar upload.
1251
- */
1252
- static cfgAccountsProfilePartialUpdate(options) {
1253
- return (options?.client ?? client).put({
1254
- security: [{ scheme: "bearer", type: "http" }, {
1255
- in: "cookie",
1256
- name: "sessionid",
1257
- type: "apiKey"
1258
- }],
1259
- url: "/cfg/accounts/profile/partial/",
1260
- ...options,
1261
- headers: {
1262
- "Content-Type": "application/json",
1263
- ...options?.headers
1264
- }
1265
- });
1143
+ getApiKey() {
1144
+ return this.apiKey;
1266
1145
  }
1267
- /**
1268
- * Update user profile
1269
- *
1270
- * Update the current authenticated user's profile information.
1271
- */
1272
- static cfgAccountsProfileUpdatePartialUpdate(options) {
1273
- return (options?.client ?? client).patch({
1274
- security: [{ scheme: "bearer", type: "http" }, {
1275
- in: "cookie",
1276
- name: "sessionid",
1277
- type: "apiKey"
1278
- }],
1279
- url: "/cfg/accounts/profile/update/",
1280
- ...options,
1281
- headers: {
1282
- "Content-Type": "application/json",
1283
- ...options?.headers
1284
- }
1285
- });
1286
- }
1287
- /**
1288
- * Update user profile
1289
- *
1290
- * Update the current authenticated user's profile information.
1291
- */
1292
- static cfgAccountsProfileUpdateUpdate(options) {
1293
- return (options?.client ?? client).put({
1294
- security: [{ scheme: "bearer", type: "http" }, {
1295
- in: "cookie",
1296
- name: "sessionid",
1297
- type: "apiKey"
1298
- }],
1299
- url: "/cfg/accounts/profile/update/",
1300
- ...options,
1301
- headers: {
1302
- "Content-Type": "application/json",
1303
- ...options?.headers
1304
- }
1305
- });
1306
- }
1307
- /**
1308
- * Refresh JWT token.
1309
- */
1310
- static cfgAccountsTokenRefreshCreate(options) {
1311
- return (options.client ?? client).post({
1312
- url: "/cfg/accounts/token/refresh/",
1313
- ...options,
1314
- headers: {
1315
- "Content-Type": "application/json",
1316
- ...options.headers
1317
- }
1318
- });
1146
+ setApiKey(key) {
1147
+ this.apiKey = key;
1319
1148
  }
1320
1149
  };
1321
- var Accounts = class {
1150
+
1151
+ // src/_api/generated/helpers/errors.ts
1152
+ var APIError = class extends Error {
1153
+ constructor(statusCode, statusText, response, url, message) {
1154
+ super(message || `HTTP ${statusCode}: ${statusText}`);
1155
+ this.statusCode = statusCode;
1156
+ this.statusText = statusText;
1157
+ this.response = response;
1158
+ this.url = url;
1159
+ this.name = "APIError";
1160
+ }
1322
1161
  static {
1323
- __name(this, "Accounts");
1162
+ __name(this, "APIError");
1324
1163
  }
1325
- /**
1326
- * List OAuth connections
1327
- *
1328
- * Get all OAuth connections for the current user.
1329
- */
1330
- static cfgAccountsOauthConnectionsList(options) {
1331
- return (options?.client ?? client).get({
1332
- security: [{ scheme: "bearer", type: "http" }],
1333
- url: "/cfg/accounts/oauth/connections/",
1334
- ...options
1335
- });
1164
+ get details() {
1165
+ if (typeof this.response === "object" && this.response !== null) {
1166
+ return this.response;
1167
+ }
1168
+ return null;
1336
1169
  }
1337
- /**
1338
- * Disconnect OAuth provider
1339
- *
1340
- * Remove OAuth connection for the specified provider.
1341
- */
1342
- static cfgAccountsOauthDisconnectCreate(options) {
1343
- return (options.client ?? client).post({
1344
- security: [{ scheme: "bearer", type: "http" }],
1345
- url: "/cfg/accounts/oauth/disconnect/",
1346
- ...options,
1347
- headers: {
1348
- "Content-Type": "application/json",
1349
- ...options.headers
1350
- }
1351
- });
1170
+ get fieldErrors() {
1171
+ const details = this.details;
1172
+ if (!details) return null;
1173
+ const fieldErrors = {};
1174
+ for (const [key, value] of Object.entries(details)) {
1175
+ if (Array.isArray(value)) fieldErrors[key] = value;
1176
+ }
1177
+ return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
1352
1178
  }
1353
- /**
1354
- * Start GitHub OAuth
1355
- *
1356
- * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
1357
- */
1358
- static cfgAccountsOauthGithubAuthorizeCreate(options) {
1359
- return (options?.client ?? client).post({
1360
- url: "/cfg/accounts/oauth/github/authorize/",
1361
- ...options,
1362
- headers: {
1363
- "Content-Type": "application/json",
1364
- ...options?.headers
1365
- }
1366
- });
1179
+ get errorMessage() {
1180
+ const details = this.details;
1181
+ if (!details) return this.message;
1182
+ if (details.detail) {
1183
+ return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
1184
+ }
1185
+ if (details.error) return String(details.error);
1186
+ if (details.message) return String(details.message);
1187
+ const fieldErrors = this.fieldErrors;
1188
+ if (fieldErrors) {
1189
+ const firstField = Object.keys(fieldErrors)[0];
1190
+ if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
1191
+ }
1192
+ return this.message;
1367
1193
  }
1368
- /**
1369
- * Complete GitHub OAuth
1370
- *
1371
- * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
1372
- */
1373
- static cfgAccountsOauthGithubCallbackCreate(options) {
1374
- return (options.client ?? client).post({
1375
- url: "/cfg/accounts/oauth/github/callback/",
1376
- ...options,
1377
- headers: {
1378
- "Content-Type": "application/json",
1379
- ...options.headers
1380
- }
1381
- });
1194
+ get isValidationError() {
1195
+ return this.statusCode === 400;
1382
1196
  }
1383
- /**
1384
- * List OAuth providers
1385
- *
1386
- * Get list of available OAuth providers for authentication.
1387
- */
1388
- static cfgAccountsOauthProvidersRetrieve(options) {
1389
- return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
1197
+ get isAuthError() {
1198
+ return this.statusCode === 401;
1390
1199
  }
1391
- /**
1392
- * Request OTP code to email.
1393
- */
1394
- static cfgAccountsOtpRequestCreate(options) {
1395
- return (options.client ?? client).post({
1396
- security: [{ scheme: "bearer", type: "http" }],
1397
- url: "/cfg/accounts/otp/request/",
1398
- ...options,
1399
- headers: {
1400
- "Content-Type": "application/json",
1401
- ...options.headers
1402
- }
1403
- });
1200
+ get isPermissionError() {
1201
+ return this.statusCode === 403;
1404
1202
  }
1405
- /**
1406
- * Verify OTP code and return JWT tokens or 2FA session.
1407
- *
1408
- * If user has 2FA enabled:
1409
- * - Returns requires_2fa=True with session_id
1410
- * - Client must complete 2FA verification at /cfg/totp/verify/
1411
- *
1412
- * If user has no 2FA:
1413
- * - Returns JWT tokens and user data directly
1414
- */
1415
- static cfgAccountsOtpVerifyCreate(options) {
1416
- return (options.client ?? client).post({
1417
- security: [{ scheme: "bearer", type: "http" }],
1418
- url: "/cfg/accounts/otp/verify/",
1419
- ...options,
1420
- headers: {
1421
- "Content-Type": "application/json",
1422
- ...options.headers
1423
- }
1424
- });
1203
+ get isNotFoundError() {
1204
+ return this.statusCode === 404;
1425
1205
  }
1426
- /**
1427
- * Get current user profile
1428
- *
1429
- * Retrieve the current authenticated user's profile information.
1430
- */
1431
- static cfgAccountsProfileRetrieve(options) {
1432
- return (options?.client ?? client).get({
1433
- security: [{ scheme: "bearer", type: "http" }, {
1434
- in: "cookie",
1435
- name: "sessionid",
1436
- type: "apiKey"
1437
- }],
1438
- url: "/cfg/accounts/profile/",
1439
- ...options
1440
- });
1206
+ get isServerError() {
1207
+ return this.statusCode >= 500 && this.statusCode < 600;
1441
1208
  }
1442
- /**
1443
- * Upload user avatar
1444
- *
1445
- * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
1446
- */
1447
- static cfgAccountsProfileAvatarCreate(options) {
1448
- return (options?.client ?? client).post({
1449
- ...formDataBodySerializer,
1450
- security: [{ scheme: "bearer", type: "http" }],
1451
- url: "/cfg/accounts/profile/avatar/",
1452
- ...options,
1453
- headers: {
1454
- "Content-Type": null,
1455
- ...options?.headers
1456
- }
1209
+ };
1210
+ var NetworkError = class extends Error {
1211
+ constructor(message, url, originalError) {
1212
+ super(message);
1213
+ this.url = url;
1214
+ this.originalError = originalError;
1215
+ this.name = "NetworkError";
1216
+ }
1217
+ static {
1218
+ __name(this, "NetworkError");
1219
+ }
1220
+ };
1221
+
1222
+ // src/_api/generated/helpers/validation-events.ts
1223
+ function dispatchValidationError(detail) {
1224
+ if (typeof window === "undefined") return;
1225
+ try {
1226
+ const event = new CustomEvent("zod-validation-error", {
1227
+ detail,
1228
+ bubbles: true,
1229
+ cancelable: false
1457
1230
  });
1231
+ window.dispatchEvent(event);
1232
+ } catch (error) {
1233
+ console.warn("Failed to dispatch validation error event:", error);
1458
1234
  }
1459
- /**
1460
- * Delete user account
1461
- *
1462
- *
1463
- * Permanently delete the current user's account.
1464
- *
1465
- * This operation:
1466
- * - Deactivates the account (user cannot log in)
1467
- * - Anonymizes personal data (GDPR compliance)
1468
- * - Frees up the email address for re-registration
1469
- * - Preserves audit trail
1470
- *
1471
- * The account can be restored by an administrator if needed.
1235
+ }
1236
+ __name(dispatchValidationError, "dispatchValidationError");
1237
+ function onValidationError(callback) {
1238
+ if (typeof window === "undefined") return () => {
1239
+ };
1240
+ const handler = /* @__PURE__ */ __name((event) => {
1241
+ if (event instanceof CustomEvent) callback(event.detail);
1242
+ }, "handler");
1243
+ window.addEventListener("zod-validation-error", handler);
1244
+ return () => window.removeEventListener("zod-validation-error", handler);
1245
+ }
1246
+ __name(onValidationError, "onValidationError");
1247
+ function formatZodError(error) {
1248
+ const issues = error.issues.map((issue, index) => {
1249
+ const path = issue.path.join(".") || "root";
1250
+ const parts = [`${index + 1}. ${path}: ${issue.message}`];
1251
+ if ("expected" in issue && issue.expected) parts.push(` Expected: ${issue.expected}`);
1252
+ if ("received" in issue && issue.received) parts.push(` Received: ${issue.received}`);
1253
+ return parts.join("\n");
1254
+ });
1255
+ return issues.join("\n");
1256
+ }
1257
+ __name(formatZodError, "formatZodError");
1258
+
1259
+ // src/_api/generated/_cfg_centrifugo/api.ts
1260
+ var ACCESS_KEY2 = "cfg.access_token";
1261
+ var REFRESH_KEY2 = "cfg.refresh_token";
1262
+ function detectLocale2() {
1263
+ try {
1264
+ if (typeof document !== "undefined") {
1265
+ const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
1266
+ if (m) return decodeURIComponent(m[1]);
1267
+ }
1268
+ if (typeof navigator !== "undefined" && navigator.language) {
1269
+ return navigator.language;
1270
+ }
1271
+ } catch {
1272
+ }
1273
+ return null;
1274
+ }
1275
+ __name(detectLocale2, "detectLocale");
1276
+ var API2 = class {
1277
+ static {
1278
+ __name(this, "API");
1279
+ }
1280
+ baseUrl;
1281
+ storage;
1282
+ locale;
1283
+ apiKey;
1284
+ logger;
1285
+ constructor(baseUrl2, opts = {}) {
1286
+ this.baseUrl = baseUrl2.replace(/\/$/, "");
1287
+ this.storage = opts.storage ?? new LocalStorageAdapter();
1288
+ this.logger = new APILogger(opts.logger);
1289
+ this.locale = opts.locale ?? null;
1290
+ this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
1291
+ const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
1292
+ client.setConfig({ baseUrl: this.baseUrl, credentials });
1293
+ client.interceptors.request.use((request) => {
1294
+ const access = this.getToken();
1295
+ if (access) request.headers.set("Authorization", `Bearer ${access}`);
1296
+ const locale = this.locale ?? detectLocale2();
1297
+ if (locale) request.headers.set("Accept-Language", locale);
1298
+ if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
1299
+ return request;
1300
+ });
1301
+ }
1302
+ // ── Base URL ────────────────────────────────────────────────────────────
1303
+ getBaseUrl() {
1304
+ return this.baseUrl;
1305
+ }
1306
+ setBaseUrl(url) {
1307
+ this.baseUrl = url.replace(/\/$/, "");
1308
+ client.setConfig({ baseUrl: this.baseUrl });
1309
+ }
1310
+ // ── Tokens ──────────────────────────────────────────────────────────────
1311
+ getToken() {
1312
+ return this.storage.getItem(ACCESS_KEY2);
1313
+ }
1314
+ setToken(token) {
1315
+ if (token) this.storage.setItem(ACCESS_KEY2, token);
1316
+ else this.storage.removeItem(ACCESS_KEY2);
1317
+ }
1318
+ getRefreshToken() {
1319
+ return this.storage.getItem(REFRESH_KEY2);
1320
+ }
1321
+ setRefreshToken(token) {
1322
+ if (token) this.storage.setItem(REFRESH_KEY2, token);
1323
+ else this.storage.removeItem(REFRESH_KEY2);
1324
+ }
1325
+ clearToken() {
1326
+ this.storage.removeItem(ACCESS_KEY2);
1327
+ this.storage.removeItem(REFRESH_KEY2);
1328
+ }
1329
+ isAuthenticated() {
1330
+ return this.getToken() !== null;
1331
+ }
1332
+ // ── Locale / API key ────────────────────────────────────────────────────
1333
+ getLocale() {
1334
+ return this.locale ?? detectLocale2();
1335
+ }
1336
+ setLocale(locale) {
1337
+ this.locale = locale;
1338
+ }
1339
+ getApiKey() {
1340
+ return this.apiKey;
1341
+ }
1342
+ setApiKey(key) {
1343
+ this.apiKey = key;
1344
+ }
1345
+ };
1346
+
1347
+ // src/_api/generated/_cfg_totp/api.ts
1348
+ var ACCESS_KEY3 = "cfg.access_token";
1349
+ var REFRESH_KEY3 = "cfg.refresh_token";
1350
+ function detectLocale3() {
1351
+ try {
1352
+ if (typeof document !== "undefined") {
1353
+ const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
1354
+ if (m) return decodeURIComponent(m[1]);
1355
+ }
1356
+ if (typeof navigator !== "undefined" && navigator.language) {
1357
+ return navigator.language;
1358
+ }
1359
+ } catch {
1360
+ }
1361
+ return null;
1362
+ }
1363
+ __name(detectLocale3, "detectLocale");
1364
+ var API3 = class {
1365
+ static {
1366
+ __name(this, "API");
1367
+ }
1368
+ baseUrl;
1369
+ storage;
1370
+ locale;
1371
+ apiKey;
1372
+ logger;
1373
+ constructor(baseUrl2, opts = {}) {
1374
+ this.baseUrl = baseUrl2.replace(/\/$/, "");
1375
+ this.storage = opts.storage ?? new LocalStorageAdapter();
1376
+ this.logger = new APILogger(opts.logger);
1377
+ this.locale = opts.locale ?? null;
1378
+ this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
1379
+ const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
1380
+ client.setConfig({ baseUrl: this.baseUrl, credentials });
1381
+ client.interceptors.request.use((request) => {
1382
+ const access = this.getToken();
1383
+ if (access) request.headers.set("Authorization", `Bearer ${access}`);
1384
+ const locale = this.locale ?? detectLocale3();
1385
+ if (locale) request.headers.set("Accept-Language", locale);
1386
+ if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
1387
+ return request;
1388
+ });
1389
+ }
1390
+ // ── Base URL ────────────────────────────────────────────────────────────
1391
+ getBaseUrl() {
1392
+ return this.baseUrl;
1393
+ }
1394
+ setBaseUrl(url) {
1395
+ this.baseUrl = url.replace(/\/$/, "");
1396
+ client.setConfig({ baseUrl: this.baseUrl });
1397
+ }
1398
+ // ── Tokens ──────────────────────────────────────────────────────────────
1399
+ getToken() {
1400
+ return this.storage.getItem(ACCESS_KEY3);
1401
+ }
1402
+ setToken(token) {
1403
+ if (token) this.storage.setItem(ACCESS_KEY3, token);
1404
+ else this.storage.removeItem(ACCESS_KEY3);
1405
+ }
1406
+ getRefreshToken() {
1407
+ return this.storage.getItem(REFRESH_KEY3);
1408
+ }
1409
+ setRefreshToken(token) {
1410
+ if (token) this.storage.setItem(REFRESH_KEY3, token);
1411
+ else this.storage.removeItem(REFRESH_KEY3);
1412
+ }
1413
+ clearToken() {
1414
+ this.storage.removeItem(ACCESS_KEY3);
1415
+ this.storage.removeItem(REFRESH_KEY3);
1416
+ }
1417
+ isAuthenticated() {
1418
+ return this.getToken() !== null;
1419
+ }
1420
+ // ── Locale / API key ────────────────────────────────────────────────────
1421
+ getLocale() {
1422
+ return this.locale ?? detectLocale3();
1423
+ }
1424
+ setLocale(locale) {
1425
+ this.locale = locale;
1426
+ }
1427
+ getApiKey() {
1428
+ return this.apiKey;
1429
+ }
1430
+ setApiKey(key) {
1431
+ this.apiKey = key;
1432
+ }
1433
+ };
1434
+
1435
+ // src/_api/generated/index.ts
1436
+ var isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
1437
+ var baseUrl = isStaticBuild ? "" : process.env.NEXT_PUBLIC_API_URL || "";
1438
+ var CfgAccountsApi = new API(baseUrl, { storage: new LocalStorageAdapter() });
1439
+ var CfgCentrifugoApi = new API2(baseUrl, { storage: new LocalStorageAdapter() });
1440
+ var CfgTotpApi = new API3(baseUrl, { storage: new LocalStorageAdapter() });
1441
+
1442
+ // src/_api/generated/sdk.gen.ts
1443
+ var Cfg = class {
1444
+ static {
1445
+ __name(this, "Cfg");
1446
+ }
1447
+ /**
1448
+ * List OAuth connections
1472
1449
  *
1450
+ * Get all OAuth connections for the current user.
1473
1451
  */
1474
- static cfgAccountsProfileDeleteCreate(options) {
1475
- return (options?.client ?? client).post({
1476
- security: [{ scheme: "bearer", type: "http" }, {
1477
- in: "cookie",
1478
- name: "sessionid",
1479
- type: "apiKey"
1480
- }],
1481
- url: "/cfg/accounts/profile/delete/",
1452
+ static cfgAccountsOauthConnectionsList(options) {
1453
+ return (options?.client ?? client).get({
1454
+ security: [{ scheme: "bearer", type: "http" }],
1455
+ url: "/cfg/accounts/oauth/connections/",
1482
1456
  ...options
1483
1457
  });
1484
1458
  }
1485
1459
  /**
1486
- * Partial update user profile
1460
+ * Disconnect OAuth provider
1487
1461
  *
1488
- * Partially update the current authenticated user's profile information. Supports avatar upload.
1462
+ * Remove OAuth connection for the specified provider.
1489
1463
  */
1490
- static cfgAccountsProfilePartialPartialUpdate(options) {
1491
- return (options?.client ?? client).patch({
1492
- security: [{ scheme: "bearer", type: "http" }, {
1493
- in: "cookie",
1494
- name: "sessionid",
1495
- type: "apiKey"
1496
- }],
1497
- url: "/cfg/accounts/profile/partial/",
1464
+ static cfgAccountsOauthDisconnectCreate(options) {
1465
+ return (options.client ?? client).post({
1466
+ security: [{ scheme: "bearer", type: "http" }],
1467
+ url: "/cfg/accounts/oauth/disconnect/",
1498
1468
  ...options,
1499
1469
  headers: {
1500
1470
  "Content-Type": "application/json",
1501
- ...options?.headers
1471
+ ...options.headers
1502
1472
  }
1503
1473
  });
1504
1474
  }
1505
1475
  /**
1506
- * Partial update user profile
1476
+ * Start GitHub OAuth
1507
1477
  *
1508
- * Partially update the current authenticated user's profile information. Supports avatar upload.
1478
+ * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
1509
1479
  */
1510
- static cfgAccountsProfilePartialUpdate(options) {
1511
- return (options?.client ?? client).put({
1512
- security: [{ scheme: "bearer", type: "http" }, {
1513
- in: "cookie",
1514
- name: "sessionid",
1515
- type: "apiKey"
1516
- }],
1517
- url: "/cfg/accounts/profile/partial/",
1518
- ...options,
1519
- headers: {
1520
- "Content-Type": "application/json",
1521
- ...options?.headers
1522
- }
1523
- });
1524
- }
1525
- /**
1526
- * Update user profile
1527
- *
1528
- * Update the current authenticated user's profile information.
1529
- */
1530
- static cfgAccountsProfileUpdatePartialUpdate(options) {
1531
- return (options?.client ?? client).patch({
1532
- security: [{ scheme: "bearer", type: "http" }, {
1533
- in: "cookie",
1534
- name: "sessionid",
1535
- type: "apiKey"
1536
- }],
1537
- url: "/cfg/accounts/profile/update/",
1480
+ static cfgAccountsOauthGithubAuthorizeCreate(options) {
1481
+ return (options?.client ?? client).post({
1482
+ url: "/cfg/accounts/oauth/github/authorize/",
1538
1483
  ...options,
1539
1484
  headers: {
1540
1485
  "Content-Type": "application/json",
@@ -1543,31 +1488,13 @@ var Accounts = class {
1543
1488
  });
1544
1489
  }
1545
1490
  /**
1546
- * Update user profile
1491
+ * Complete GitHub OAuth
1547
1492
  *
1548
- * Update the current authenticated user's profile information.
1549
- */
1550
- static cfgAccountsProfileUpdateUpdate(options) {
1551
- return (options?.client ?? client).put({
1552
- security: [{ scheme: "bearer", type: "http" }, {
1553
- in: "cookie",
1554
- name: "sessionid",
1555
- type: "apiKey"
1556
- }],
1557
- url: "/cfg/accounts/profile/update/",
1558
- ...options,
1559
- headers: {
1560
- "Content-Type": "application/json",
1561
- ...options?.headers
1562
- }
1563
- });
1564
- }
1565
- /**
1566
- * Refresh JWT token.
1493
+ * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
1567
1494
  */
1568
- static cfgAccountsTokenRefreshCreate(options) {
1495
+ static cfgAccountsOauthGithubCallbackCreate(options) {
1569
1496
  return (options.client ?? client).post({
1570
- url: "/cfg/accounts/token/refresh/",
1497
+ url: "/cfg/accounts/oauth/github/callback/",
1571
1498
  ...options,
1572
1499
  headers: {
1573
1500
  "Content-Type": "application/json",
@@ -1575,32 +1502,21 @@ var Accounts = class {
1575
1502
  }
1576
1503
  });
1577
1504
  }
1578
- };
1579
- var OAuth = class {
1580
- static {
1581
- __name(this, "OAuth");
1582
- }
1583
1505
  /**
1584
- * List OAuth connections
1506
+ * List OAuth providers
1585
1507
  *
1586
- * Get all OAuth connections for the current user.
1508
+ * Get list of available OAuth providers for authentication.
1587
1509
  */
1588
- static cfgAccountsOauthConnectionsList(options) {
1589
- return (options?.client ?? client).get({
1590
- security: [{ scheme: "bearer", type: "http" }],
1591
- url: "/cfg/accounts/oauth/connections/",
1592
- ...options
1593
- });
1510
+ static cfgAccountsOauthProvidersRetrieve(options) {
1511
+ return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
1594
1512
  }
1595
1513
  /**
1596
- * Disconnect OAuth provider
1597
- *
1598
- * Remove OAuth connection for the specified provider.
1514
+ * Request OTP code to email.
1599
1515
  */
1600
- static cfgAccountsOauthDisconnectCreate(options) {
1516
+ static cfgAccountsOtpRequestCreate(options) {
1601
1517
  return (options.client ?? client).post({
1602
1518
  security: [{ scheme: "bearer", type: "http" }],
1603
- url: "/cfg/accounts/oauth/disconnect/",
1519
+ url: "/cfg/accounts/otp/request/",
1604
1520
  ...options,
1605
1521
  headers: {
1606
1522
  "Content-Type": "application/json",
@@ -1609,28 +1525,19 @@ var OAuth = class {
1609
1525
  });
1610
1526
  }
1611
1527
  /**
1612
- * Start GitHub OAuth
1528
+ * Verify OTP code and return JWT tokens or 2FA session.
1613
1529
  *
1614
- * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
1615
- */
1616
- static cfgAccountsOauthGithubAuthorizeCreate(options) {
1617
- return (options?.client ?? client).post({
1618
- url: "/cfg/accounts/oauth/github/authorize/",
1619
- ...options,
1620
- headers: {
1621
- "Content-Type": "application/json",
1622
- ...options?.headers
1623
- }
1624
- });
1625
- }
1626
- /**
1627
- * Complete GitHub OAuth
1530
+ * If user has 2FA enabled:
1531
+ * - Returns requires_2fa=True with session_id
1532
+ * - Client must complete 2FA verification at /cfg/totp/verify/
1628
1533
  *
1629
- * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
1534
+ * If user has no 2FA:
1535
+ * - Returns JWT tokens and user data directly
1630
1536
  */
1631
- static cfgAccountsOauthGithubCallbackCreate(options) {
1537
+ static cfgAccountsOtpVerifyCreate(options) {
1632
1538
  return (options.client ?? client).post({
1633
- url: "/cfg/accounts/oauth/github/callback/",
1539
+ security: [{ scheme: "bearer", type: "http" }],
1540
+ url: "/cfg/accounts/otp/verify/",
1634
1541
  ...options,
1635
1542
  headers: {
1636
1543
  "Content-Type": "application/json",
@@ -1638,19 +1545,6 @@ var OAuth = class {
1638
1545
  }
1639
1546
  });
1640
1547
  }
1641
- /**
1642
- * List OAuth providers
1643
- *
1644
- * Get list of available OAuth providers for authentication.
1645
- */
1646
- static cfgAccountsOauthProvidersRetrieve(options) {
1647
- return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
1648
- }
1649
- };
1650
- var UserProfile = class {
1651
- static {
1652
- __name(this, "UserProfile");
1653
- }
1654
1548
  /**
1655
1549
  * Get current user profile
1656
1550
  *
@@ -1790,11 +1684,6 @@ var UserProfile = class {
1790
1684
  }
1791
1685
  });
1792
1686
  }
1793
- };
1794
- var Auth = class {
1795
- static {
1796
- __name(this, "Auth");
1797
- }
1798
1687
  /**
1799
1688
  * Refresh JWT token.
1800
1689
  */
@@ -1808,2250 +1697,431 @@ var Auth = class {
1808
1697
  }
1809
1698
  });
1810
1699
  }
1811
- };
1812
-
1813
- // src/_api/generated/cfg_accounts/schemas/AccountDeleteResponse.ts
1814
- var import_zod = require("zod");
1815
- var AccountDeleteResponseSchema = import_zod.z.object({
1816
- success: import_zod.z.boolean(),
1817
- message: import_zod.z.string()
1818
- });
1819
-
1820
- // src/_api/generated/cfg_accounts/schemas/CentrifugoToken.ts
1821
- var import_zod2 = require("zod");
1822
- var CentrifugoTokenSchema = import_zod2.z.object({
1823
- token: import_zod2.z.string(),
1824
- centrifugo_url: import_zod2.z.string(),
1825
- expires_at: import_zod2.z.string().datetime({ offset: true }),
1826
- channels: import_zod2.z.array(import_zod2.z.string())
1827
- });
1828
-
1829
- // src/_api/generated/cfg_accounts/schemas/CfgUserUpdateRequest.ts
1830
- var import_zod3 = require("zod");
1831
- var CfgUserUpdateRequestSchema = import_zod3.z.object({
1832
- first_name: import_zod3.z.string().max(50).optional(),
1833
- last_name: import_zod3.z.string().max(50).optional(),
1834
- company: import_zod3.z.string().max(100).optional(),
1835
- phone: import_zod3.z.string().max(20).optional(),
1836
- position: import_zod3.z.string().max(100).optional(),
1837
- language: import_zod3.z.string().max(10).optional()
1838
- });
1839
-
1840
- // src/_api/generated/cfg_accounts/schemas/OAuthAuthorizeRequestRequest.ts
1841
- var import_zod4 = require("zod");
1842
- var OAuthAuthorizeRequestRequestSchema = import_zod4.z.object({
1843
- redirect_uri: import_zod4.z.string().optional(),
1844
- source_url: import_zod4.z.string().optional()
1845
- });
1846
-
1847
- // src/_api/generated/cfg_accounts/schemas/OAuthAuthorizeResponse.ts
1848
- var import_zod5 = require("zod");
1849
- var OAuthAuthorizeResponseSchema = import_zod5.z.object({
1850
- authorization_url: import_zod5.z.string(),
1851
- state: import_zod5.z.string()
1852
- });
1853
-
1854
- // src/_api/generated/cfg_accounts/schemas/OAuthCallbackRequestRequest.ts
1855
- var import_zod6 = require("zod");
1856
- var OAuthCallbackRequestRequestSchema = import_zod6.z.object({
1857
- code: import_zod6.z.string().min(10).max(500),
1858
- state: import_zod6.z.string().min(20).max(100),
1859
- redirect_uri: import_zod6.z.string().optional()
1860
- });
1861
-
1862
- // src/_api/generated/cfg_accounts/schemas/OAuthConnection.ts
1863
- var import_zod8 = require("zod");
1864
-
1865
- // src/_api/generated/cfg_accounts/schemas/ProviderEnum.ts
1866
- var import_zod7 = require("zod");
1867
- var ProviderEnumSchema = import_zod7.z.enum(["github"]);
1868
-
1869
- // src/_api/generated/cfg_accounts/schemas/OAuthConnection.ts
1870
- var OAuthConnectionSchema = import_zod8.z.object({
1871
- id: import_zod8.z.number().int(),
1872
- provider: ProviderEnumSchema,
1873
- provider_display: import_zod8.z.string(),
1874
- provider_username: import_zod8.z.string(),
1875
- provider_email: import_zod8.z.email(),
1876
- provider_avatar_url: import_zod8.z.string(),
1877
- connected_at: import_zod8.z.string().datetime({ offset: true }),
1878
- last_login_at: import_zod8.z.string().datetime({ offset: true })
1879
- });
1880
-
1881
- // src/_api/generated/cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts
1882
- var import_zod9 = require("zod");
1883
- var OAuthDisconnectRequestRequestSchema = import_zod9.z.object({
1884
- provider: ProviderEnumSchema
1885
- });
1886
-
1887
- // src/_api/generated/cfg_accounts/schemas/OAuthError.ts
1888
- var import_zod10 = require("zod");
1889
- var OAuthErrorSchema = import_zod10.z.object({
1890
- error: import_zod10.z.string(),
1891
- error_description: import_zod10.z.string().optional()
1892
- });
1893
-
1894
- // src/_api/generated/cfg_accounts/schemas/OAuthProvidersResponse.ts
1895
- var import_zod11 = require("zod");
1896
- var OAuthProvidersResponseSchema = import_zod11.z.object({
1897
- providers: import_zod11.z.array(import_zod11.z.object({}))
1898
- });
1899
-
1900
- // src/_api/generated/cfg_accounts/schemas/OAuthTokenResponse.ts
1901
- var import_zod12 = require("zod");
1902
- var OAuthTokenResponseSchema = import_zod12.z.object({
1903
- requires_2fa: import_zod12.z.boolean().optional(),
1904
- session_id: import_zod12.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
1905
- access: import_zod12.z.string().nullable().optional(),
1906
- refresh: import_zod12.z.string().nullable().optional(),
1907
- user: import_zod12.z.object({}).nullable().optional(),
1908
- is_new_user: import_zod12.z.boolean(),
1909
- is_new_connection: import_zod12.z.boolean(),
1910
- should_prompt_2fa: import_zod12.z.boolean().optional()
1911
- });
1912
-
1913
- // src/_api/generated/cfg_accounts/schemas/OTPErrorResponse.ts
1914
- var import_zod13 = require("zod");
1915
- var OTPErrorResponseSchema = import_zod13.z.object({
1916
- error: import_zod13.z.string(),
1917
- error_code: import_zod13.z.string().nullable().optional(),
1918
- retry_after: import_zod13.z.number().int().nullable().optional()
1919
- });
1920
-
1921
- // src/_api/generated/cfg_accounts/schemas/OTPRequestRequest.ts
1922
- var import_zod14 = require("zod");
1923
- var OTPRequestRequestSchema = import_zod14.z.object({
1924
- identifier: import_zod14.z.string().min(1),
1925
- source_url: import_zod14.z.string().optional()
1926
- });
1927
-
1928
- // src/_api/generated/cfg_accounts/schemas/OTPRequestResponse.ts
1929
- var import_zod15 = require("zod");
1930
- var OTPRequestResponseSchema = import_zod15.z.object({
1931
- message: import_zod15.z.string()
1932
- });
1933
-
1934
- // src/_api/generated/cfg_accounts/schemas/OTPVerifyRequest.ts
1935
- var import_zod16 = require("zod");
1936
- var OTPVerifyRequestSchema = import_zod16.z.object({
1937
- identifier: import_zod16.z.string().min(1),
1938
- otp: import_zod16.z.string().min(6).max(6),
1939
- source_url: import_zod16.z.string().optional()
1940
- });
1941
-
1942
- // src/_api/generated/cfg_accounts/schemas/OTPVerifyResponse.ts
1943
- var import_zod18 = require("zod");
1944
-
1945
- // src/_api/generated/cfg_accounts/schemas/User.ts
1946
- var import_zod17 = require("zod");
1947
- var UserSchema = import_zod17.z.object({
1948
- id: import_zod17.z.number().int(),
1949
- email: import_zod17.z.email(),
1950
- first_name: import_zod17.z.string().max(50).optional(),
1951
- last_name: import_zod17.z.string().max(50).optional(),
1952
- full_name: import_zod17.z.string(),
1953
- initials: import_zod17.z.string(),
1954
- display_username: import_zod17.z.string(),
1955
- company: import_zod17.z.string().max(100).optional(),
1956
- phone: import_zod17.z.string().max(20).optional(),
1957
- position: import_zod17.z.string().max(100).optional(),
1958
- language: import_zod17.z.string().max(10).optional(),
1959
- avatar: import_zod17.z.string().nullable(),
1960
- is_staff: import_zod17.z.boolean(),
1961
- is_superuser: import_zod17.z.boolean(),
1962
- date_joined: import_zod17.z.string().datetime({ offset: true }),
1963
- last_login: import_zod17.z.string().datetime({ offset: true }).nullable(),
1964
- unanswered_messages_count: import_zod17.z.number().int(),
1965
- centrifugo: CentrifugoTokenSchema.nullable()
1966
- });
1967
-
1968
- // src/_api/generated/cfg_accounts/schemas/OTPVerifyResponse.ts
1969
- var OTPVerifyResponseSchema = import_zod18.z.object({
1970
- requires_2fa: import_zod18.z.boolean().optional(),
1971
- session_id: import_zod18.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
1972
- refresh: import_zod18.z.string().nullable().optional(),
1973
- access: import_zod18.z.string().nullable().optional(),
1974
- user: UserSchema.nullable().optional(),
1975
- should_prompt_2fa: import_zod18.z.boolean().optional()
1976
- });
1977
-
1978
- // src/_api/generated/cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts
1979
- var import_zod19 = require("zod");
1980
- var PatchedCfgUserUpdateRequestSchema = import_zod19.z.object({
1981
- first_name: import_zod19.z.string().max(50).optional(),
1982
- last_name: import_zod19.z.string().max(50).optional(),
1983
- company: import_zod19.z.string().max(100).optional(),
1984
- phone: import_zod19.z.string().max(20).optional(),
1985
- position: import_zod19.z.string().max(100).optional(),
1986
- language: import_zod19.z.string().max(10).optional()
1987
- });
1988
-
1989
- // src/_api/generated/cfg_accounts/schemas/TokenRefresh.ts
1990
- var import_zod20 = require("zod");
1991
- var TokenRefreshSchema = import_zod20.z.object({
1992
- access: import_zod20.z.string(),
1993
- refresh: import_zod20.z.string()
1994
- });
1995
-
1996
- // src/_api/generated/cfg_accounts/schemas/TokenRefreshRequest.ts
1997
- var import_zod21 = require("zod");
1998
- var TokenRefreshRequestSchema = import_zod21.z.object({
1999
- refresh: import_zod21.z.string().min(1)
2000
- });
2001
-
2002
- // src/_api/generated/_shared/validation-events.ts
2003
- function dispatchValidationError(detail) {
2004
- if (typeof window === "undefined") return;
2005
- try {
2006
- const event = new CustomEvent("zod-validation-error", {
2007
- detail,
2008
- bubbles: true,
2009
- cancelable: false
1700
+ /**
1701
+ * Get Centrifugo connection token
1702
+ *
1703
+ * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
1704
+ */
1705
+ static cfgCentrifugoAuthTokenRetrieve(options) {
1706
+ return (options?.client ?? client).get({
1707
+ security: [{ scheme: "bearer", type: "http" }],
1708
+ url: "/cfg/centrifugo/auth/token/",
1709
+ ...options
2010
1710
  });
2011
- window.dispatchEvent(event);
2012
- } catch (error) {
2013
- console.warn("Failed to dispatch validation error event:", error);
2014
1711
  }
2015
- }
2016
- __name(dispatchValidationError, "dispatchValidationError");
2017
- function onValidationError(callback) {
2018
- if (typeof window === "undefined") return () => {
2019
- };
2020
- const handler = /* @__PURE__ */ __name((event) => {
2021
- if (event instanceof CustomEvent) callback(event.detail);
2022
- }, "handler");
2023
- window.addEventListener("zod-validation-error", handler);
2024
- return () => window.removeEventListener("zod-validation-error", handler);
2025
- }
2026
- __name(onValidationError, "onValidationError");
2027
- function formatZodError(error) {
2028
- const issues = error.issues.map((issue, index) => {
2029
- const path = issue.path.join(".") || "root";
2030
- const parts = [`${index + 1}. ${path}: ${issue.message}`];
2031
- if ("expected" in issue && issue.expected) parts.push(` Expected: ${issue.expected}`);
2032
- if ("received" in issue && issue.received) parts.push(` Received: ${issue.received}`);
2033
- return parts.join("\n");
2034
- });
2035
- return issues.join("\n");
2036
- }
2037
- __name(formatZodError, "formatZodError");
2038
-
2039
- // src/_api/generated/cfg_accounts/api.ts
2040
- var ACCESS_KEY = "cfg.access_token";
2041
- var REFRESH_KEY = "cfg.refresh_token";
2042
- var VALIDATION_ROUTES = [
2043
- { method: "POST", re: new RegExp("^/cfg/accounts/oauth/github/authorize/?$"), schema: OAuthAuthorizeResponseSchema, path: "/cfg/accounts/oauth/github/authorize/" },
2044
- { method: "POST", re: new RegExp("^/cfg/accounts/oauth/github/callback/?$"), schema: OAuthTokenResponseSchema, path: "/cfg/accounts/oauth/github/callback/" },
2045
- { method: "GET", re: new RegExp("^/cfg/accounts/oauth/providers/?$"), schema: OAuthProvidersResponseSchema, path: "/cfg/accounts/oauth/providers/" },
2046
- { method: "POST", re: new RegExp("^/cfg/accounts/otp/request/?$"), schema: OTPRequestResponseSchema, path: "/cfg/accounts/otp/request/" },
2047
- { method: "POST", re: new RegExp("^/cfg/accounts/otp/verify/?$"), schema: OTPVerifyResponseSchema, path: "/cfg/accounts/otp/verify/" },
2048
- { method: "GET", re: new RegExp("^/cfg/accounts/profile/?$"), schema: UserSchema, path: "/cfg/accounts/profile/" },
2049
- { method: "POST", re: new RegExp("^/cfg/accounts/profile/avatar/?$"), schema: UserSchema, path: "/cfg/accounts/profile/avatar/" },
2050
- { method: "POST", re: new RegExp("^/cfg/accounts/profile/delete/?$"), schema: AccountDeleteResponseSchema, path: "/cfg/accounts/profile/delete/" },
2051
- { method: "PUT", re: new RegExp("^/cfg/accounts/profile/partial/?$"), schema: UserSchema, path: "/cfg/accounts/profile/partial/" },
2052
- { method: "PATCH", re: new RegExp("^/cfg/accounts/profile/partial/?$"), schema: UserSchema, path: "/cfg/accounts/profile/partial/" },
2053
- { method: "PUT", re: new RegExp("^/cfg/accounts/profile/update/?$"), schema: UserSchema, path: "/cfg/accounts/profile/update/" },
2054
- { method: "PATCH", re: new RegExp("^/cfg/accounts/profile/update/?$"), schema: UserSchema, path: "/cfg/accounts/profile/update/" },
2055
- { method: "POST", re: new RegExp("^/cfg/accounts/token/refresh/?$"), schema: TokenRefreshSchema, path: "/cfg/accounts/token/refresh/" }
2056
- ];
2057
- function detectLocale() {
2058
- try {
2059
- if (typeof document !== "undefined") {
2060
- const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
2061
- if (m) return decodeURIComponent(m[1]);
2062
- }
2063
- if (typeof navigator !== "undefined" && navigator.language) {
2064
- return navigator.language;
2065
- }
2066
- } catch {
1712
+ /**
1713
+ * Get backup codes status for user.
1714
+ */
1715
+ static cfgTotpBackupCodesRetrieve(options) {
1716
+ return (options?.client ?? client).get({
1717
+ security: [{ scheme: "bearer", type: "http" }],
1718
+ url: "/cfg/totp/backup-codes/",
1719
+ ...options
1720
+ });
2067
1721
  }
2068
- return null;
2069
- }
2070
- __name(detectLocale, "detectLocale");
2071
- var API = class {
2072
- static {
2073
- __name(this, "API");
1722
+ /**
1723
+ * Regenerate backup codes.
1724
+ *
1725
+ * Requires TOTP code for verification.
1726
+ * Invalidates all existing codes.
1727
+ */
1728
+ static cfgTotpBackupCodesRegenerateCreate(options) {
1729
+ return (options.client ?? client).post({
1730
+ security: [{ scheme: "bearer", type: "http" }],
1731
+ url: "/cfg/totp/backup-codes/regenerate/",
1732
+ ...options,
1733
+ headers: {
1734
+ "Content-Type": "application/json",
1735
+ ...options.headers
1736
+ }
1737
+ });
2074
1738
  }
2075
- baseUrl;
2076
- storage;
2077
- locale;
2078
- apiKey;
2079
- logger;
2080
- cfg = Cfg;
2081
- accounts = Accounts;
2082
- oAuth = OAuth;
2083
- userProfile = UserProfile;
2084
- auth = Auth;
2085
- constructor(baseUrl2, opts = {}) {
2086
- this.baseUrl = baseUrl2.replace(/\/$/, "");
2087
- this.storage = opts.storage ?? new LocalStorageAdapter();
2088
- this.logger = new APILogger(opts.logger);
2089
- this.locale = opts.locale ?? null;
2090
- this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
2091
- const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
2092
- client.setConfig({ baseUrl: this.baseUrl, credentials });
2093
- client.interceptors.request.use((request) => {
2094
- const access = this.getToken();
2095
- if (access) request.headers.set("Authorization", `Bearer ${access}`);
2096
- const locale = this.locale ?? detectLocale();
2097
- if (locale) request.headers.set("Accept-Language", locale);
2098
- if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
2099
- return request;
1739
+ /**
1740
+ * List all TOTP devices for user.
1741
+ */
1742
+ static cfgTotpDevicesRetrieve(options) {
1743
+ return (options?.client ?? client).get({
1744
+ security: [{ scheme: "bearer", type: "http" }],
1745
+ url: "/cfg/totp/devices/",
1746
+ ...options
2100
1747
  });
2101
- client.interceptors.response.use(async (response, request) => {
2102
- if (!response.ok) return response;
2103
- const ct = response.headers.get("content-type") || "";
2104
- if (!ct.includes("application/json")) return response;
2105
- const url = new URL(request.url);
2106
- const method = request.method.toUpperCase();
2107
- const route = VALIDATION_ROUTES.find(
2108
- (r) => r.method === method && r.re.test(url.pathname)
2109
- );
2110
- if (!route) return response;
2111
- let payload;
2112
- try {
2113
- payload = await response.clone().json();
2114
- } catch {
2115
- return response;
2116
- }
2117
- const result = route.schema.safeParse(payload);
2118
- if (!result.success) {
2119
- dispatchValidationError({
2120
- operation: `${method} ${route.path}`,
2121
- path: route.path,
2122
- method,
2123
- error: result.error,
2124
- response: payload,
2125
- timestamp: /* @__PURE__ */ new Date()
2126
- });
2127
- }
2128
- return response;
1748
+ }
1749
+ /**
1750
+ * Delete a TOTP device.
1751
+ *
1752
+ * Requires verification code if removing the last/primary device.
1753
+ */
1754
+ static cfgTotpDevicesDestroy(options) {
1755
+ return (options.client ?? client).delete({
1756
+ security: [{ scheme: "bearer", type: "http" }],
1757
+ url: "/cfg/totp/devices/{id}/",
1758
+ ...options
2129
1759
  });
2130
1760
  }
2131
- // ── Base URL ────────────────────────────────────────────────────────────
2132
- getBaseUrl() {
2133
- return this.baseUrl;
1761
+ /**
1762
+ * Completely disable 2FA for account.
1763
+ *
1764
+ * Requires verification code.
1765
+ */
1766
+ static cfgTotpDisableCreate(options) {
1767
+ return (options.client ?? client).post({
1768
+ security: [{ scheme: "bearer", type: "http" }],
1769
+ url: "/cfg/totp/disable/",
1770
+ ...options,
1771
+ headers: {
1772
+ "Content-Type": "application/json",
1773
+ ...options.headers
1774
+ }
1775
+ });
2134
1776
  }
2135
- setBaseUrl(url) {
2136
- this.baseUrl = url.replace(/\/$/, "");
2137
- client.setConfig({ baseUrl: this.baseUrl });
1777
+ /**
1778
+ * Start 2FA setup process.
1779
+ *
1780
+ * Creates a new TOTP device and returns QR code for scanning.
1781
+ */
1782
+ static cfgTotpSetupCreate(options) {
1783
+ return (options?.client ?? client).post({
1784
+ security: [{ scheme: "bearer", type: "http" }],
1785
+ url: "/cfg/totp/setup/",
1786
+ ...options,
1787
+ headers: {
1788
+ "Content-Type": "application/json",
1789
+ ...options?.headers
1790
+ }
1791
+ });
2138
1792
  }
2139
- // ── Tokens ──────────────────────────────────────────────────────────────
2140
- getToken() {
2141
- return this.storage.getItem(ACCESS_KEY);
1793
+ /**
1794
+ * Confirm 2FA setup with first valid code.
1795
+ *
1796
+ * Activates the device and generates backup codes.
1797
+ */
1798
+ static cfgTotpSetupConfirmCreate(options) {
1799
+ return (options.client ?? client).post({
1800
+ security: [{ scheme: "bearer", type: "http" }],
1801
+ url: "/cfg/totp/setup/confirm/",
1802
+ ...options,
1803
+ headers: {
1804
+ "Content-Type": "application/json",
1805
+ ...options.headers
1806
+ }
1807
+ });
2142
1808
  }
2143
- setToken(token) {
2144
- if (token) this.storage.setItem(ACCESS_KEY, token);
2145
- else this.storage.removeItem(ACCESS_KEY);
1809
+ /**
1810
+ * Verify TOTP code for 2FA session.
1811
+ *
1812
+ * Completes authentication and returns JWT tokens on success.
1813
+ */
1814
+ static cfgTotpVerifyCreate(options) {
1815
+ return (options.client ?? client).post({
1816
+ security: [{ scheme: "bearer", type: "http" }],
1817
+ url: "/cfg/totp/verify/",
1818
+ ...options,
1819
+ headers: {
1820
+ "Content-Type": "application/json",
1821
+ ...options.headers
1822
+ }
1823
+ });
2146
1824
  }
2147
- getRefreshToken() {
2148
- return this.storage.getItem(REFRESH_KEY);
1825
+ /**
1826
+ * Verify backup recovery code for 2FA session.
1827
+ *
1828
+ * Alternative verification method when TOTP device unavailable.
1829
+ */
1830
+ static cfgTotpVerifyBackupCreate(options) {
1831
+ return (options.client ?? client).post({
1832
+ security: [{ scheme: "bearer", type: "http" }],
1833
+ url: "/cfg/totp/verify/backup/",
1834
+ ...options,
1835
+ headers: {
1836
+ "Content-Type": "application/json",
1837
+ ...options.headers
1838
+ }
1839
+ });
2149
1840
  }
2150
- setRefreshToken(token) {
2151
- if (token) this.storage.setItem(REFRESH_KEY, token);
2152
- else this.storage.removeItem(REFRESH_KEY);
1841
+ };
1842
+ var Accounts = class {
1843
+ static {
1844
+ __name(this, "Accounts");
2153
1845
  }
2154
- clearToken() {
2155
- this.storage.removeItem(ACCESS_KEY);
2156
- this.storage.removeItem(REFRESH_KEY);
1846
+ /**
1847
+ * List OAuth connections
1848
+ *
1849
+ * Get all OAuth connections for the current user.
1850
+ */
1851
+ static cfgAccountsOauthConnectionsList(options) {
1852
+ return (options?.client ?? client).get({
1853
+ security: [{ scheme: "bearer", type: "http" }],
1854
+ url: "/cfg/accounts/oauth/connections/",
1855
+ ...options
1856
+ });
2157
1857
  }
2158
- isAuthenticated() {
2159
- return this.getToken() !== null;
1858
+ /**
1859
+ * Disconnect OAuth provider
1860
+ *
1861
+ * Remove OAuth connection for the specified provider.
1862
+ */
1863
+ static cfgAccountsOauthDisconnectCreate(options) {
1864
+ return (options.client ?? client).post({
1865
+ security: [{ scheme: "bearer", type: "http" }],
1866
+ url: "/cfg/accounts/oauth/disconnect/",
1867
+ ...options,
1868
+ headers: {
1869
+ "Content-Type": "application/json",
1870
+ ...options.headers
1871
+ }
1872
+ });
2160
1873
  }
2161
- // ── Locale / API key ────────────────────────────────────────────────────
2162
- getLocale() {
2163
- return this.locale ?? detectLocale();
1874
+ /**
1875
+ * Start GitHub OAuth
1876
+ *
1877
+ * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
1878
+ */
1879
+ static cfgAccountsOauthGithubAuthorizeCreate(options) {
1880
+ return (options?.client ?? client).post({
1881
+ url: "/cfg/accounts/oauth/github/authorize/",
1882
+ ...options,
1883
+ headers: {
1884
+ "Content-Type": "application/json",
1885
+ ...options?.headers
1886
+ }
1887
+ });
2164
1888
  }
2165
- setLocale(locale) {
2166
- this.locale = locale;
1889
+ /**
1890
+ * Complete GitHub OAuth
1891
+ *
1892
+ * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
1893
+ */
1894
+ static cfgAccountsOauthGithubCallbackCreate(options) {
1895
+ return (options.client ?? client).post({
1896
+ url: "/cfg/accounts/oauth/github/callback/",
1897
+ ...options,
1898
+ headers: {
1899
+ "Content-Type": "application/json",
1900
+ ...options.headers
1901
+ }
1902
+ });
2167
1903
  }
2168
- getApiKey() {
2169
- return this.apiKey;
1904
+ /**
1905
+ * List OAuth providers
1906
+ *
1907
+ * Get list of available OAuth providers for authentication.
1908
+ */
1909
+ static cfgAccountsOauthProvidersRetrieve(options) {
1910
+ return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
2170
1911
  }
2171
- setApiKey(key) {
2172
- this.apiKey = key;
1912
+ /**
1913
+ * Request OTP code to email.
1914
+ */
1915
+ static cfgAccountsOtpRequestCreate(options) {
1916
+ return (options.client ?? client).post({
1917
+ security: [{ scheme: "bearer", type: "http" }],
1918
+ url: "/cfg/accounts/otp/request/",
1919
+ ...options,
1920
+ headers: {
1921
+ "Content-Type": "application/json",
1922
+ ...options.headers
1923
+ }
1924
+ });
2173
1925
  }
2174
- };
2175
-
2176
- // src/_api/generated/_shared/errors.ts
2177
- var APIError = class extends Error {
2178
- constructor(statusCode, statusText, response, url, message) {
2179
- super(message || `HTTP ${statusCode}: ${statusText}`);
2180
- this.statusCode = statusCode;
2181
- this.statusText = statusText;
2182
- this.response = response;
2183
- this.url = url;
2184
- this.name = "APIError";
1926
+ /**
1927
+ * Verify OTP code and return JWT tokens or 2FA session.
1928
+ *
1929
+ * If user has 2FA enabled:
1930
+ * - Returns requires_2fa=True with session_id
1931
+ * - Client must complete 2FA verification at /cfg/totp/verify/
1932
+ *
1933
+ * If user has no 2FA:
1934
+ * - Returns JWT tokens and user data directly
1935
+ */
1936
+ static cfgAccountsOtpVerifyCreate(options) {
1937
+ return (options.client ?? client).post({
1938
+ security: [{ scheme: "bearer", type: "http" }],
1939
+ url: "/cfg/accounts/otp/verify/",
1940
+ ...options,
1941
+ headers: {
1942
+ "Content-Type": "application/json",
1943
+ ...options.headers
1944
+ }
1945
+ });
2185
1946
  }
2186
- static {
2187
- __name(this, "APIError");
2188
- }
2189
- get details() {
2190
- if (typeof this.response === "object" && this.response !== null) {
2191
- return this.response;
2192
- }
2193
- return null;
2194
- }
2195
- get fieldErrors() {
2196
- const details = this.details;
2197
- if (!details) return null;
2198
- const fieldErrors = {};
2199
- for (const [key, value] of Object.entries(details)) {
2200
- if (Array.isArray(value)) fieldErrors[key] = value;
2201
- }
2202
- return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
2203
- }
2204
- get errorMessage() {
2205
- const details = this.details;
2206
- if (!details) return this.message;
2207
- if (details.detail) {
2208
- return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
2209
- }
2210
- if (details.error) return String(details.error);
2211
- if (details.message) return String(details.message);
2212
- const fieldErrors = this.fieldErrors;
2213
- if (fieldErrors) {
2214
- const firstField = Object.keys(fieldErrors)[0];
2215
- if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
2216
- }
2217
- return this.message;
2218
- }
2219
- get isValidationError() {
2220
- return this.statusCode === 400;
2221
- }
2222
- get isAuthError() {
2223
- return this.statusCode === 401;
2224
- }
2225
- get isPermissionError() {
2226
- return this.statusCode === 403;
2227
- }
2228
- get isNotFoundError() {
2229
- return this.statusCode === 404;
2230
- }
2231
- get isServerError() {
2232
- return this.statusCode >= 500 && this.statusCode < 600;
2233
- }
2234
- };
2235
- var NetworkError = class extends Error {
2236
- constructor(message, url, originalError) {
2237
- super(message);
2238
- this.url = url;
2239
- this.originalError = originalError;
2240
- this.name = "NetworkError";
2241
- }
2242
- static {
2243
- __name(this, "NetworkError");
2244
- }
2245
- };
2246
-
2247
- // src/_api/generated/cfg_centrifugo/core/bodySerializer.gen.ts
2248
- var jsonBodySerializer2 = {
2249
- bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
2250
- };
2251
-
2252
- // src/_api/generated/cfg_centrifugo/core/params.gen.ts
2253
- var extraPrefixesMap2 = {
2254
- $body_: "body",
2255
- $headers_: "headers",
2256
- $path_: "path",
2257
- $query_: "query"
2258
- };
2259
- var extraPrefixes2 = Object.entries(extraPrefixesMap2);
2260
-
2261
- // src/_api/generated/cfg_centrifugo/core/serverSentEvents.gen.ts
2262
- function createSseClient2({
2263
- onRequest,
2264
- onSseError,
2265
- onSseEvent,
2266
- responseTransformer,
2267
- responseValidator,
2268
- sseDefaultRetryDelay,
2269
- sseMaxRetryAttempts,
2270
- sseMaxRetryDelay,
2271
- sseSleepFn,
2272
- url,
2273
- ...options
2274
- }) {
2275
- let lastEventId;
2276
- const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
2277
- const createStream = /* @__PURE__ */ __name(async function* () {
2278
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
2279
- let attempt = 0;
2280
- const signal = options.signal ?? new AbortController().signal;
2281
- while (true) {
2282
- if (signal.aborted) break;
2283
- attempt++;
2284
- const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
2285
- if (lastEventId !== void 0) {
2286
- headers.set("Last-Event-ID", lastEventId);
2287
- }
2288
- try {
2289
- const requestInit = {
2290
- redirect: "follow",
2291
- ...options,
2292
- body: options.serializedBody,
2293
- headers,
2294
- signal
2295
- };
2296
- let request = new Request(url, requestInit);
2297
- if (onRequest) {
2298
- request = await onRequest(url, requestInit);
2299
- }
2300
- const _fetch = options.fetch ?? globalThis.fetch;
2301
- const response = await _fetch(request);
2302
- if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
2303
- if (!response.body) throw new Error("No body in SSE response");
2304
- const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
2305
- let buffer = "";
2306
- const abortHandler = /* @__PURE__ */ __name(() => {
2307
- try {
2308
- reader.cancel();
2309
- } catch {
2310
- }
2311
- }, "abortHandler");
2312
- signal.addEventListener("abort", abortHandler);
2313
- try {
2314
- while (true) {
2315
- const { done, value } = await reader.read();
2316
- if (done) break;
2317
- buffer += value;
2318
- buffer = buffer.replace(/\r\n?/g, "\n");
2319
- const chunks = buffer.split("\n\n");
2320
- buffer = chunks.pop() ?? "";
2321
- for (const chunk of chunks) {
2322
- const lines = chunk.split("\n");
2323
- const dataLines = [];
2324
- let eventName;
2325
- for (const line of lines) {
2326
- if (line.startsWith("data:")) {
2327
- dataLines.push(line.replace(/^data:\s*/, ""));
2328
- } else if (line.startsWith("event:")) {
2329
- eventName = line.replace(/^event:\s*/, "");
2330
- } else if (line.startsWith("id:")) {
2331
- lastEventId = line.replace(/^id:\s*/, "");
2332
- } else if (line.startsWith("retry:")) {
2333
- const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
2334
- if (!Number.isNaN(parsed)) {
2335
- retryDelay = parsed;
2336
- }
2337
- }
2338
- }
2339
- let data;
2340
- let parsedJson = false;
2341
- if (dataLines.length) {
2342
- const rawData = dataLines.join("\n");
2343
- try {
2344
- data = JSON.parse(rawData);
2345
- parsedJson = true;
2346
- } catch {
2347
- data = rawData;
2348
- }
2349
- }
2350
- if (parsedJson) {
2351
- if (responseValidator) {
2352
- await responseValidator(data);
2353
- }
2354
- if (responseTransformer) {
2355
- data = await responseTransformer(data);
2356
- }
2357
- }
2358
- onSseEvent?.({
2359
- data,
2360
- event: eventName,
2361
- id: lastEventId,
2362
- retry: retryDelay
2363
- });
2364
- if (dataLines.length) {
2365
- yield data;
2366
- }
2367
- }
2368
- }
2369
- } finally {
2370
- signal.removeEventListener("abort", abortHandler);
2371
- reader.releaseLock();
2372
- }
2373
- break;
2374
- } catch (error) {
2375
- onSseError?.(error);
2376
- if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
2377
- break;
2378
- }
2379
- const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
2380
- await sleep(backoff);
2381
- }
2382
- }
2383
- }, "createStream");
2384
- const stream = createStream();
2385
- return { stream };
2386
- }
2387
- __name(createSseClient2, "createSseClient");
2388
-
2389
- // src/_api/generated/cfg_centrifugo/core/pathSerializer.gen.ts
2390
- var separatorArrayExplode2 = /* @__PURE__ */ __name((style) => {
2391
- switch (style) {
2392
- case "label":
2393
- return ".";
2394
- case "matrix":
2395
- return ";";
2396
- case "simple":
2397
- return ",";
2398
- default:
2399
- return "&";
2400
- }
2401
- }, "separatorArrayExplode");
2402
- var separatorArrayNoExplode2 = /* @__PURE__ */ __name((style) => {
2403
- switch (style) {
2404
- case "form":
2405
- return ",";
2406
- case "pipeDelimited":
2407
- return "|";
2408
- case "spaceDelimited":
2409
- return "%20";
2410
- default:
2411
- return ",";
2412
- }
2413
- }, "separatorArrayNoExplode");
2414
- var separatorObjectExplode2 = /* @__PURE__ */ __name((style) => {
2415
- switch (style) {
2416
- case "label":
2417
- return ".";
2418
- case "matrix":
2419
- return ";";
2420
- case "simple":
2421
- return ",";
2422
- default:
2423
- return "&";
2424
- }
2425
- }, "separatorObjectExplode");
2426
- var serializeArrayParam2 = /* @__PURE__ */ __name(({
2427
- allowReserved,
2428
- explode,
2429
- name,
2430
- style,
2431
- value
2432
- }) => {
2433
- if (!explode) {
2434
- const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode2(style));
2435
- switch (style) {
2436
- case "label":
2437
- return `.${joinedValues2}`;
2438
- case "matrix":
2439
- return `;${name}=${joinedValues2}`;
2440
- case "simple":
2441
- return joinedValues2;
2442
- default:
2443
- return `${name}=${joinedValues2}`;
2444
- }
2445
- }
2446
- const separator = separatorArrayExplode2(style);
2447
- const joinedValues = value.map((v) => {
2448
- if (style === "label" || style === "simple") {
2449
- return allowReserved ? v : encodeURIComponent(v);
2450
- }
2451
- return serializePrimitiveParam2({
2452
- allowReserved,
2453
- name,
2454
- value: v
2455
- });
2456
- }).join(separator);
2457
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
2458
- }, "serializeArrayParam");
2459
- var serializePrimitiveParam2 = /* @__PURE__ */ __name(({
2460
- allowReserved,
2461
- name,
2462
- value
2463
- }) => {
2464
- if (value === void 0 || value === null) {
2465
- return "";
2466
- }
2467
- if (typeof value === "object") {
2468
- throw new Error(
2469
- "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
2470
- );
2471
- }
2472
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
2473
- }, "serializePrimitiveParam");
2474
- var serializeObjectParam2 = /* @__PURE__ */ __name(({
2475
- allowReserved,
2476
- explode,
2477
- name,
2478
- style,
2479
- value,
2480
- valueOnly
2481
- }) => {
2482
- if (value instanceof Date) {
2483
- return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
2484
- }
2485
- if (style !== "deepObject" && !explode) {
2486
- let values = [];
2487
- Object.entries(value).forEach(([key, v]) => {
2488
- values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
2489
- });
2490
- const joinedValues2 = values.join(",");
2491
- switch (style) {
2492
- case "form":
2493
- return `${name}=${joinedValues2}`;
2494
- case "label":
2495
- return `.${joinedValues2}`;
2496
- case "matrix":
2497
- return `;${name}=${joinedValues2}`;
2498
- default:
2499
- return joinedValues2;
2500
- }
2501
- }
2502
- const separator = separatorObjectExplode2(style);
2503
- const joinedValues = Object.entries(value).map(
2504
- ([key, v]) => serializePrimitiveParam2({
2505
- allowReserved,
2506
- name: style === "deepObject" ? `${name}[${key}]` : key,
2507
- value: v
2508
- })
2509
- ).join(separator);
2510
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
2511
- }, "serializeObjectParam");
2512
-
2513
- // src/_api/generated/cfg_centrifugo/core/utils.gen.ts
2514
- var PATH_PARAM_RE2 = /\{[^{}]+\}/g;
2515
- var defaultPathSerializer2 = /* @__PURE__ */ __name(({ path, url: _url }) => {
2516
- let url = _url;
2517
- const matches = _url.match(PATH_PARAM_RE2);
2518
- if (matches) {
2519
- for (const match of matches) {
2520
- let explode = false;
2521
- let name = match.substring(1, match.length - 1);
2522
- let style = "simple";
2523
- if (name.endsWith("*")) {
2524
- explode = true;
2525
- name = name.substring(0, name.length - 1);
2526
- }
2527
- if (name.startsWith(".")) {
2528
- name = name.substring(1);
2529
- style = "label";
2530
- } else if (name.startsWith(";")) {
2531
- name = name.substring(1);
2532
- style = "matrix";
2533
- }
2534
- const value = path[name];
2535
- if (value === void 0 || value === null) {
2536
- continue;
2537
- }
2538
- if (Array.isArray(value)) {
2539
- url = url.replace(match, serializeArrayParam2({ explode, name, style, value }));
2540
- continue;
2541
- }
2542
- if (typeof value === "object") {
2543
- url = url.replace(
2544
- match,
2545
- serializeObjectParam2({
2546
- explode,
2547
- name,
2548
- style,
2549
- value,
2550
- valueOnly: true
2551
- })
2552
- );
2553
- continue;
2554
- }
2555
- if (style === "matrix") {
2556
- url = url.replace(
2557
- match,
2558
- `;${serializePrimitiveParam2({
2559
- name,
2560
- value
2561
- })}`
2562
- );
2563
- continue;
2564
- }
2565
- const replaceValue = encodeURIComponent(
2566
- style === "label" ? `.${value}` : value
2567
- );
2568
- url = url.replace(match, replaceValue);
2569
- }
2570
- }
2571
- return url;
2572
- }, "defaultPathSerializer");
2573
- var getUrl2 = /* @__PURE__ */ __name(({
2574
- baseUrl: baseUrl2,
2575
- path,
2576
- query,
2577
- querySerializer,
2578
- url: _url
2579
- }) => {
2580
- const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
2581
- let url = (baseUrl2 ?? "") + pathUrl;
2582
- if (path) {
2583
- url = defaultPathSerializer2({ path, url });
2584
- }
2585
- let search = query ? querySerializer(query) : "";
2586
- if (search.startsWith("?")) {
2587
- search = search.substring(1);
2588
- }
2589
- if (search) {
2590
- url += `?${search}`;
2591
- }
2592
- return url;
2593
- }, "getUrl");
2594
- function getValidRequestBody2(options) {
2595
- const hasBody = options.body !== void 0;
2596
- const isSerializedBody = hasBody && options.bodySerializer;
2597
- if (isSerializedBody) {
2598
- if ("serializedBody" in options) {
2599
- const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
2600
- return hasSerializedBody ? options.serializedBody : null;
2601
- }
2602
- return options.body !== "" ? options.body : null;
2603
- }
2604
- if (hasBody) {
2605
- return options.body;
2606
- }
2607
- return void 0;
2608
- }
2609
- __name(getValidRequestBody2, "getValidRequestBody");
2610
-
2611
- // src/_api/generated/cfg_centrifugo/core/auth.gen.ts
2612
- var getAuthToken2 = /* @__PURE__ */ __name(async (auth, callback) => {
2613
- const token = typeof callback === "function" ? await callback(auth) : callback;
2614
- if (!token) {
2615
- return;
2616
- }
2617
- if (auth.scheme === "bearer") {
2618
- return `Bearer ${token}`;
2619
- }
2620
- if (auth.scheme === "basic") {
2621
- return `Basic ${btoa(token)}`;
2622
- }
2623
- return token;
2624
- }, "getAuthToken");
2625
-
2626
- // src/_api/generated/cfg_centrifugo/client/utils.gen.ts
2627
- var createQuerySerializer2 = /* @__PURE__ */ __name(({
2628
- parameters = {},
2629
- ...args
2630
- } = {}) => {
2631
- const querySerializer = /* @__PURE__ */ __name((queryParams) => {
2632
- const search = [];
2633
- if (queryParams && typeof queryParams === "object") {
2634
- for (const name in queryParams) {
2635
- const value = queryParams[name];
2636
- if (value === void 0 || value === null) {
2637
- continue;
2638
- }
2639
- const options = parameters[name] || args;
2640
- if (Array.isArray(value)) {
2641
- const serializedArray = serializeArrayParam2({
2642
- allowReserved: options.allowReserved,
2643
- explode: true,
2644
- name,
2645
- style: "form",
2646
- value,
2647
- ...options.array
2648
- });
2649
- if (serializedArray) search.push(serializedArray);
2650
- } else if (typeof value === "object") {
2651
- const serializedObject = serializeObjectParam2({
2652
- allowReserved: options.allowReserved,
2653
- explode: true,
2654
- name,
2655
- style: "deepObject",
2656
- value,
2657
- ...options.object
2658
- });
2659
- if (serializedObject) search.push(serializedObject);
2660
- } else {
2661
- const serializedPrimitive = serializePrimitiveParam2({
2662
- allowReserved: options.allowReserved,
2663
- name,
2664
- value
2665
- });
2666
- if (serializedPrimitive) search.push(serializedPrimitive);
2667
- }
2668
- }
2669
- }
2670
- return search.join("&");
2671
- }, "querySerializer");
2672
- return querySerializer;
2673
- }, "createQuerySerializer");
2674
- var getParseAs2 = /* @__PURE__ */ __name((contentType) => {
2675
- if (!contentType) {
2676
- return "stream";
2677
- }
2678
- const cleanContent = contentType.split(";")[0]?.trim();
2679
- if (!cleanContent) {
2680
- return;
2681
- }
2682
- if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
2683
- return "json";
2684
- }
2685
- if (cleanContent === "multipart/form-data") {
2686
- return "formData";
2687
- }
2688
- if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
2689
- return "blob";
2690
- }
2691
- if (cleanContent.startsWith("text/")) {
2692
- return "text";
2693
- }
2694
- return;
2695
- }, "getParseAs");
2696
- var checkForExistence2 = /* @__PURE__ */ __name((options, name) => {
2697
- if (!name) {
2698
- return false;
2699
- }
2700
- if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
2701
- return true;
2702
- }
2703
- return false;
2704
- }, "checkForExistence");
2705
- var setAuthParams2 = /* @__PURE__ */ __name(async ({
2706
- security,
2707
- ...options
2708
- }) => {
2709
- for (const auth of security) {
2710
- if (checkForExistence2(options, auth.name)) {
2711
- continue;
2712
- }
2713
- const token = await getAuthToken2(auth, options.auth);
2714
- if (!token) {
2715
- continue;
2716
- }
2717
- const name = auth.name ?? "Authorization";
2718
- switch (auth.in) {
2719
- case "query":
2720
- if (!options.query) {
2721
- options.query = {};
2722
- }
2723
- options.query[name] = token;
2724
- break;
2725
- case "cookie":
2726
- options.headers.append("Cookie", `${name}=${token}`);
2727
- break;
2728
- case "header":
2729
- default:
2730
- options.headers.set(name, token);
2731
- break;
2732
- }
2733
- }
2734
- }, "setAuthParams");
2735
- var buildUrl2 = /* @__PURE__ */ __name((options) => getUrl2({
2736
- baseUrl: options.baseUrl,
2737
- path: options.path,
2738
- query: options.query,
2739
- querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer2(options.querySerializer),
2740
- url: options.url
2741
- }), "buildUrl");
2742
- var mergeConfigs2 = /* @__PURE__ */ __name((a, b) => {
2743
- const config = { ...a, ...b };
2744
- if (config.baseUrl?.endsWith("/")) {
2745
- config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
2746
- }
2747
- config.headers = mergeHeaders2(a.headers, b.headers);
2748
- return config;
2749
- }, "mergeConfigs");
2750
- var headersEntries2 = /* @__PURE__ */ __name((headers) => {
2751
- const entries = [];
2752
- headers.forEach((value, key) => {
2753
- entries.push([key, value]);
2754
- });
2755
- return entries;
2756
- }, "headersEntries");
2757
- var mergeHeaders2 = /* @__PURE__ */ __name((...headers) => {
2758
- const mergedHeaders = new Headers();
2759
- for (const header of headers) {
2760
- if (!header) {
2761
- continue;
2762
- }
2763
- const iterator = header instanceof Headers ? headersEntries2(header) : Object.entries(header);
2764
- for (const [key, value] of iterator) {
2765
- if (value === null) {
2766
- mergedHeaders.delete(key);
2767
- } else if (Array.isArray(value)) {
2768
- for (const v of value) {
2769
- mergedHeaders.append(key, v);
2770
- }
2771
- } else if (value !== void 0) {
2772
- mergedHeaders.set(
2773
- key,
2774
- typeof value === "object" ? JSON.stringify(value) : value
2775
- );
2776
- }
2777
- }
2778
- }
2779
- return mergedHeaders;
2780
- }, "mergeHeaders");
2781
- var Interceptors2 = class {
2782
- static {
2783
- __name(this, "Interceptors");
2784
- }
2785
- fns = [];
2786
- clear() {
2787
- this.fns = [];
2788
- }
2789
- eject(id) {
2790
- const index = this.getInterceptorIndex(id);
2791
- if (this.fns[index]) {
2792
- this.fns[index] = null;
2793
- }
2794
- }
2795
- exists(id) {
2796
- const index = this.getInterceptorIndex(id);
2797
- return Boolean(this.fns[index]);
2798
- }
2799
- getInterceptorIndex(id) {
2800
- if (typeof id === "number") {
2801
- return this.fns[id] ? id : -1;
2802
- }
2803
- return this.fns.indexOf(id);
2804
- }
2805
- update(id, fn) {
2806
- const index = this.getInterceptorIndex(id);
2807
- if (this.fns[index]) {
2808
- this.fns[index] = fn;
2809
- return id;
2810
- }
2811
- return false;
2812
- }
2813
- use(fn) {
2814
- this.fns.push(fn);
2815
- return this.fns.length - 1;
2816
- }
2817
- };
2818
- var createInterceptors2 = /* @__PURE__ */ __name(() => ({
2819
- error: new Interceptors2(),
2820
- request: new Interceptors2(),
2821
- response: new Interceptors2()
2822
- }), "createInterceptors");
2823
- var defaultQuerySerializer2 = createQuerySerializer2({
2824
- allowReserved: false,
2825
- array: {
2826
- explode: true,
2827
- style: "form"
2828
- },
2829
- object: {
2830
- explode: true,
2831
- style: "deepObject"
2832
- }
2833
- });
2834
- var defaultHeaders2 = {
2835
- "Content-Type": "application/json"
2836
- };
2837
- var createConfig2 = /* @__PURE__ */ __name((override = {}) => ({
2838
- ...jsonBodySerializer2,
2839
- headers: defaultHeaders2,
2840
- parseAs: "auto",
2841
- querySerializer: defaultQuerySerializer2,
2842
- ...override
2843
- }), "createConfig");
2844
-
2845
- // src/_api/generated/cfg_centrifugo/client/client.gen.ts
2846
- var createClient2 = /* @__PURE__ */ __name((config = {}) => {
2847
- let _config = mergeConfigs2(createConfig2(), config);
2848
- const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
2849
- const setConfig = /* @__PURE__ */ __name((config2) => {
2850
- _config = mergeConfigs2(_config, config2);
2851
- return getConfig();
2852
- }, "setConfig");
2853
- const interceptors = createInterceptors2();
2854
- const beforeRequest = /* @__PURE__ */ __name(async (options) => {
2855
- const opts = {
2856
- ..._config,
2857
- ...options,
2858
- fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
2859
- headers: mergeHeaders2(_config.headers, options.headers),
2860
- serializedBody: void 0
2861
- };
2862
- if (opts.security) {
2863
- await setAuthParams2({
2864
- ...opts,
2865
- security: opts.security
2866
- });
2867
- }
2868
- if (opts.requestValidator) {
2869
- await opts.requestValidator(opts);
2870
- }
2871
- if (opts.body !== void 0 && opts.bodySerializer) {
2872
- opts.serializedBody = opts.bodySerializer(opts.body);
2873
- }
2874
- if (opts.body === void 0 || opts.serializedBody === "") {
2875
- opts.headers.delete("Content-Type");
2876
- }
2877
- const resolvedOpts = opts;
2878
- const url = buildUrl2(resolvedOpts);
2879
- return { opts: resolvedOpts, url };
2880
- }, "beforeRequest");
2881
- const request = /* @__PURE__ */ __name(async (options) => {
2882
- const throwOnError = options.throwOnError ?? _config.throwOnError;
2883
- const responseStyle = options.responseStyle ?? _config.responseStyle;
2884
- let request2;
2885
- let response;
2886
- try {
2887
- const { opts, url } = await beforeRequest(options);
2888
- const requestInit = {
2889
- redirect: "follow",
2890
- ...opts,
2891
- body: getValidRequestBody2(opts)
2892
- };
2893
- request2 = new Request(url, requestInit);
2894
- for (const fn of interceptors.request.fns) {
2895
- if (fn) {
2896
- request2 = await fn(request2, opts);
2897
- }
2898
- }
2899
- const _fetch = opts.fetch;
2900
- response = await _fetch(request2);
2901
- for (const fn of interceptors.response.fns) {
2902
- if (fn) {
2903
- response = await fn(response, request2, opts);
2904
- }
2905
- }
2906
- const result = {
2907
- request: request2,
2908
- response
2909
- };
2910
- if (response.ok) {
2911
- const parseAs = (opts.parseAs === "auto" ? getParseAs2(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
2912
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
2913
- let emptyData;
2914
- switch (parseAs) {
2915
- case "arrayBuffer":
2916
- case "blob":
2917
- case "text":
2918
- emptyData = await response[parseAs]();
2919
- break;
2920
- case "formData":
2921
- emptyData = new FormData();
2922
- break;
2923
- case "stream":
2924
- emptyData = response.body;
2925
- break;
2926
- case "json":
2927
- default:
2928
- emptyData = {};
2929
- break;
2930
- }
2931
- return opts.responseStyle === "data" ? emptyData : {
2932
- data: emptyData,
2933
- ...result
2934
- };
2935
- }
2936
- let data;
2937
- switch (parseAs) {
2938
- case "arrayBuffer":
2939
- case "blob":
2940
- case "formData":
2941
- case "text":
2942
- data = await response[parseAs]();
2943
- break;
2944
- case "json": {
2945
- const text = await response.text();
2946
- data = text ? JSON.parse(text) : {};
2947
- break;
2948
- }
2949
- case "stream":
2950
- return opts.responseStyle === "data" ? response.body : {
2951
- data: response.body,
2952
- ...result
2953
- };
2954
- }
2955
- if (parseAs === "json") {
2956
- if (opts.responseValidator) {
2957
- await opts.responseValidator(data);
2958
- }
2959
- if (opts.responseTransformer) {
2960
- data = await opts.responseTransformer(data);
2961
- }
2962
- }
2963
- return opts.responseStyle === "data" ? data : {
2964
- data,
2965
- ...result
2966
- };
2967
- }
2968
- const textError = await response.text();
2969
- let jsonError;
2970
- try {
2971
- jsonError = JSON.parse(textError);
2972
- } catch {
2973
- }
2974
- throw jsonError ?? textError;
2975
- } catch (error) {
2976
- let finalError = error;
2977
- for (const fn of interceptors.error.fns) {
2978
- if (fn) {
2979
- finalError = await fn(finalError, response, request2, options);
2980
- }
2981
- }
2982
- finalError = finalError || {};
2983
- if (throwOnError) {
2984
- throw finalError;
2985
- }
2986
- return responseStyle === "data" ? void 0 : {
2987
- error: finalError,
2988
- request: request2,
2989
- response
2990
- };
2991
- }
2992
- }, "request");
2993
- const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
2994
- const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
2995
- const { opts, url } = await beforeRequest(options);
2996
- return createSseClient2({
2997
- ...opts,
2998
- body: opts.body,
2999
- method,
3000
- onRequest: /* @__PURE__ */ __name(async (url2, init) => {
3001
- let request2 = new Request(url2, init);
3002
- for (const fn of interceptors.request.fns) {
3003
- if (fn) {
3004
- request2 = await fn(request2, opts);
3005
- }
3006
- }
3007
- return request2;
3008
- }, "onRequest"),
3009
- serializedBody: getValidRequestBody2(opts),
3010
- url
3011
- });
3012
- }, "makeSseFn");
3013
- const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl2({ ..._config, ...options }), "_buildUrl");
3014
- return {
3015
- buildUrl: _buildUrl,
3016
- connect: makeMethodFn("CONNECT"),
3017
- delete: makeMethodFn("DELETE"),
3018
- get: makeMethodFn("GET"),
3019
- getConfig,
3020
- head: makeMethodFn("HEAD"),
3021
- interceptors,
3022
- options: makeMethodFn("OPTIONS"),
3023
- patch: makeMethodFn("PATCH"),
3024
- post: makeMethodFn("POST"),
3025
- put: makeMethodFn("PUT"),
3026
- request,
3027
- setConfig,
3028
- sse: {
3029
- connect: makeSseFn("CONNECT"),
3030
- delete: makeSseFn("DELETE"),
3031
- get: makeSseFn("GET"),
3032
- head: makeSseFn("HEAD"),
3033
- options: makeSseFn("OPTIONS"),
3034
- patch: makeSseFn("PATCH"),
3035
- post: makeSseFn("POST"),
3036
- put: makeSseFn("PUT"),
3037
- trace: makeSseFn("TRACE")
3038
- },
3039
- trace: makeMethodFn("TRACE")
3040
- };
3041
- }, "createClient");
3042
-
3043
- // src/_api/generated/cfg_centrifugo/client.gen.ts
3044
- var client2 = createClient2(createConfig2({ baseUrl: "http://localhost:8000" }));
3045
-
3046
- // src/_api/generated/cfg_centrifugo/sdk.gen.ts
3047
- var Cfg2 = class {
3048
- static {
3049
- __name(this, "Cfg");
3050
- }
3051
- /**
3052
- * Get Centrifugo connection token
3053
- *
3054
- * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
3055
- */
3056
- static cfgCentrifugoAuthTokenRetrieve(options) {
3057
- return (options?.client ?? client2).get({
3058
- security: [{ scheme: "bearer", type: "http" }],
3059
- url: "/cfg/centrifugo/auth/token/",
3060
- ...options
3061
- });
3062
- }
3063
- };
3064
- var Centrifugo = class {
3065
- static {
3066
- __name(this, "Centrifugo");
3067
- }
3068
- /**
3069
- * Get Centrifugo connection token
3070
- *
3071
- * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
3072
- */
3073
- static cfgCentrifugoAuthTokenRetrieve(options) {
3074
- return (options?.client ?? client2).get({
3075
- security: [{ scheme: "bearer", type: "http" }],
3076
- url: "/cfg/centrifugo/auth/token/",
3077
- ...options
3078
- });
3079
- }
3080
- };
3081
- var CentrifugoAuth = class {
3082
- static {
3083
- __name(this, "CentrifugoAuth");
3084
- }
3085
- /**
3086
- * Get Centrifugo connection token
3087
- *
3088
- * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
3089
- */
3090
- static cfgCentrifugoAuthTokenRetrieve(options) {
3091
- return (options?.client ?? client2).get({
3092
- security: [{ scheme: "bearer", type: "http" }],
3093
- url: "/cfg/centrifugo/auth/token/",
3094
- ...options
3095
- });
3096
- }
3097
- };
3098
-
3099
- // src/_api/generated/cfg_centrifugo/schemas/ConnectionTokenResponse.ts
3100
- var import_zod22 = require("zod");
3101
- var ConnectionTokenResponseSchema = import_zod22.z.object({
3102
- token: import_zod22.z.string(),
3103
- centrifugo_url: import_zod22.z.string(),
3104
- expires_at: import_zod22.z.string(),
3105
- channels: import_zod22.z.array(import_zod22.z.string())
3106
- });
3107
-
3108
- // src/_api/generated/cfg_centrifugo/api.ts
3109
- var ACCESS_KEY2 = "cfg.access_token";
3110
- var REFRESH_KEY2 = "cfg.refresh_token";
3111
- var VALIDATION_ROUTES2 = [
3112
- { method: "GET", re: new RegExp("^/cfg/centrifugo/auth/token/?$"), schema: ConnectionTokenResponseSchema, path: "/cfg/centrifugo/auth/token/" }
3113
- ];
3114
- function detectLocale2() {
3115
- try {
3116
- if (typeof document !== "undefined") {
3117
- const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
3118
- if (m) return decodeURIComponent(m[1]);
3119
- }
3120
- if (typeof navigator !== "undefined" && navigator.language) {
3121
- return navigator.language;
3122
- }
3123
- } catch {
3124
- }
3125
- return null;
3126
- }
3127
- __name(detectLocale2, "detectLocale");
3128
- var API2 = class {
3129
- static {
3130
- __name(this, "API");
3131
- }
3132
- baseUrl;
3133
- storage;
3134
- locale;
3135
- apiKey;
3136
- logger;
3137
- cfg = Cfg2;
3138
- centrifugo = Centrifugo;
3139
- centrifugoAuth = CentrifugoAuth;
3140
- constructor(baseUrl2, opts = {}) {
3141
- this.baseUrl = baseUrl2.replace(/\/$/, "");
3142
- this.storage = opts.storage ?? new LocalStorageAdapter();
3143
- this.logger = new APILogger(opts.logger);
3144
- this.locale = opts.locale ?? null;
3145
- this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
3146
- const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
3147
- client2.setConfig({ baseUrl: this.baseUrl, credentials });
3148
- client2.interceptors.request.use((request) => {
3149
- const access = this.getToken();
3150
- if (access) request.headers.set("Authorization", `Bearer ${access}`);
3151
- const locale = this.locale ?? detectLocale2();
3152
- if (locale) request.headers.set("Accept-Language", locale);
3153
- if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
3154
- return request;
3155
- });
3156
- client2.interceptors.response.use(async (response, request) => {
3157
- if (!response.ok) return response;
3158
- const ct = response.headers.get("content-type") || "";
3159
- if (!ct.includes("application/json")) return response;
3160
- const url = new URL(request.url);
3161
- const method = request.method.toUpperCase();
3162
- const route = VALIDATION_ROUTES2.find(
3163
- (r) => r.method === method && r.re.test(url.pathname)
3164
- );
3165
- if (!route) return response;
3166
- let payload;
3167
- try {
3168
- payload = await response.clone().json();
3169
- } catch {
3170
- return response;
3171
- }
3172
- const result = route.schema.safeParse(payload);
3173
- if (!result.success) {
3174
- dispatchValidationError({
3175
- operation: `${method} ${route.path}`,
3176
- path: route.path,
3177
- method,
3178
- error: result.error,
3179
- response: payload,
3180
- timestamp: /* @__PURE__ */ new Date()
3181
- });
3182
- }
3183
- return response;
3184
- });
3185
- }
3186
- // ── Base URL ────────────────────────────────────────────────────────────
3187
- getBaseUrl() {
3188
- return this.baseUrl;
3189
- }
3190
- setBaseUrl(url) {
3191
- this.baseUrl = url.replace(/\/$/, "");
3192
- client2.setConfig({ baseUrl: this.baseUrl });
3193
- }
3194
- // ── Tokens ──────────────────────────────────────────────────────────────
3195
- getToken() {
3196
- return this.storage.getItem(ACCESS_KEY2);
3197
- }
3198
- setToken(token) {
3199
- if (token) this.storage.setItem(ACCESS_KEY2, token);
3200
- else this.storage.removeItem(ACCESS_KEY2);
3201
- }
3202
- getRefreshToken() {
3203
- return this.storage.getItem(REFRESH_KEY2);
3204
- }
3205
- setRefreshToken(token) {
3206
- if (token) this.storage.setItem(REFRESH_KEY2, token);
3207
- else this.storage.removeItem(REFRESH_KEY2);
3208
- }
3209
- clearToken() {
3210
- this.storage.removeItem(ACCESS_KEY2);
3211
- this.storage.removeItem(REFRESH_KEY2);
3212
- }
3213
- isAuthenticated() {
3214
- return this.getToken() !== null;
3215
- }
3216
- // ── Locale / API key ────────────────────────────────────────────────────
3217
- getLocale() {
3218
- return this.locale ?? detectLocale2();
3219
- }
3220
- setLocale(locale) {
3221
- this.locale = locale;
3222
- }
3223
- getApiKey() {
3224
- return this.apiKey;
3225
- }
3226
- setApiKey(key) {
3227
- this.apiKey = key;
3228
- }
3229
- };
3230
-
3231
- // src/_api/generated/cfg_totp/core/bodySerializer.gen.ts
3232
- var jsonBodySerializer3 = {
3233
- bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
3234
- };
3235
-
3236
- // src/_api/generated/cfg_totp/core/params.gen.ts
3237
- var extraPrefixesMap3 = {
3238
- $body_: "body",
3239
- $headers_: "headers",
3240
- $path_: "path",
3241
- $query_: "query"
3242
- };
3243
- var extraPrefixes3 = Object.entries(extraPrefixesMap3);
3244
-
3245
- // src/_api/generated/cfg_totp/core/serverSentEvents.gen.ts
3246
- function createSseClient3({
3247
- onRequest,
3248
- onSseError,
3249
- onSseEvent,
3250
- responseTransformer,
3251
- responseValidator,
3252
- sseDefaultRetryDelay,
3253
- sseMaxRetryAttempts,
3254
- sseMaxRetryDelay,
3255
- sseSleepFn,
3256
- url,
3257
- ...options
3258
- }) {
3259
- let lastEventId;
3260
- const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
3261
- const createStream = /* @__PURE__ */ __name(async function* () {
3262
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
3263
- let attempt = 0;
3264
- const signal = options.signal ?? new AbortController().signal;
3265
- while (true) {
3266
- if (signal.aborted) break;
3267
- attempt++;
3268
- const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
3269
- if (lastEventId !== void 0) {
3270
- headers.set("Last-Event-ID", lastEventId);
3271
- }
3272
- try {
3273
- const requestInit = {
3274
- redirect: "follow",
3275
- ...options,
3276
- body: options.serializedBody,
3277
- headers,
3278
- signal
3279
- };
3280
- let request = new Request(url, requestInit);
3281
- if (onRequest) {
3282
- request = await onRequest(url, requestInit);
3283
- }
3284
- const _fetch = options.fetch ?? globalThis.fetch;
3285
- const response = await _fetch(request);
3286
- if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
3287
- if (!response.body) throw new Error("No body in SSE response");
3288
- const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
3289
- let buffer = "";
3290
- const abortHandler = /* @__PURE__ */ __name(() => {
3291
- try {
3292
- reader.cancel();
3293
- } catch {
3294
- }
3295
- }, "abortHandler");
3296
- signal.addEventListener("abort", abortHandler);
3297
- try {
3298
- while (true) {
3299
- const { done, value } = await reader.read();
3300
- if (done) break;
3301
- buffer += value;
3302
- buffer = buffer.replace(/\r\n?/g, "\n");
3303
- const chunks = buffer.split("\n\n");
3304
- buffer = chunks.pop() ?? "";
3305
- for (const chunk of chunks) {
3306
- const lines = chunk.split("\n");
3307
- const dataLines = [];
3308
- let eventName;
3309
- for (const line of lines) {
3310
- if (line.startsWith("data:")) {
3311
- dataLines.push(line.replace(/^data:\s*/, ""));
3312
- } else if (line.startsWith("event:")) {
3313
- eventName = line.replace(/^event:\s*/, "");
3314
- } else if (line.startsWith("id:")) {
3315
- lastEventId = line.replace(/^id:\s*/, "");
3316
- } else if (line.startsWith("retry:")) {
3317
- const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
3318
- if (!Number.isNaN(parsed)) {
3319
- retryDelay = parsed;
3320
- }
3321
- }
3322
- }
3323
- let data;
3324
- let parsedJson = false;
3325
- if (dataLines.length) {
3326
- const rawData = dataLines.join("\n");
3327
- try {
3328
- data = JSON.parse(rawData);
3329
- parsedJson = true;
3330
- } catch {
3331
- data = rawData;
3332
- }
3333
- }
3334
- if (parsedJson) {
3335
- if (responseValidator) {
3336
- await responseValidator(data);
3337
- }
3338
- if (responseTransformer) {
3339
- data = await responseTransformer(data);
3340
- }
3341
- }
3342
- onSseEvent?.({
3343
- data,
3344
- event: eventName,
3345
- id: lastEventId,
3346
- retry: retryDelay
3347
- });
3348
- if (dataLines.length) {
3349
- yield data;
3350
- }
3351
- }
3352
- }
3353
- } finally {
3354
- signal.removeEventListener("abort", abortHandler);
3355
- reader.releaseLock();
3356
- }
3357
- break;
3358
- } catch (error) {
3359
- onSseError?.(error);
3360
- if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
3361
- break;
3362
- }
3363
- const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
3364
- await sleep(backoff);
3365
- }
3366
- }
3367
- }, "createStream");
3368
- const stream = createStream();
3369
- return { stream };
3370
- }
3371
- __name(createSseClient3, "createSseClient");
3372
-
3373
- // src/_api/generated/cfg_totp/core/pathSerializer.gen.ts
3374
- var separatorArrayExplode3 = /* @__PURE__ */ __name((style) => {
3375
- switch (style) {
3376
- case "label":
3377
- return ".";
3378
- case "matrix":
3379
- return ";";
3380
- case "simple":
3381
- return ",";
3382
- default:
3383
- return "&";
3384
- }
3385
- }, "separatorArrayExplode");
3386
- var separatorArrayNoExplode3 = /* @__PURE__ */ __name((style) => {
3387
- switch (style) {
3388
- case "form":
3389
- return ",";
3390
- case "pipeDelimited":
3391
- return "|";
3392
- case "spaceDelimited":
3393
- return "%20";
3394
- default:
3395
- return ",";
3396
- }
3397
- }, "separatorArrayNoExplode");
3398
- var separatorObjectExplode3 = /* @__PURE__ */ __name((style) => {
3399
- switch (style) {
3400
- case "label":
3401
- return ".";
3402
- case "matrix":
3403
- return ";";
3404
- case "simple":
3405
- return ",";
3406
- default:
3407
- return "&";
3408
- }
3409
- }, "separatorObjectExplode");
3410
- var serializeArrayParam3 = /* @__PURE__ */ __name(({
3411
- allowReserved,
3412
- explode,
3413
- name,
3414
- style,
3415
- value
3416
- }) => {
3417
- if (!explode) {
3418
- const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode3(style));
3419
- switch (style) {
3420
- case "label":
3421
- return `.${joinedValues2}`;
3422
- case "matrix":
3423
- return `;${name}=${joinedValues2}`;
3424
- case "simple":
3425
- return joinedValues2;
3426
- default:
3427
- return `${name}=${joinedValues2}`;
3428
- }
3429
- }
3430
- const separator = separatorArrayExplode3(style);
3431
- const joinedValues = value.map((v) => {
3432
- if (style === "label" || style === "simple") {
3433
- return allowReserved ? v : encodeURIComponent(v);
3434
- }
3435
- return serializePrimitiveParam3({
3436
- allowReserved,
3437
- name,
3438
- value: v
3439
- });
3440
- }).join(separator);
3441
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
3442
- }, "serializeArrayParam");
3443
- var serializePrimitiveParam3 = /* @__PURE__ */ __name(({
3444
- allowReserved,
3445
- name,
3446
- value
3447
- }) => {
3448
- if (value === void 0 || value === null) {
3449
- return "";
3450
- }
3451
- if (typeof value === "object") {
3452
- throw new Error(
3453
- "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
3454
- );
3455
- }
3456
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
3457
- }, "serializePrimitiveParam");
3458
- var serializeObjectParam3 = /* @__PURE__ */ __name(({
3459
- allowReserved,
3460
- explode,
3461
- name,
3462
- style,
3463
- value,
3464
- valueOnly
3465
- }) => {
3466
- if (value instanceof Date) {
3467
- return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
3468
- }
3469
- if (style !== "deepObject" && !explode) {
3470
- let values = [];
3471
- Object.entries(value).forEach(([key, v]) => {
3472
- values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
3473
- });
3474
- const joinedValues2 = values.join(",");
3475
- switch (style) {
3476
- case "form":
3477
- return `${name}=${joinedValues2}`;
3478
- case "label":
3479
- return `.${joinedValues2}`;
3480
- case "matrix":
3481
- return `;${name}=${joinedValues2}`;
3482
- default:
3483
- return joinedValues2;
3484
- }
3485
- }
3486
- const separator = separatorObjectExplode3(style);
3487
- const joinedValues = Object.entries(value).map(
3488
- ([key, v]) => serializePrimitiveParam3({
3489
- allowReserved,
3490
- name: style === "deepObject" ? `${name}[${key}]` : key,
3491
- value: v
3492
- })
3493
- ).join(separator);
3494
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
3495
- }, "serializeObjectParam");
3496
-
3497
- // src/_api/generated/cfg_totp/core/utils.gen.ts
3498
- var PATH_PARAM_RE3 = /\{[^{}]+\}/g;
3499
- var defaultPathSerializer3 = /* @__PURE__ */ __name(({ path, url: _url }) => {
3500
- let url = _url;
3501
- const matches = _url.match(PATH_PARAM_RE3);
3502
- if (matches) {
3503
- for (const match of matches) {
3504
- let explode = false;
3505
- let name = match.substring(1, match.length - 1);
3506
- let style = "simple";
3507
- if (name.endsWith("*")) {
3508
- explode = true;
3509
- name = name.substring(0, name.length - 1);
3510
- }
3511
- if (name.startsWith(".")) {
3512
- name = name.substring(1);
3513
- style = "label";
3514
- } else if (name.startsWith(";")) {
3515
- name = name.substring(1);
3516
- style = "matrix";
3517
- }
3518
- const value = path[name];
3519
- if (value === void 0 || value === null) {
3520
- continue;
3521
- }
3522
- if (Array.isArray(value)) {
3523
- url = url.replace(match, serializeArrayParam3({ explode, name, style, value }));
3524
- continue;
3525
- }
3526
- if (typeof value === "object") {
3527
- url = url.replace(
3528
- match,
3529
- serializeObjectParam3({
3530
- explode,
3531
- name,
3532
- style,
3533
- value,
3534
- valueOnly: true
3535
- })
3536
- );
3537
- continue;
3538
- }
3539
- if (style === "matrix") {
3540
- url = url.replace(
3541
- match,
3542
- `;${serializePrimitiveParam3({
3543
- name,
3544
- value
3545
- })}`
3546
- );
3547
- continue;
3548
- }
3549
- const replaceValue = encodeURIComponent(
3550
- style === "label" ? `.${value}` : value
3551
- );
3552
- url = url.replace(match, replaceValue);
3553
- }
3554
- }
3555
- return url;
3556
- }, "defaultPathSerializer");
3557
- var getUrl3 = /* @__PURE__ */ __name(({
3558
- baseUrl: baseUrl2,
3559
- path,
3560
- query,
3561
- querySerializer,
3562
- url: _url
3563
- }) => {
3564
- const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
3565
- let url = (baseUrl2 ?? "") + pathUrl;
3566
- if (path) {
3567
- url = defaultPathSerializer3({ path, url });
3568
- }
3569
- let search = query ? querySerializer(query) : "";
3570
- if (search.startsWith("?")) {
3571
- search = search.substring(1);
3572
- }
3573
- if (search) {
3574
- url += `?${search}`;
3575
- }
3576
- return url;
3577
- }, "getUrl");
3578
- function getValidRequestBody3(options) {
3579
- const hasBody = options.body !== void 0;
3580
- const isSerializedBody = hasBody && options.bodySerializer;
3581
- if (isSerializedBody) {
3582
- if ("serializedBody" in options) {
3583
- const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
3584
- return hasSerializedBody ? options.serializedBody : null;
3585
- }
3586
- return options.body !== "" ? options.body : null;
3587
- }
3588
- if (hasBody) {
3589
- return options.body;
3590
- }
3591
- return void 0;
3592
- }
3593
- __name(getValidRequestBody3, "getValidRequestBody");
3594
-
3595
- // src/_api/generated/cfg_totp/core/auth.gen.ts
3596
- var getAuthToken3 = /* @__PURE__ */ __name(async (auth, callback) => {
3597
- const token = typeof callback === "function" ? await callback(auth) : callback;
3598
- if (!token) {
3599
- return;
3600
- }
3601
- if (auth.scheme === "bearer") {
3602
- return `Bearer ${token}`;
3603
- }
3604
- if (auth.scheme === "basic") {
3605
- return `Basic ${btoa(token)}`;
3606
- }
3607
- return token;
3608
- }, "getAuthToken");
3609
-
3610
- // src/_api/generated/cfg_totp/client/utils.gen.ts
3611
- var createQuerySerializer3 = /* @__PURE__ */ __name(({
3612
- parameters = {},
3613
- ...args
3614
- } = {}) => {
3615
- const querySerializer = /* @__PURE__ */ __name((queryParams) => {
3616
- const search = [];
3617
- if (queryParams && typeof queryParams === "object") {
3618
- for (const name in queryParams) {
3619
- const value = queryParams[name];
3620
- if (value === void 0 || value === null) {
3621
- continue;
3622
- }
3623
- const options = parameters[name] || args;
3624
- if (Array.isArray(value)) {
3625
- const serializedArray = serializeArrayParam3({
3626
- allowReserved: options.allowReserved,
3627
- explode: true,
3628
- name,
3629
- style: "form",
3630
- value,
3631
- ...options.array
3632
- });
3633
- if (serializedArray) search.push(serializedArray);
3634
- } else if (typeof value === "object") {
3635
- const serializedObject = serializeObjectParam3({
3636
- allowReserved: options.allowReserved,
3637
- explode: true,
3638
- name,
3639
- style: "deepObject",
3640
- value,
3641
- ...options.object
3642
- });
3643
- if (serializedObject) search.push(serializedObject);
3644
- } else {
3645
- const serializedPrimitive = serializePrimitiveParam3({
3646
- allowReserved: options.allowReserved,
3647
- name,
3648
- value
3649
- });
3650
- if (serializedPrimitive) search.push(serializedPrimitive);
3651
- }
3652
- }
3653
- }
3654
- return search.join("&");
3655
- }, "querySerializer");
3656
- return querySerializer;
3657
- }, "createQuerySerializer");
3658
- var getParseAs3 = /* @__PURE__ */ __name((contentType) => {
3659
- if (!contentType) {
3660
- return "stream";
3661
- }
3662
- const cleanContent = contentType.split(";")[0]?.trim();
3663
- if (!cleanContent) {
3664
- return;
3665
- }
3666
- if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
3667
- return "json";
3668
- }
3669
- if (cleanContent === "multipart/form-data") {
3670
- return "formData";
3671
- }
3672
- if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
3673
- return "blob";
3674
- }
3675
- if (cleanContent.startsWith("text/")) {
3676
- return "text";
3677
- }
3678
- return;
3679
- }, "getParseAs");
3680
- var checkForExistence3 = /* @__PURE__ */ __name((options, name) => {
3681
- if (!name) {
3682
- return false;
3683
- }
3684
- if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
3685
- return true;
3686
- }
3687
- return false;
3688
- }, "checkForExistence");
3689
- var setAuthParams3 = /* @__PURE__ */ __name(async ({
3690
- security,
3691
- ...options
3692
- }) => {
3693
- for (const auth of security) {
3694
- if (checkForExistence3(options, auth.name)) {
3695
- continue;
3696
- }
3697
- const token = await getAuthToken3(auth, options.auth);
3698
- if (!token) {
3699
- continue;
3700
- }
3701
- const name = auth.name ?? "Authorization";
3702
- switch (auth.in) {
3703
- case "query":
3704
- if (!options.query) {
3705
- options.query = {};
3706
- }
3707
- options.query[name] = token;
3708
- break;
3709
- case "cookie":
3710
- options.headers.append("Cookie", `${name}=${token}`);
3711
- break;
3712
- case "header":
3713
- default:
3714
- options.headers.set(name, token);
3715
- break;
3716
- }
3717
- }
3718
- }, "setAuthParams");
3719
- var buildUrl3 = /* @__PURE__ */ __name((options) => getUrl3({
3720
- baseUrl: options.baseUrl,
3721
- path: options.path,
3722
- query: options.query,
3723
- querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer3(options.querySerializer),
3724
- url: options.url
3725
- }), "buildUrl");
3726
- var mergeConfigs3 = /* @__PURE__ */ __name((a, b) => {
3727
- const config = { ...a, ...b };
3728
- if (config.baseUrl?.endsWith("/")) {
3729
- config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
1947
+ /**
1948
+ * Get current user profile
1949
+ *
1950
+ * Retrieve the current authenticated user's profile information.
1951
+ */
1952
+ static cfgAccountsProfileRetrieve(options) {
1953
+ return (options?.client ?? client).get({
1954
+ security: [{ scheme: "bearer", type: "http" }, {
1955
+ in: "cookie",
1956
+ name: "sessionid",
1957
+ type: "apiKey"
1958
+ }],
1959
+ url: "/cfg/accounts/profile/",
1960
+ ...options
1961
+ });
3730
1962
  }
3731
- config.headers = mergeHeaders3(a.headers, b.headers);
3732
- return config;
3733
- }, "mergeConfigs");
3734
- var headersEntries3 = /* @__PURE__ */ __name((headers) => {
3735
- const entries = [];
3736
- headers.forEach((value, key) => {
3737
- entries.push([key, value]);
3738
- });
3739
- return entries;
3740
- }, "headersEntries");
3741
- var mergeHeaders3 = /* @__PURE__ */ __name((...headers) => {
3742
- const mergedHeaders = new Headers();
3743
- for (const header of headers) {
3744
- if (!header) {
3745
- continue;
3746
- }
3747
- const iterator = header instanceof Headers ? headersEntries3(header) : Object.entries(header);
3748
- for (const [key, value] of iterator) {
3749
- if (value === null) {
3750
- mergedHeaders.delete(key);
3751
- } else if (Array.isArray(value)) {
3752
- for (const v of value) {
3753
- mergedHeaders.append(key, v);
3754
- }
3755
- } else if (value !== void 0) {
3756
- mergedHeaders.set(
3757
- key,
3758
- typeof value === "object" ? JSON.stringify(value) : value
3759
- );
1963
+ /**
1964
+ * Upload user avatar
1965
+ *
1966
+ * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
1967
+ */
1968
+ static cfgAccountsProfileAvatarCreate(options) {
1969
+ return (options?.client ?? client).post({
1970
+ ...formDataBodySerializer,
1971
+ security: [{ scheme: "bearer", type: "http" }],
1972
+ url: "/cfg/accounts/profile/avatar/",
1973
+ ...options,
1974
+ headers: {
1975
+ "Content-Type": null,
1976
+ ...options?.headers
3760
1977
  }
3761
- }
3762
- }
3763
- return mergedHeaders;
3764
- }, "mergeHeaders");
3765
- var Interceptors3 = class {
3766
- static {
3767
- __name(this, "Interceptors");
3768
- }
3769
- fns = [];
3770
- clear() {
3771
- this.fns = [];
3772
- }
3773
- eject(id) {
3774
- const index = this.getInterceptorIndex(id);
3775
- if (this.fns[index]) {
3776
- this.fns[index] = null;
3777
- }
3778
- }
3779
- exists(id) {
3780
- const index = this.getInterceptorIndex(id);
3781
- return Boolean(this.fns[index]);
3782
- }
3783
- getInterceptorIndex(id) {
3784
- if (typeof id === "number") {
3785
- return this.fns[id] ? id : -1;
3786
- }
3787
- return this.fns.indexOf(id);
3788
- }
3789
- update(id, fn) {
3790
- const index = this.getInterceptorIndex(id);
3791
- if (this.fns[index]) {
3792
- this.fns[index] = fn;
3793
- return id;
3794
- }
3795
- return false;
3796
- }
3797
- use(fn) {
3798
- this.fns.push(fn);
3799
- return this.fns.length - 1;
1978
+ });
3800
1979
  }
3801
- };
3802
- var createInterceptors3 = /* @__PURE__ */ __name(() => ({
3803
- error: new Interceptors3(),
3804
- request: new Interceptors3(),
3805
- response: new Interceptors3()
3806
- }), "createInterceptors");
3807
- var defaultQuerySerializer3 = createQuerySerializer3({
3808
- allowReserved: false,
3809
- array: {
3810
- explode: true,
3811
- style: "form"
3812
- },
3813
- object: {
3814
- explode: true,
3815
- style: "deepObject"
1980
+ /**
1981
+ * Delete user account
1982
+ *
1983
+ *
1984
+ * Permanently delete the current user's account.
1985
+ *
1986
+ * This operation:
1987
+ * - Deactivates the account (user cannot log in)
1988
+ * - Anonymizes personal data (GDPR compliance)
1989
+ * - Frees up the email address for re-registration
1990
+ * - Preserves audit trail
1991
+ *
1992
+ * The account can be restored by an administrator if needed.
1993
+ *
1994
+ */
1995
+ static cfgAccountsProfileDeleteCreate(options) {
1996
+ return (options?.client ?? client).post({
1997
+ security: [{ scheme: "bearer", type: "http" }, {
1998
+ in: "cookie",
1999
+ name: "sessionid",
2000
+ type: "apiKey"
2001
+ }],
2002
+ url: "/cfg/accounts/profile/delete/",
2003
+ ...options
2004
+ });
3816
2005
  }
3817
- });
3818
- var defaultHeaders3 = {
3819
- "Content-Type": "application/json"
3820
- };
3821
- var createConfig3 = /* @__PURE__ */ __name((override = {}) => ({
3822
- ...jsonBodySerializer3,
3823
- headers: defaultHeaders3,
3824
- parseAs: "auto",
3825
- querySerializer: defaultQuerySerializer3,
3826
- ...override
3827
- }), "createConfig");
3828
-
3829
- // src/_api/generated/cfg_totp/client/client.gen.ts
3830
- var createClient3 = /* @__PURE__ */ __name((config = {}) => {
3831
- let _config = mergeConfigs3(createConfig3(), config);
3832
- const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
3833
- const setConfig = /* @__PURE__ */ __name((config2) => {
3834
- _config = mergeConfigs3(_config, config2);
3835
- return getConfig();
3836
- }, "setConfig");
3837
- const interceptors = createInterceptors3();
3838
- const beforeRequest = /* @__PURE__ */ __name(async (options) => {
3839
- const opts = {
3840
- ..._config,
2006
+ /**
2007
+ * Partial update user profile
2008
+ *
2009
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
2010
+ */
2011
+ static cfgAccountsProfilePartialPartialUpdate(options) {
2012
+ return (options?.client ?? client).patch({
2013
+ security: [{ scheme: "bearer", type: "http" }, {
2014
+ in: "cookie",
2015
+ name: "sessionid",
2016
+ type: "apiKey"
2017
+ }],
2018
+ url: "/cfg/accounts/profile/partial/",
3841
2019
  ...options,
3842
- fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
3843
- headers: mergeHeaders3(_config.headers, options.headers),
3844
- serializedBody: void 0
3845
- };
3846
- if (opts.security) {
3847
- await setAuthParams3({
3848
- ...opts,
3849
- security: opts.security
3850
- });
3851
- }
3852
- if (opts.requestValidator) {
3853
- await opts.requestValidator(opts);
3854
- }
3855
- if (opts.body !== void 0 && opts.bodySerializer) {
3856
- opts.serializedBody = opts.bodySerializer(opts.body);
3857
- }
3858
- if (opts.body === void 0 || opts.serializedBody === "") {
3859
- opts.headers.delete("Content-Type");
3860
- }
3861
- const resolvedOpts = opts;
3862
- const url = buildUrl3(resolvedOpts);
3863
- return { opts: resolvedOpts, url };
3864
- }, "beforeRequest");
3865
- const request = /* @__PURE__ */ __name(async (options) => {
3866
- const throwOnError = options.throwOnError ?? _config.throwOnError;
3867
- const responseStyle = options.responseStyle ?? _config.responseStyle;
3868
- let request2;
3869
- let response;
3870
- try {
3871
- const { opts, url } = await beforeRequest(options);
3872
- const requestInit = {
3873
- redirect: "follow",
3874
- ...opts,
3875
- body: getValidRequestBody3(opts)
3876
- };
3877
- request2 = new Request(url, requestInit);
3878
- for (const fn of interceptors.request.fns) {
3879
- if (fn) {
3880
- request2 = await fn(request2, opts);
3881
- }
3882
- }
3883
- const _fetch = opts.fetch;
3884
- response = await _fetch(request2);
3885
- for (const fn of interceptors.response.fns) {
3886
- if (fn) {
3887
- response = await fn(response, request2, opts);
3888
- }
2020
+ headers: {
2021
+ "Content-Type": "application/json",
2022
+ ...options?.headers
3889
2023
  }
3890
- const result = {
3891
- request: request2,
3892
- response
3893
- };
3894
- if (response.ok) {
3895
- const parseAs = (opts.parseAs === "auto" ? getParseAs3(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
3896
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
3897
- let emptyData;
3898
- switch (parseAs) {
3899
- case "arrayBuffer":
3900
- case "blob":
3901
- case "text":
3902
- emptyData = await response[parseAs]();
3903
- break;
3904
- case "formData":
3905
- emptyData = new FormData();
3906
- break;
3907
- case "stream":
3908
- emptyData = response.body;
3909
- break;
3910
- case "json":
3911
- default:
3912
- emptyData = {};
3913
- break;
3914
- }
3915
- return opts.responseStyle === "data" ? emptyData : {
3916
- data: emptyData,
3917
- ...result
3918
- };
3919
- }
3920
- let data;
3921
- switch (parseAs) {
3922
- case "arrayBuffer":
3923
- case "blob":
3924
- case "formData":
3925
- case "text":
3926
- data = await response[parseAs]();
3927
- break;
3928
- case "json": {
3929
- const text = await response.text();
3930
- data = text ? JSON.parse(text) : {};
3931
- break;
3932
- }
3933
- case "stream":
3934
- return opts.responseStyle === "data" ? response.body : {
3935
- data: response.body,
3936
- ...result
3937
- };
3938
- }
3939
- if (parseAs === "json") {
3940
- if (opts.responseValidator) {
3941
- await opts.responseValidator(data);
3942
- }
3943
- if (opts.responseTransformer) {
3944
- data = await opts.responseTransformer(data);
3945
- }
3946
- }
3947
- return opts.responseStyle === "data" ? data : {
3948
- data,
3949
- ...result
3950
- };
2024
+ });
2025
+ }
2026
+ /**
2027
+ * Partial update user profile
2028
+ *
2029
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
2030
+ */
2031
+ static cfgAccountsProfilePartialUpdate(options) {
2032
+ return (options?.client ?? client).put({
2033
+ security: [{ scheme: "bearer", type: "http" }, {
2034
+ in: "cookie",
2035
+ name: "sessionid",
2036
+ type: "apiKey"
2037
+ }],
2038
+ url: "/cfg/accounts/profile/partial/",
2039
+ ...options,
2040
+ headers: {
2041
+ "Content-Type": "application/json",
2042
+ ...options?.headers
3951
2043
  }
3952
- const textError = await response.text();
3953
- let jsonError;
3954
- try {
3955
- jsonError = JSON.parse(textError);
3956
- } catch {
2044
+ });
2045
+ }
2046
+ /**
2047
+ * Update user profile
2048
+ *
2049
+ * Update the current authenticated user's profile information.
2050
+ */
2051
+ static cfgAccountsProfileUpdatePartialUpdate(options) {
2052
+ return (options?.client ?? client).patch({
2053
+ security: [{ scheme: "bearer", type: "http" }, {
2054
+ in: "cookie",
2055
+ name: "sessionid",
2056
+ type: "apiKey"
2057
+ }],
2058
+ url: "/cfg/accounts/profile/update/",
2059
+ ...options,
2060
+ headers: {
2061
+ "Content-Type": "application/json",
2062
+ ...options?.headers
3957
2063
  }
3958
- throw jsonError ?? textError;
3959
- } catch (error) {
3960
- let finalError = error;
3961
- for (const fn of interceptors.error.fns) {
3962
- if (fn) {
3963
- finalError = await fn(finalError, response, request2, options);
3964
- }
2064
+ });
2065
+ }
2066
+ /**
2067
+ * Update user profile
2068
+ *
2069
+ * Update the current authenticated user's profile information.
2070
+ */
2071
+ static cfgAccountsProfileUpdateUpdate(options) {
2072
+ return (options?.client ?? client).put({
2073
+ security: [{ scheme: "bearer", type: "http" }, {
2074
+ in: "cookie",
2075
+ name: "sessionid",
2076
+ type: "apiKey"
2077
+ }],
2078
+ url: "/cfg/accounts/profile/update/",
2079
+ ...options,
2080
+ headers: {
2081
+ "Content-Type": "application/json",
2082
+ ...options?.headers
3965
2083
  }
3966
- finalError = finalError || {};
3967
- if (throwOnError) {
3968
- throw finalError;
2084
+ });
2085
+ }
2086
+ /**
2087
+ * Refresh JWT token.
2088
+ */
2089
+ static cfgAccountsTokenRefreshCreate(options) {
2090
+ return (options.client ?? client).post({
2091
+ url: "/cfg/accounts/token/refresh/",
2092
+ ...options,
2093
+ headers: {
2094
+ "Content-Type": "application/json",
2095
+ ...options.headers
3969
2096
  }
3970
- return responseStyle === "data" ? void 0 : {
3971
- error: finalError,
3972
- request: request2,
3973
- response
3974
- };
3975
- }
3976
- }, "request");
3977
- const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
3978
- const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
3979
- const { opts, url } = await beforeRequest(options);
3980
- return createSseClient3({
3981
- ...opts,
3982
- body: opts.body,
3983
- method,
3984
- onRequest: /* @__PURE__ */ __name(async (url2, init) => {
3985
- let request2 = new Request(url2, init);
3986
- for (const fn of interceptors.request.fns) {
3987
- if (fn) {
3988
- request2 = await fn(request2, opts);
3989
- }
3990
- }
3991
- return request2;
3992
- }, "onRequest"),
3993
- serializedBody: getValidRequestBody3(opts),
3994
- url
3995
2097
  });
3996
- }, "makeSseFn");
3997
- const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl3({ ..._config, ...options }), "_buildUrl");
3998
- return {
3999
- buildUrl: _buildUrl,
4000
- connect: makeMethodFn("CONNECT"),
4001
- delete: makeMethodFn("DELETE"),
4002
- get: makeMethodFn("GET"),
4003
- getConfig,
4004
- head: makeMethodFn("HEAD"),
4005
- interceptors,
4006
- options: makeMethodFn("OPTIONS"),
4007
- patch: makeMethodFn("PATCH"),
4008
- post: makeMethodFn("POST"),
4009
- put: makeMethodFn("PUT"),
4010
- request,
4011
- setConfig,
4012
- sse: {
4013
- connect: makeSseFn("CONNECT"),
4014
- delete: makeSseFn("DELETE"),
4015
- get: makeSseFn("GET"),
4016
- head: makeSseFn("HEAD"),
4017
- options: makeSseFn("OPTIONS"),
4018
- patch: makeSseFn("PATCH"),
4019
- post: makeSseFn("POST"),
4020
- put: makeSseFn("PUT"),
4021
- trace: makeSseFn("TRACE")
4022
- },
4023
- trace: makeMethodFn("TRACE")
4024
- };
4025
- }, "createClient");
4026
-
4027
- // src/_api/generated/cfg_totp/client.gen.ts
4028
- var client3 = createClient3(createConfig3({ baseUrl: "http://localhost:8000" }));
4029
-
4030
- // src/_api/generated/cfg_totp/sdk.gen.ts
4031
- var Cfg3 = class {
2098
+ }
2099
+ };
2100
+ var OAuth = class {
4032
2101
  static {
4033
- __name(this, "Cfg");
2102
+ __name(this, "OAuth");
4034
2103
  }
4035
2104
  /**
4036
- * Get backup codes status for user.
2105
+ * List OAuth connections
2106
+ *
2107
+ * Get all OAuth connections for the current user.
4037
2108
  */
4038
- static cfgTotpBackupCodesRetrieve(options) {
4039
- return (options?.client ?? client3).get({
2109
+ static cfgAccountsOauthConnectionsList(options) {
2110
+ return (options?.client ?? client).get({
4040
2111
  security: [{ scheme: "bearer", type: "http" }],
4041
- url: "/cfg/totp/backup-codes/",
2112
+ url: "/cfg/accounts/oauth/connections/",
4042
2113
  ...options
4043
2114
  });
4044
2115
  }
4045
2116
  /**
4046
- * Regenerate backup codes.
2117
+ * Disconnect OAuth provider
4047
2118
  *
4048
- * Requires TOTP code for verification.
4049
- * Invalidates all existing codes.
2119
+ * Remove OAuth connection for the specified provider.
4050
2120
  */
4051
- static cfgTotpBackupCodesRegenerateCreate(options) {
4052
- return (options.client ?? client3).post({
2121
+ static cfgAccountsOauthDisconnectCreate(options) {
2122
+ return (options.client ?? client).post({
4053
2123
  security: [{ scheme: "bearer", type: "http" }],
4054
- url: "/cfg/totp/backup-codes/regenerate/",
2124
+ url: "/cfg/accounts/oauth/disconnect/",
4055
2125
  ...options,
4056
2126
  headers: {
4057
2127
  "Content-Type": "application/json",
@@ -4060,52 +2130,140 @@ var Cfg3 = class {
4060
2130
  });
4061
2131
  }
4062
2132
  /**
4063
- * List all TOTP devices for user.
2133
+ * Start GitHub OAuth
2134
+ *
2135
+ * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
4064
2136
  */
4065
- static cfgTotpDevicesRetrieve(options) {
4066
- return (options?.client ?? client3).get({
4067
- security: [{ scheme: "bearer", type: "http" }],
4068
- url: "/cfg/totp/devices/",
2137
+ static cfgAccountsOauthGithubAuthorizeCreate(options) {
2138
+ return (options?.client ?? client).post({
2139
+ url: "/cfg/accounts/oauth/github/authorize/",
2140
+ ...options,
2141
+ headers: {
2142
+ "Content-Type": "application/json",
2143
+ ...options?.headers
2144
+ }
2145
+ });
2146
+ }
2147
+ /**
2148
+ * Complete GitHub OAuth
2149
+ *
2150
+ * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
2151
+ */
2152
+ static cfgAccountsOauthGithubCallbackCreate(options) {
2153
+ return (options.client ?? client).post({
2154
+ url: "/cfg/accounts/oauth/github/callback/",
2155
+ ...options,
2156
+ headers: {
2157
+ "Content-Type": "application/json",
2158
+ ...options.headers
2159
+ }
2160
+ });
2161
+ }
2162
+ /**
2163
+ * List OAuth providers
2164
+ *
2165
+ * Get list of available OAuth providers for authentication.
2166
+ */
2167
+ static cfgAccountsOauthProvidersRetrieve(options) {
2168
+ return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
2169
+ }
2170
+ };
2171
+ var UserProfile = class {
2172
+ static {
2173
+ __name(this, "UserProfile");
2174
+ }
2175
+ /**
2176
+ * Get current user profile
2177
+ *
2178
+ * Retrieve the current authenticated user's profile information.
2179
+ */
2180
+ static cfgAccountsProfileRetrieve(options) {
2181
+ return (options?.client ?? client).get({
2182
+ security: [{ scheme: "bearer", type: "http" }, {
2183
+ in: "cookie",
2184
+ name: "sessionid",
2185
+ type: "apiKey"
2186
+ }],
2187
+ url: "/cfg/accounts/profile/",
4069
2188
  ...options
4070
2189
  });
4071
2190
  }
4072
2191
  /**
4073
- * Delete a TOTP device.
2192
+ * Upload user avatar
4074
2193
  *
4075
- * Requires verification code if removing the last/primary device.
2194
+ * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
4076
2195
  */
4077
- static cfgTotpDevicesDestroy(options) {
4078
- return (options.client ?? client3).delete({
2196
+ static cfgAccountsProfileAvatarCreate(options) {
2197
+ return (options?.client ?? client).post({
2198
+ ...formDataBodySerializer,
4079
2199
  security: [{ scheme: "bearer", type: "http" }],
4080
- url: "/cfg/totp/devices/{id}/",
2200
+ url: "/cfg/accounts/profile/avatar/",
2201
+ ...options,
2202
+ headers: {
2203
+ "Content-Type": null,
2204
+ ...options?.headers
2205
+ }
2206
+ });
2207
+ }
2208
+ /**
2209
+ * Delete user account
2210
+ *
2211
+ *
2212
+ * Permanently delete the current user's account.
2213
+ *
2214
+ * This operation:
2215
+ * - Deactivates the account (user cannot log in)
2216
+ * - Anonymizes personal data (GDPR compliance)
2217
+ * - Frees up the email address for re-registration
2218
+ * - Preserves audit trail
2219
+ *
2220
+ * The account can be restored by an administrator if needed.
2221
+ *
2222
+ */
2223
+ static cfgAccountsProfileDeleteCreate(options) {
2224
+ return (options?.client ?? client).post({
2225
+ security: [{ scheme: "bearer", type: "http" }, {
2226
+ in: "cookie",
2227
+ name: "sessionid",
2228
+ type: "apiKey"
2229
+ }],
2230
+ url: "/cfg/accounts/profile/delete/",
4081
2231
  ...options
4082
2232
  });
4083
2233
  }
4084
2234
  /**
4085
- * Completely disable 2FA for account.
2235
+ * Partial update user profile
4086
2236
  *
4087
- * Requires verification code.
2237
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
4088
2238
  */
4089
- static cfgTotpDisableCreate(options) {
4090
- return (options.client ?? client3).post({
4091
- security: [{ scheme: "bearer", type: "http" }],
4092
- url: "/cfg/totp/disable/",
2239
+ static cfgAccountsProfilePartialPartialUpdate(options) {
2240
+ return (options?.client ?? client).patch({
2241
+ security: [{ scheme: "bearer", type: "http" }, {
2242
+ in: "cookie",
2243
+ name: "sessionid",
2244
+ type: "apiKey"
2245
+ }],
2246
+ url: "/cfg/accounts/profile/partial/",
4093
2247
  ...options,
4094
2248
  headers: {
4095
2249
  "Content-Type": "application/json",
4096
- ...options.headers
2250
+ ...options?.headers
4097
2251
  }
4098
2252
  });
4099
2253
  }
4100
2254
  /**
4101
- * Start 2FA setup process.
2255
+ * Partial update user profile
4102
2256
  *
4103
- * Creates a new TOTP device and returns QR code for scanning.
2257
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
4104
2258
  */
4105
- static cfgTotpSetupCreate(options) {
4106
- return (options?.client ?? client3).post({
4107
- security: [{ scheme: "bearer", type: "http" }],
4108
- url: "/cfg/totp/setup/",
2259
+ static cfgAccountsProfilePartialUpdate(options) {
2260
+ return (options?.client ?? client).put({
2261
+ security: [{ scheme: "bearer", type: "http" }, {
2262
+ in: "cookie",
2263
+ name: "sessionid",
2264
+ type: "apiKey"
2265
+ }],
2266
+ url: "/cfg/accounts/profile/partial/",
4109
2267
  ...options,
4110
2268
  headers: {
4111
2269
  "Content-Type": "application/json",
@@ -4114,46 +2272,56 @@ var Cfg3 = class {
4114
2272
  });
4115
2273
  }
4116
2274
  /**
4117
- * Confirm 2FA setup with first valid code.
2275
+ * Update user profile
4118
2276
  *
4119
- * Activates the device and generates backup codes.
2277
+ * Update the current authenticated user's profile information.
4120
2278
  */
4121
- static cfgTotpSetupConfirmCreate(options) {
4122
- return (options.client ?? client3).post({
4123
- security: [{ scheme: "bearer", type: "http" }],
4124
- url: "/cfg/totp/setup/confirm/",
2279
+ static cfgAccountsProfileUpdatePartialUpdate(options) {
2280
+ return (options?.client ?? client).patch({
2281
+ security: [{ scheme: "bearer", type: "http" }, {
2282
+ in: "cookie",
2283
+ name: "sessionid",
2284
+ type: "apiKey"
2285
+ }],
2286
+ url: "/cfg/accounts/profile/update/",
4125
2287
  ...options,
4126
2288
  headers: {
4127
2289
  "Content-Type": "application/json",
4128
- ...options.headers
2290
+ ...options?.headers
4129
2291
  }
4130
2292
  });
4131
2293
  }
4132
2294
  /**
4133
- * Verify TOTP code for 2FA session.
2295
+ * Update user profile
4134
2296
  *
4135
- * Completes authentication and returns JWT tokens on success.
2297
+ * Update the current authenticated user's profile information.
4136
2298
  */
4137
- static cfgTotpVerifyCreate(options) {
4138
- return (options.client ?? client3).post({
4139
- security: [{ scheme: "bearer", type: "http" }],
4140
- url: "/cfg/totp/verify/",
2299
+ static cfgAccountsProfileUpdateUpdate(options) {
2300
+ return (options?.client ?? client).put({
2301
+ security: [{ scheme: "bearer", type: "http" }, {
2302
+ in: "cookie",
2303
+ name: "sessionid",
2304
+ type: "apiKey"
2305
+ }],
2306
+ url: "/cfg/accounts/profile/update/",
4141
2307
  ...options,
4142
2308
  headers: {
4143
2309
  "Content-Type": "application/json",
4144
- ...options.headers
2310
+ ...options?.headers
4145
2311
  }
4146
2312
  });
4147
2313
  }
2314
+ };
2315
+ var Auth = class {
2316
+ static {
2317
+ __name(this, "Auth");
2318
+ }
4148
2319
  /**
4149
- * Verify backup recovery code for 2FA session.
4150
- *
4151
- * Alternative verification method when TOTP device unavailable.
2320
+ * Refresh JWT token.
4152
2321
  */
4153
- static cfgTotpVerifyBackupCreate(options) {
4154
- return (options.client ?? client3).post({
4155
- security: [{ scheme: "bearer", type: "http" }],
4156
- url: "/cfg/totp/verify/backup/",
2322
+ static cfgAccountsTokenRefreshCreate(options) {
2323
+ return (options.client ?? client).post({
2324
+ url: "/cfg/accounts/token/refresh/",
4157
2325
  ...options,
4158
2326
  headers: {
4159
2327
  "Content-Type": "application/json",
@@ -4162,6 +2330,40 @@ var Cfg3 = class {
4162
2330
  });
4163
2331
  }
4164
2332
  };
2333
+ var Centrifugo = class {
2334
+ static {
2335
+ __name(this, "Centrifugo");
2336
+ }
2337
+ /**
2338
+ * Get Centrifugo connection token
2339
+ *
2340
+ * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
2341
+ */
2342
+ static cfgCentrifugoAuthTokenRetrieve(options) {
2343
+ return (options?.client ?? client).get({
2344
+ security: [{ scheme: "bearer", type: "http" }],
2345
+ url: "/cfg/centrifugo/auth/token/",
2346
+ ...options
2347
+ });
2348
+ }
2349
+ };
2350
+ var CentrifugoAuth = class {
2351
+ static {
2352
+ __name(this, "CentrifugoAuth");
2353
+ }
2354
+ /**
2355
+ * Get Centrifugo connection token
2356
+ *
2357
+ * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
2358
+ */
2359
+ static cfgCentrifugoAuthTokenRetrieve(options) {
2360
+ return (options?.client ?? client).get({
2361
+ security: [{ scheme: "bearer", type: "http" }],
2362
+ url: "/cfg/centrifugo/auth/token/",
2363
+ ...options
2364
+ });
2365
+ }
2366
+ };
4165
2367
  var Totp = class {
4166
2368
  static {
4167
2369
  __name(this, "Totp");
@@ -4170,7 +2372,7 @@ var Totp = class {
4170
2372
  * Get backup codes status for user.
4171
2373
  */
4172
2374
  static cfgTotpBackupCodesRetrieve(options) {
4173
- return (options?.client ?? client3).get({
2375
+ return (options?.client ?? client).get({
4174
2376
  security: [{ scheme: "bearer", type: "http" }],
4175
2377
  url: "/cfg/totp/backup-codes/",
4176
2378
  ...options
@@ -4183,7 +2385,7 @@ var Totp = class {
4183
2385
  * Invalidates all existing codes.
4184
2386
  */
4185
2387
  static cfgTotpBackupCodesRegenerateCreate(options) {
4186
- return (options.client ?? client3).post({
2388
+ return (options.client ?? client).post({
4187
2389
  security: [{ scheme: "bearer", type: "http" }],
4188
2390
  url: "/cfg/totp/backup-codes/regenerate/",
4189
2391
  ...options,
@@ -4197,7 +2399,7 @@ var Totp = class {
4197
2399
  * List all TOTP devices for user.
4198
2400
  */
4199
2401
  static cfgTotpDevicesRetrieve(options) {
4200
- return (options?.client ?? client3).get({
2402
+ return (options?.client ?? client).get({
4201
2403
  security: [{ scheme: "bearer", type: "http" }],
4202
2404
  url: "/cfg/totp/devices/",
4203
2405
  ...options
@@ -4209,7 +2411,7 @@ var Totp = class {
4209
2411
  * Requires verification code if removing the last/primary device.
4210
2412
  */
4211
2413
  static cfgTotpDevicesDestroy(options) {
4212
- return (options.client ?? client3).delete({
2414
+ return (options.client ?? client).delete({
4213
2415
  security: [{ scheme: "bearer", type: "http" }],
4214
2416
  url: "/cfg/totp/devices/{id}/",
4215
2417
  ...options
@@ -4221,7 +2423,7 @@ var Totp = class {
4221
2423
  * Requires verification code.
4222
2424
  */
4223
2425
  static cfgTotpDisableCreate(options) {
4224
- return (options.client ?? client3).post({
2426
+ return (options.client ?? client).post({
4225
2427
  security: [{ scheme: "bearer", type: "http" }],
4226
2428
  url: "/cfg/totp/disable/",
4227
2429
  ...options,
@@ -4237,7 +2439,7 @@ var Totp = class {
4237
2439
  * Creates a new TOTP device and returns QR code for scanning.
4238
2440
  */
4239
2441
  static cfgTotpSetupCreate(options) {
4240
- return (options?.client ?? client3).post({
2442
+ return (options?.client ?? client).post({
4241
2443
  security: [{ scheme: "bearer", type: "http" }],
4242
2444
  url: "/cfg/totp/setup/",
4243
2445
  ...options,
@@ -4253,7 +2455,7 @@ var Totp = class {
4253
2455
  * Activates the device and generates backup codes.
4254
2456
  */
4255
2457
  static cfgTotpSetupConfirmCreate(options) {
4256
- return (options.client ?? client3).post({
2458
+ return (options.client ?? client).post({
4257
2459
  security: [{ scheme: "bearer", type: "http" }],
4258
2460
  url: "/cfg/totp/setup/confirm/",
4259
2461
  ...options,
@@ -4269,7 +2471,7 @@ var Totp = class {
4269
2471
  * Completes authentication and returns JWT tokens on success.
4270
2472
  */
4271
2473
  static cfgTotpVerifyCreate(options) {
4272
- return (options.client ?? client3).post({
2474
+ return (options.client ?? client).post({
4273
2475
  security: [{ scheme: "bearer", type: "http" }],
4274
2476
  url: "/cfg/totp/verify/",
4275
2477
  ...options,
@@ -4285,7 +2487,7 @@ var Totp = class {
4285
2487
  * Alternative verification method when TOTP device unavailable.
4286
2488
  */
4287
2489
  static cfgTotpVerifyBackupCreate(options) {
4288
- return (options.client ?? client3).post({
2490
+ return (options.client ?? client).post({
4289
2491
  security: [{ scheme: "bearer", type: "http" }],
4290
2492
  url: "/cfg/totp/verify/backup/",
4291
2493
  ...options,
@@ -4304,7 +2506,7 @@ var BackupCodes = class {
4304
2506
  * Get backup codes status for user.
4305
2507
  */
4306
2508
  static cfgTotpBackupCodesRetrieve(options) {
4307
- return (options?.client ?? client3).get({
2509
+ return (options?.client ?? client).get({
4308
2510
  security: [{ scheme: "bearer", type: "http" }],
4309
2511
  url: "/cfg/totp/backup-codes/",
4310
2512
  ...options
@@ -4317,7 +2519,7 @@ var BackupCodes = class {
4317
2519
  * Invalidates all existing codes.
4318
2520
  */
4319
2521
  static cfgTotpBackupCodesRegenerateCreate(options) {
4320
- return (options.client ?? client3).post({
2522
+ return (options.client ?? client).post({
4321
2523
  security: [{ scheme: "bearer", type: "http" }],
4322
2524
  url: "/cfg/totp/backup-codes/regenerate/",
4323
2525
  ...options,
@@ -4336,7 +2538,7 @@ var TotpManagement = class {
4336
2538
  * List all TOTP devices for user.
4337
2539
  */
4338
2540
  static cfgTotpDevicesRetrieve(options) {
4339
- return (options?.client ?? client3).get({
2541
+ return (options?.client ?? client).get({
4340
2542
  security: [{ scheme: "bearer", type: "http" }],
4341
2543
  url: "/cfg/totp/devices/",
4342
2544
  ...options
@@ -4348,7 +2550,7 @@ var TotpManagement = class {
4348
2550
  * Requires verification code.
4349
2551
  */
4350
2552
  static cfgTotpDisableCreate(options) {
4351
- return (options.client ?? client3).post({
2553
+ return (options.client ?? client).post({
4352
2554
  security: [{ scheme: "bearer", type: "http" }],
4353
2555
  url: "/cfg/totp/disable/",
4354
2556
  ...options,
@@ -4369,7 +2571,7 @@ var TotpSetup = class {
4369
2571
  * Creates a new TOTP device and returns QR code for scanning.
4370
2572
  */
4371
2573
  static cfgTotpSetupCreate(options) {
4372
- return (options?.client ?? client3).post({
2574
+ return (options?.client ?? client).post({
4373
2575
  security: [{ scheme: "bearer", type: "http" }],
4374
2576
  url: "/cfg/totp/setup/",
4375
2577
  ...options,
@@ -4385,7 +2587,7 @@ var TotpSetup = class {
4385
2587
  * Activates the device and generates backup codes.
4386
2588
  */
4387
2589
  static cfgTotpSetupConfirmCreate(options) {
4388
- return (options.client ?? client3).post({
2590
+ return (options.client ?? client).post({
4389
2591
  security: [{ scheme: "bearer", type: "http" }],
4390
2592
  url: "/cfg/totp/setup/confirm/",
4391
2593
  ...options,
@@ -4406,7 +2608,7 @@ var TotpVerification = class {
4406
2608
  * Completes authentication and returns JWT tokens on success.
4407
2609
  */
4408
2610
  static cfgTotpVerifyCreate(options) {
4409
- return (options.client ?? client3).post({
2611
+ return (options.client ?? client).post({
4410
2612
  security: [{ scheme: "bearer", type: "http" }],
4411
2613
  url: "/cfg/totp/verify/",
4412
2614
  ...options,
@@ -4422,7 +2624,7 @@ var TotpVerification = class {
4422
2624
  * Alternative verification method when TOTP device unavailable.
4423
2625
  */
4424
2626
  static cfgTotpVerifyBackupCreate(options) {
4425
- return (options.client ?? client3).post({
2627
+ return (options.client ?? client).post({
4426
2628
  security: [{ scheme: "bearer", type: "http" }],
4427
2629
  url: "/cfg/totp/verify/backup/",
4428
2630
  ...options,
@@ -4433,273 +2635,4 @@ var TotpVerification = class {
4433
2635
  });
4434
2636
  }
4435
2637
  };
4436
-
4437
- // src/_api/generated/cfg_totp/schemas/BackupCodesRegenerateRequest.ts
4438
- var import_zod23 = require("zod");
4439
- var BackupCodesRegenerateRequestSchema = import_zod23.z.object({
4440
- code: import_zod23.z.string().min(6).max(6)
4441
- });
4442
-
4443
- // src/_api/generated/cfg_totp/schemas/BackupCodesRegenerateResponse.ts
4444
- var import_zod24 = require("zod");
4445
- var BackupCodesRegenerateResponseSchema = import_zod24.z.object({
4446
- backup_codes: import_zod24.z.array(import_zod24.z.string()),
4447
- warning: import_zod24.z.string()
4448
- });
4449
-
4450
- // src/_api/generated/cfg_totp/schemas/BackupCodesStatus.ts
4451
- var import_zod25 = require("zod");
4452
- var BackupCodesStatusSchema = import_zod25.z.object({
4453
- remaining_count: import_zod25.z.number().int(),
4454
- total_generated: import_zod25.z.number().int(),
4455
- warning: import_zod25.z.string().nullable().optional()
4456
- });
4457
-
4458
- // src/_api/generated/cfg_totp/schemas/ConfirmSetupRequest.ts
4459
- var import_zod26 = require("zod");
4460
- var ConfirmSetupRequestSchema = import_zod26.z.object({
4461
- device_id: import_zod26.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
4462
- code: import_zod26.z.string().min(6).max(6)
4463
- });
4464
-
4465
- // src/_api/generated/cfg_totp/schemas/ConfirmSetupResponse.ts
4466
- var import_zod27 = require("zod");
4467
- var ConfirmSetupResponseSchema = import_zod27.z.object({
4468
- message: import_zod27.z.string(),
4469
- backup_codes: import_zod27.z.array(import_zod27.z.string()),
4470
- backup_codes_warning: import_zod27.z.string()
4471
- });
4472
-
4473
- // src/_api/generated/cfg_totp/schemas/DeviceList.ts
4474
- var import_zod29 = require("zod");
4475
-
4476
- // src/_api/generated/cfg_totp/schemas/DeviceListStatusEnum.ts
4477
- var import_zod28 = require("zod");
4478
- var DeviceListStatusEnumSchema = import_zod28.z.enum(["pending", "active", "disabled"]);
4479
-
4480
- // src/_api/generated/cfg_totp/schemas/DeviceList.ts
4481
- var DeviceListSchema = import_zod29.z.object({
4482
- id: import_zod29.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
4483
- name: import_zod29.z.string(),
4484
- is_primary: import_zod29.z.boolean(),
4485
- status: DeviceListStatusEnumSchema,
4486
- created_at: import_zod29.z.string().datetime({ offset: true }),
4487
- confirmed_at: import_zod29.z.string().datetime({ offset: true }).nullable(),
4488
- last_used_at: import_zod29.z.string().datetime({ offset: true }).nullable()
4489
- });
4490
-
4491
- // src/_api/generated/cfg_totp/schemas/DeviceListResponse.ts
4492
- var import_zod30 = require("zod");
4493
- var DeviceListResponseSchema = import_zod30.z.object({
4494
- devices: import_zod30.z.array(DeviceListSchema),
4495
- has_2fa_enabled: import_zod30.z.boolean()
4496
- });
4497
-
4498
- // src/_api/generated/cfg_totp/schemas/DisableRequest.ts
4499
- var import_zod31 = require("zod");
4500
- var DisableRequestSchema = import_zod31.z.object({
4501
- code: import_zod31.z.string().min(6).max(6)
4502
- });
4503
-
4504
- // src/_api/generated/cfg_totp/schemas/SetupRequest.ts
4505
- var import_zod32 = require("zod");
4506
- var SetupRequestSchema = import_zod32.z.object({
4507
- device_name: import_zod32.z.string().min(1).max(100).optional()
4508
- });
4509
-
4510
- // src/_api/generated/cfg_totp/schemas/SetupResponse.ts
4511
- var import_zod33 = require("zod");
4512
- var SetupResponseSchema = import_zod33.z.object({
4513
- device_id: import_zod33.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
4514
- secret: import_zod33.z.string(),
4515
- provisioning_uri: import_zod33.z.string(),
4516
- qr_code_base64: import_zod33.z.string(),
4517
- expires_in: import_zod33.z.number().int()
4518
- });
4519
-
4520
- // src/_api/generated/cfg_totp/schemas/TotpVerifyUser.ts
4521
- var import_zod34 = require("zod");
4522
- var TotpVerifyUserSchema = import_zod34.z.object({
4523
- id: import_zod34.z.number().int(),
4524
- email: import_zod34.z.email(),
4525
- first_name: import_zod34.z.string().max(50).optional(),
4526
- last_name: import_zod34.z.string().max(50).optional(),
4527
- full_name: import_zod34.z.string(),
4528
- initials: import_zod34.z.string(),
4529
- display_username: import_zod34.z.string(),
4530
- company: import_zod34.z.string().max(100).optional(),
4531
- phone: import_zod34.z.string().max(20).optional(),
4532
- position: import_zod34.z.string().max(100).optional(),
4533
- language: import_zod34.z.string().max(10).optional(),
4534
- avatar: import_zod34.z.string().nullable(),
4535
- is_staff: import_zod34.z.boolean(),
4536
- is_superuser: import_zod34.z.boolean(),
4537
- date_joined: import_zod34.z.string().datetime({ offset: true }),
4538
- last_login: import_zod34.z.string().datetime({ offset: true }).nullable(),
4539
- unanswered_messages_count: import_zod34.z.number().int()
4540
- });
4541
-
4542
- // src/_api/generated/cfg_totp/schemas/VerifyBackupRequest.ts
4543
- var import_zod35 = require("zod");
4544
- var VerifyBackupRequestSchema = import_zod35.z.object({
4545
- session_id: import_zod35.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
4546
- backup_code: import_zod35.z.string().min(8).max(8)
4547
- });
4548
-
4549
- // src/_api/generated/cfg_totp/schemas/VerifyRequest.ts
4550
- var import_zod36 = require("zod");
4551
- var VerifyRequestSchema = import_zod36.z.object({
4552
- session_id: import_zod36.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
4553
- code: import_zod36.z.string().min(6).max(6)
4554
- });
4555
-
4556
- // src/_api/generated/cfg_totp/schemas/VerifyResponse.ts
4557
- var import_zod37 = require("zod");
4558
- var VerifyResponseSchema = import_zod37.z.object({
4559
- message: import_zod37.z.string(),
4560
- access_token: import_zod37.z.string(),
4561
- refresh_token: import_zod37.z.string(),
4562
- user: TotpVerifyUserSchema,
4563
- remaining_backup_codes: import_zod37.z.number().int().optional(),
4564
- warning: import_zod37.z.string().optional()
4565
- });
4566
-
4567
- // src/_api/generated/cfg_totp/api.ts
4568
- var ACCESS_KEY3 = "cfg.access_token";
4569
- var REFRESH_KEY3 = "cfg.refresh_token";
4570
- var VALIDATION_ROUTES3 = [
4571
- { method: "GET", re: new RegExp("^/cfg/totp/backup\\-codes/?$"), schema: BackupCodesStatusSchema, path: "/cfg/totp/backup-codes/" },
4572
- { method: "POST", re: new RegExp("^/cfg/totp/backup\\-codes/regenerate/?$"), schema: BackupCodesRegenerateResponseSchema, path: "/cfg/totp/backup-codes/regenerate/" },
4573
- { method: "GET", re: new RegExp("^/cfg/totp/devices/?$"), schema: DeviceListResponseSchema, path: "/cfg/totp/devices/" },
4574
- { method: "POST", re: new RegExp("^/cfg/totp/setup/?$"), schema: SetupResponseSchema, path: "/cfg/totp/setup/" },
4575
- { method: "POST", re: new RegExp("^/cfg/totp/setup/confirm/?$"), schema: ConfirmSetupResponseSchema, path: "/cfg/totp/setup/confirm/" },
4576
- { method: "POST", re: new RegExp("^/cfg/totp/verify/?$"), schema: VerifyResponseSchema, path: "/cfg/totp/verify/" },
4577
- { method: "POST", re: new RegExp("^/cfg/totp/verify/backup/?$"), schema: VerifyResponseSchema, path: "/cfg/totp/verify/backup/" }
4578
- ];
4579
- function detectLocale3() {
4580
- try {
4581
- if (typeof document !== "undefined") {
4582
- const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
4583
- if (m) return decodeURIComponent(m[1]);
4584
- }
4585
- if (typeof navigator !== "undefined" && navigator.language) {
4586
- return navigator.language;
4587
- }
4588
- } catch {
4589
- }
4590
- return null;
4591
- }
4592
- __name(detectLocale3, "detectLocale");
4593
- var API3 = class {
4594
- static {
4595
- __name(this, "API");
4596
- }
4597
- baseUrl;
4598
- storage;
4599
- locale;
4600
- apiKey;
4601
- logger;
4602
- cfg = Cfg3;
4603
- totp = Totp;
4604
- backupCodes = BackupCodes;
4605
- totpManagement = TotpManagement;
4606
- totpSetup = TotpSetup;
4607
- totpVerification = TotpVerification;
4608
- constructor(baseUrl2, opts = {}) {
4609
- this.baseUrl = baseUrl2.replace(/\/$/, "");
4610
- this.storage = opts.storage ?? new LocalStorageAdapter();
4611
- this.logger = new APILogger(opts.logger);
4612
- this.locale = opts.locale ?? null;
4613
- this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
4614
- const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
4615
- client3.setConfig({ baseUrl: this.baseUrl, credentials });
4616
- client3.interceptors.request.use((request) => {
4617
- const access = this.getToken();
4618
- if (access) request.headers.set("Authorization", `Bearer ${access}`);
4619
- const locale = this.locale ?? detectLocale3();
4620
- if (locale) request.headers.set("Accept-Language", locale);
4621
- if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
4622
- return request;
4623
- });
4624
- client3.interceptors.response.use(async (response, request) => {
4625
- if (!response.ok) return response;
4626
- const ct = response.headers.get("content-type") || "";
4627
- if (!ct.includes("application/json")) return response;
4628
- const url = new URL(request.url);
4629
- const method = request.method.toUpperCase();
4630
- const route = VALIDATION_ROUTES3.find(
4631
- (r) => r.method === method && r.re.test(url.pathname)
4632
- );
4633
- if (!route) return response;
4634
- let payload;
4635
- try {
4636
- payload = await response.clone().json();
4637
- } catch {
4638
- return response;
4639
- }
4640
- const result = route.schema.safeParse(payload);
4641
- if (!result.success) {
4642
- dispatchValidationError({
4643
- operation: `${method} ${route.path}`,
4644
- path: route.path,
4645
- method,
4646
- error: result.error,
4647
- response: payload,
4648
- timestamp: /* @__PURE__ */ new Date()
4649
- });
4650
- }
4651
- return response;
4652
- });
4653
- }
4654
- // ── Base URL ────────────────────────────────────────────────────────────
4655
- getBaseUrl() {
4656
- return this.baseUrl;
4657
- }
4658
- setBaseUrl(url) {
4659
- this.baseUrl = url.replace(/\/$/, "");
4660
- client3.setConfig({ baseUrl: this.baseUrl });
4661
- }
4662
- // ── Tokens ──────────────────────────────────────────────────────────────
4663
- getToken() {
4664
- return this.storage.getItem(ACCESS_KEY3);
4665
- }
4666
- setToken(token) {
4667
- if (token) this.storage.setItem(ACCESS_KEY3, token);
4668
- else this.storage.removeItem(ACCESS_KEY3);
4669
- }
4670
- getRefreshToken() {
4671
- return this.storage.getItem(REFRESH_KEY3);
4672
- }
4673
- setRefreshToken(token) {
4674
- if (token) this.storage.setItem(REFRESH_KEY3, token);
4675
- else this.storage.removeItem(REFRESH_KEY3);
4676
- }
4677
- clearToken() {
4678
- this.storage.removeItem(ACCESS_KEY3);
4679
- this.storage.removeItem(REFRESH_KEY3);
4680
- }
4681
- isAuthenticated() {
4682
- return this.getToken() !== null;
4683
- }
4684
- // ── Locale / API key ────────────────────────────────────────────────────
4685
- getLocale() {
4686
- return this.locale ?? detectLocale3();
4687
- }
4688
- setLocale(locale) {
4689
- this.locale = locale;
4690
- }
4691
- getApiKey() {
4692
- return this.apiKey;
4693
- }
4694
- setApiKey(key) {
4695
- this.apiKey = key;
4696
- }
4697
- };
4698
-
4699
- // src/_api/generated/index.ts
4700
- var isStaticBuild = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
4701
- var baseUrl = isStaticBuild ? "" : process.env.NEXT_PUBLIC_API_URL || "";
4702
- var cfgAccountsApi = new API(baseUrl, { storage: new LocalStorageAdapter() });
4703
- var cfgCentrifugoApi = new API2(baseUrl, { storage: new LocalStorageAdapter() });
4704
- var cfgTotpApi = new API3(baseUrl, { storage: new LocalStorageAdapter() });
4705
2638
  //# sourceMappingURL=index.cjs.map