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