@djangocfg/api 2.1.321 → 2.1.327

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 (293) hide show
  1. package/dist/auth-server.cjs +4265 -1169
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +4265 -1159
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +4150 -3053
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.d.cts +158 -209
  8. package/dist/auth.d.ts +158 -209
  9. package/dist/auth.mjs +4139 -3042
  10. package/dist/auth.mjs.map +1 -1
  11. package/dist/clients.cjs +3932 -4031
  12. package/dist/clients.cjs.map +1 -1
  13. package/dist/clients.d.cts +2408 -2671
  14. package/dist/clients.d.ts +2408 -2671
  15. package/dist/clients.mjs +3945 -4038
  16. package/dist/clients.mjs.map +1 -1
  17. package/dist/index.cjs +4214 -2713
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +2758 -1828
  20. package/dist/index.d.ts +2758 -1828
  21. package/dist/index.mjs +4183 -2676
  22. package/dist/index.mjs.map +1 -1
  23. package/package.json +2 -7
  24. package/src/_api/generated/_shared/errors.ts +70 -0
  25. package/src/_api/generated/_shared/index.ts +25 -0
  26. package/src/_api/generated/_shared/logger.ts +123 -0
  27. package/src/_api/generated/_shared/storage.ts +83 -0
  28. package/src/_api/generated/_shared/validation-events.ts +52 -0
  29. package/src/_api/generated/cfg_accounts/api.ts +187 -0
  30. package/src/_api/generated/cfg_accounts/client/client.gen.ts +280 -0
  31. package/src/_api/generated/cfg_accounts/client/index.ts +25 -0
  32. package/src/_api/generated/cfg_accounts/client/types.gen.ts +217 -0
  33. package/src/_api/generated/cfg_accounts/client/utils.gen.ts +318 -0
  34. package/src/_api/generated/cfg_accounts/client.gen.ts +16 -0
  35. package/src/_api/generated/cfg_accounts/core/auth.gen.ts +41 -0
  36. package/src/_api/generated/cfg_accounts/core/bodySerializer.gen.ts +82 -0
  37. package/src/_api/generated/cfg_accounts/core/params.gen.ts +169 -0
  38. package/src/_api/generated/cfg_accounts/core/pathSerializer.gen.ts +171 -0
  39. package/src/_api/generated/cfg_accounts/core/queryKeySerializer.gen.ts +117 -0
  40. package/src/_api/generated/cfg_accounts/core/serverSentEvents.gen.ts +242 -0
  41. package/src/_api/generated/cfg_accounts/core/types.gen.ts +104 -0
  42. package/src/_api/generated/cfg_accounts/core/utils.gen.ts +140 -0
  43. package/src/_api/generated/cfg_accounts/events.ts +198 -0
  44. package/src/_api/generated/cfg_accounts/hooks/index.ts +18 -0
  45. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +26 -0
  46. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts +24 -0
  47. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +24 -0
  48. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +24 -0
  49. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +26 -0
  50. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +24 -0
  51. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +24 -0
  52. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts +24 -0
  53. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts +24 -0
  54. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +24 -0
  55. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts +24 -0
  56. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +26 -0
  57. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +24 -0
  58. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts +24 -0
  59. package/src/_api/generated/cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts +24 -0
  60. package/src/_api/generated/cfg_accounts/index.ts +26 -335
  61. package/src/_api/generated/cfg_accounts/schemas/AccountDeleteResponse.ts +12 -0
  62. package/src/_api/generated/cfg_accounts/schemas/CentrifugoToken.ts +14 -0
  63. package/src/_api/generated/cfg_accounts/schemas/CfgUserUpdateRequest.ts +16 -0
  64. package/src/_api/generated/cfg_accounts/schemas/OAuthAuthorizeRequestRequest.ts +12 -0
  65. package/src/_api/generated/cfg_accounts/schemas/OAuthAuthorizeResponse.ts +12 -0
  66. package/src/_api/generated/cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +13 -0
  67. package/src/_api/generated/cfg_accounts/schemas/OAuthConnection.ts +19 -0
  68. package/src/_api/generated/cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts +12 -0
  69. package/src/_api/generated/cfg_accounts/schemas/OAuthError.ts +12 -0
  70. package/src/_api/generated/cfg_accounts/schemas/OAuthProvidersResponse.ts +11 -0
  71. package/src/_api/generated/cfg_accounts/schemas/OAuthTokenResponse.ts +18 -0
  72. package/src/_api/generated/cfg_accounts/schemas/OTPErrorResponse.ts +13 -0
  73. package/src/_api/generated/cfg_accounts/schemas/OTPRequestRequest.ts +12 -0
  74. package/src/_api/generated/cfg_accounts/schemas/OTPRequestResponse.ts +11 -0
  75. package/src/_api/generated/cfg_accounts/schemas/OTPVerifyRequest.ts +13 -0
  76. package/src/_api/generated/cfg_accounts/schemas/OTPVerifyResponse.ts +17 -0
  77. package/src/_api/generated/cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts +16 -0
  78. package/src/_api/generated/cfg_accounts/schemas/ProviderEnum.ts +9 -0
  79. package/src/_api/generated/cfg_accounts/schemas/TokenRefresh.ts +12 -0
  80. package/src/_api/generated/cfg_accounts/schemas/TokenRefreshRequest.ts +11 -0
  81. package/src/_api/generated/cfg_accounts/{_utils/schemas/User.schema.ts → schemas/User.ts} +8 -16
  82. package/src/_api/generated/cfg_accounts/schemas/index.ts +24 -0
  83. package/src/_api/generated/cfg_accounts/sdk.gen.ts +796 -0
  84. package/src/_api/generated/cfg_accounts/types.gen.ts +764 -0
  85. package/src/_api/generated/cfg_centrifugo/api.ts +164 -0
  86. package/src/_api/generated/cfg_centrifugo/client/client.gen.ts +280 -0
  87. package/src/_api/generated/cfg_centrifugo/client/index.ts +25 -0
  88. package/src/_api/generated/cfg_centrifugo/client/types.gen.ts +217 -0
  89. package/src/_api/generated/cfg_centrifugo/client/utils.gen.ts +318 -0
  90. package/src/_api/generated/cfg_centrifugo/client.gen.ts +16 -0
  91. package/src/_api/generated/cfg_centrifugo/core/auth.gen.ts +41 -0
  92. package/src/_api/generated/cfg_centrifugo/core/bodySerializer.gen.ts +82 -0
  93. package/src/_api/generated/cfg_centrifugo/core/params.gen.ts +169 -0
  94. package/src/_api/generated/cfg_centrifugo/core/pathSerializer.gen.ts +171 -0
  95. package/src/_api/generated/cfg_centrifugo/core/queryKeySerializer.gen.ts +117 -0
  96. package/src/_api/generated/cfg_centrifugo/core/serverSentEvents.gen.ts +242 -0
  97. package/src/_api/generated/cfg_centrifugo/core/types.gen.ts +104 -0
  98. package/src/_api/generated/cfg_centrifugo/core/utils.gen.ts +140 -0
  99. package/src/_api/generated/cfg_centrifugo/events.ts +198 -0
  100. package/src/_api/generated/cfg_centrifugo/hooks/index.ts +4 -0
  101. package/src/_api/generated/cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +26 -0
  102. package/src/_api/generated/cfg_centrifugo/index.ts +26 -313
  103. package/src/_api/generated/cfg_centrifugo/schemas/ConnectionTokenResponse.ts +14 -0
  104. package/src/_api/generated/cfg_centrifugo/schemas/index.ts +4 -0
  105. package/src/_api/generated/cfg_centrifugo/sdk.gen.ts +64 -0
  106. package/src/_api/generated/cfg_centrifugo/types.gen.ts +61 -0
  107. package/src/_api/generated/cfg_totp/api.ts +181 -0
  108. package/src/_api/generated/cfg_totp/client/client.gen.ts +280 -0
  109. package/src/_api/generated/cfg_totp/client/index.ts +25 -0
  110. package/src/_api/generated/cfg_totp/client/types.gen.ts +217 -0
  111. package/src/_api/generated/cfg_totp/client/utils.gen.ts +318 -0
  112. package/src/_api/generated/cfg_totp/client.gen.ts +16 -0
  113. package/src/_api/generated/cfg_totp/core/auth.gen.ts +41 -0
  114. package/src/_api/generated/cfg_totp/core/bodySerializer.gen.ts +82 -0
  115. package/src/_api/generated/cfg_totp/core/params.gen.ts +169 -0
  116. package/src/_api/generated/cfg_totp/core/pathSerializer.gen.ts +171 -0
  117. package/src/_api/generated/cfg_totp/core/queryKeySerializer.gen.ts +117 -0
  118. package/src/_api/generated/cfg_totp/core/serverSentEvents.gen.ts +242 -0
  119. package/src/_api/generated/cfg_totp/core/types.gen.ts +104 -0
  120. package/src/_api/generated/cfg_totp/core/utils.gen.ts +140 -0
  121. package/src/_api/generated/cfg_totp/events.ts +198 -0
  122. package/src/_api/generated/cfg_totp/hooks/index.ts +12 -0
  123. package/src/_api/generated/cfg_totp/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +24 -0
  124. package/src/_api/generated/cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +26 -0
  125. package/src/_api/generated/cfg_totp/hooks/useCfgTotpDevicesDestroy.ts +24 -0
  126. package/src/_api/generated/cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +26 -0
  127. package/src/_api/generated/cfg_totp/hooks/useCfgTotpDisableCreate.ts +24 -0
  128. package/src/_api/generated/cfg_totp/hooks/useCfgTotpSetupConfirmCreate.ts +24 -0
  129. package/src/_api/generated/cfg_totp/hooks/useCfgTotpSetupCreate.ts +24 -0
  130. package/src/_api/generated/cfg_totp/hooks/useCfgTotpVerifyBackupCreate.ts +24 -0
  131. package/src/_api/generated/cfg_totp/hooks/useCfgTotpVerifyCreate.ts +24 -0
  132. package/src/_api/generated/cfg_totp/index.ts +26 -342
  133. package/src/_api/generated/cfg_totp/schemas/BackupCodesRegenerateRequest.ts +11 -0
  134. package/src/_api/generated/cfg_totp/schemas/BackupCodesRegenerateResponse.ts +12 -0
  135. package/src/_api/generated/cfg_totp/schemas/BackupCodesStatus.ts +13 -0
  136. package/src/_api/generated/cfg_totp/schemas/ConfirmSetupRequest.ts +12 -0
  137. package/src/_api/generated/cfg_totp/schemas/ConfirmSetupResponse.ts +13 -0
  138. package/src/_api/generated/cfg_totp/schemas/DeviceList.ts +18 -0
  139. package/src/_api/generated/cfg_totp/schemas/DeviceListResponse.ts +13 -0
  140. package/src/_api/generated/cfg_totp/schemas/DeviceListStatusEnum.ts +9 -0
  141. package/src/_api/generated/cfg_totp/schemas/DisableRequest.ts +11 -0
  142. package/src/_api/generated/cfg_totp/schemas/SetupRequest.ts +11 -0
  143. package/src/_api/generated/cfg_totp/schemas/SetupResponse.ts +15 -0
  144. package/src/_api/generated/cfg_totp/{_utils/schemas/TotpVerifyUser.schema.ts → schemas/TotpVerifyUser.ts} +7 -15
  145. package/src/_api/generated/cfg_totp/schemas/VerifyBackupRequest.ts +12 -0
  146. package/src/_api/generated/cfg_totp/schemas/VerifyRequest.ts +12 -0
  147. package/src/_api/generated/cfg_totp/schemas/VerifyResponse.ts +17 -0
  148. package/src/_api/generated/cfg_totp/schemas/index.ts +18 -0
  149. package/src/_api/generated/cfg_totp/sdk.gen.ts +432 -0
  150. package/src/_api/generated/cfg_totp/types.gen.ts +479 -0
  151. package/src/_api/generated/index.ts +30 -0
  152. package/src/_api/index.ts +5 -23
  153. package/src/auth/context/AccountsContext.tsx +58 -89
  154. package/src/auth/context/AuthContext.tsx +3 -3
  155. package/src/auth/context/index.ts +2 -2
  156. package/src/auth/hooks/useDeleteAccount.ts +2 -1
  157. package/src/auth/hooks/useGithubAuth.ts +12 -11
  158. package/src/auth/hooks/useTokenRefresh.ts +6 -4
  159. package/src/auth/hooks/useTwoFactor.ts +14 -8
  160. package/src/auth/hooks/useTwoFactorSetup.ts +8 -5
  161. package/src/auth/hooks/useTwoFactorStatus.ts +3 -2
  162. package/src/auth/middlewares/tokenRefresh.ts +6 -4
  163. package/src/clients.ts +14 -51
  164. package/src/index.ts +15 -57
  165. package/src/server.ts +25 -23
  166. package/src/_api/BaseClient.ts +0 -22
  167. package/src/_api/generated/cfg_accounts/CLAUDE.md +0 -86
  168. package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts.ts +0 -154
  169. package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__auth.ts +0 -95
  170. package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +0 -285
  171. package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts +0 -440
  172. package/src/_api/generated/cfg_accounts/_utils/fetchers/index.ts +0 -33
  173. package/src/_api/generated/cfg_accounts/_utils/hooks/accounts.ts +0 -64
  174. package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__auth.ts +0 -44
  175. package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +0 -114
  176. package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts +0 -152
  177. package/src/_api/generated/cfg_accounts/_utils/hooks/index.ts +0 -33
  178. package/src/_api/generated/cfg_accounts/_utils/schemas/AccountDeleteResponse.schema.ts +0 -20
  179. package/src/_api/generated/cfg_accounts/_utils/schemas/CentrifugoToken.schema.ts +0 -22
  180. package/src/_api/generated/cfg_accounts/_utils/schemas/CfgAccountsProfileAvatarCreateRequest.schema.ts +0 -15
  181. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts +0 -20
  182. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts +0 -20
  183. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthCallbackRequestRequest.schema.ts +0 -21
  184. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts +0 -27
  185. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthDisconnectRequestRequest.schema.ts +0 -20
  186. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthError.schema.ts +0 -20
  187. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts +0 -19
  188. package/src/_api/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts +0 -46
  189. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts +0 -41
  190. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts +0 -20
  191. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPRequestResponse.schema.ts +0 -19
  192. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts +0 -21
  193. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts +0 -45
  194. package/src/_api/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts +0 -24
  195. package/src/_api/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts +0 -16
  196. package/src/_api/generated/cfg_accounts/_utils/schemas/TokenRefreshRequest.schema.ts +0 -15
  197. package/src/_api/generated/cfg_accounts/_utils/schemas/UserProfileUpdateRequest.schema.ts +0 -24
  198. package/src/_api/generated/cfg_accounts/_utils/schemas/index.ts +0 -41
  199. package/src/_api/generated/cfg_accounts/accounts/client.ts +0 -34
  200. package/src/_api/generated/cfg_accounts/accounts/index.ts +0 -4
  201. package/src/_api/generated/cfg_accounts/accounts/models.ts +0 -127
  202. package/src/_api/generated/cfg_accounts/accounts__auth/client.ts +0 -23
  203. package/src/_api/generated/cfg_accounts/accounts__auth/index.ts +0 -4
  204. package/src/_api/generated/cfg_accounts/accounts__auth/models.ts +0 -19
  205. package/src/_api/generated/cfg_accounts/accounts__oauth/client.ts +0 -67
  206. package/src/_api/generated/cfg_accounts/accounts__oauth/index.ts +0 -4
  207. package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +0 -127
  208. package/src/_api/generated/cfg_accounts/accounts__user_profile/client.ts +0 -94
  209. package/src/_api/generated/cfg_accounts/accounts__user_profile/index.ts +0 -4
  210. package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +0 -98
  211. package/src/_api/generated/cfg_accounts/api-instance.ts +0 -181
  212. package/src/_api/generated/cfg_accounts/client.ts +0 -339
  213. package/src/_api/generated/cfg_accounts/enums.ts +0 -10
  214. package/src/_api/generated/cfg_accounts/errors.ts +0 -123
  215. package/src/_api/generated/cfg_accounts/http.ts +0 -160
  216. package/src/_api/generated/cfg_accounts/logger.ts +0 -261
  217. package/src/_api/generated/cfg_accounts/retry.ts +0 -177
  218. package/src/_api/generated/cfg_accounts/schema.json +0 -1576
  219. package/src/_api/generated/cfg_accounts/storage.ts +0 -163
  220. package/src/_api/generated/cfg_accounts/validation-events.ts +0 -135
  221. package/src/_api/generated/cfg_centrifugo/CLAUDE.md +0 -60
  222. package/src/_api/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts +0 -94
  223. package/src/_api/generated/cfg_centrifugo/_utils/fetchers/index.ts +0 -30
  224. package/src/_api/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts +0 -39
  225. package/src/_api/generated/cfg_centrifugo/_utils/hooks/index.ts +0 -30
  226. package/src/_api/generated/cfg_centrifugo/_utils/schemas/ConnectionTokenResponse.schema.ts +0 -22
  227. package/src/_api/generated/cfg_centrifugo/_utils/schemas/index.ts +0 -21
  228. package/src/_api/generated/cfg_centrifugo/api-instance.ts +0 -181
  229. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_auth/client.ts +0 -27
  230. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_auth/index.ts +0 -4
  231. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_auth/models.ts +0 -18
  232. package/src/_api/generated/cfg_centrifugo/client.ts +0 -330
  233. package/src/_api/generated/cfg_centrifugo/errors.ts +0 -123
  234. package/src/_api/generated/cfg_centrifugo/http.ts +0 -160
  235. package/src/_api/generated/cfg_centrifugo/logger.ts +0 -261
  236. package/src/_api/generated/cfg_centrifugo/retry.ts +0 -177
  237. package/src/_api/generated/cfg_centrifugo/schema.json +0 -118
  238. package/src/_api/generated/cfg_centrifugo/storage.ts +0 -163
  239. package/src/_api/generated/cfg_centrifugo/validation-events.ts +0 -135
  240. package/src/_api/generated/cfg_totp/CLAUDE.md +0 -83
  241. package/src/_api/generated/cfg_totp/_utils/fetchers/index.ts +0 -34
  242. package/src/_api/generated/cfg_totp/_utils/fetchers/totp.ts +0 -50
  243. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts +0 -153
  244. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +0 -109
  245. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_setup.ts +0 -154
  246. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_verification.ts +0 -153
  247. package/src/_api/generated/cfg_totp/_utils/hooks/index.ts +0 -34
  248. package/src/_api/generated/cfg_totp/_utils/hooks/totp.ts +0 -43
  249. package/src/_api/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts +0 -60
  250. package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +0 -59
  251. package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_setup.ts +0 -64
  252. package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_verification.ts +0 -63
  253. package/src/_api/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateRequest.schema.ts +0 -19
  254. package/src/_api/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateResponse.schema.ts +0 -20
  255. package/src/_api/generated/cfg_totp/_utils/schemas/BackupCodesStatus.schema.ts +0 -21
  256. package/src/_api/generated/cfg_totp/_utils/schemas/ConfirmSetupRequest.schema.ts +0 -20
  257. package/src/_api/generated/cfg_totp/_utils/schemas/ConfirmSetupResponse.schema.ts +0 -21
  258. package/src/_api/generated/cfg_totp/_utils/schemas/DeviceList.schema.ts +0 -26
  259. package/src/_api/generated/cfg_totp/_utils/schemas/DeviceListResponse.schema.ts +0 -21
  260. package/src/_api/generated/cfg_totp/_utils/schemas/DisableRequest.schema.ts +0 -19
  261. package/src/_api/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts +0 -19
  262. package/src/_api/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts +0 -23
  263. package/src/_api/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts +0 -20
  264. package/src/_api/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts +0 -20
  265. package/src/_api/generated/cfg_totp/_utils/schemas/VerifyResponse.schema.ts +0 -25
  266. package/src/_api/generated/cfg_totp/_utils/schemas/index.ts +0 -34
  267. package/src/_api/generated/cfg_totp/api-instance.ts +0 -181
  268. package/src/_api/generated/cfg_totp/client.ts +0 -342
  269. package/src/_api/generated/cfg_totp/enums.ts +0 -13
  270. package/src/_api/generated/cfg_totp/errors.ts +0 -123
  271. package/src/_api/generated/cfg_totp/http.ts +0 -160
  272. package/src/_api/generated/cfg_totp/logger.ts +0 -261
  273. package/src/_api/generated/cfg_totp/retry.ts +0 -177
  274. package/src/_api/generated/cfg_totp/schema.json +0 -910
  275. package/src/_api/generated/cfg_totp/storage.ts +0 -163
  276. package/src/_api/generated/cfg_totp/totp/client.ts +0 -24
  277. package/src/_api/generated/cfg_totp/totp/index.ts +0 -4
  278. package/src/_api/generated/cfg_totp/totp/models.ts +0 -4
  279. package/src/_api/generated/cfg_totp/totp__backup_codes/client.ts +0 -32
  280. package/src/_api/generated/cfg_totp/totp__backup_codes/index.ts +0 -4
  281. package/src/_api/generated/cfg_totp/totp__backup_codes/models.ts +0 -38
  282. package/src/_api/generated/cfg_totp/totp__totp_management/client.ts +0 -31
  283. package/src/_api/generated/cfg_totp/totp__totp_management/index.ts +0 -4
  284. package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +0 -46
  285. package/src/_api/generated/cfg_totp/totp__totp_setup/client.ts +0 -33
  286. package/src/_api/generated/cfg_totp/totp__totp_setup/index.ts +0 -4
  287. package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +0 -55
  288. package/src/_api/generated/cfg_totp/totp__totp_verification/client.ts +0 -33
  289. package/src/_api/generated/cfg_totp/totp__totp_verification/index.ts +0 -4
  290. package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +0 -74
  291. package/src/_api/generated/cfg_totp/validation-events.ts +0 -135
  292. package/src/hooks/accounts.ts +0 -8
  293. package/src/hooks/index.ts +0 -10
@@ -1,160 +0,0 @@
1
- // @ts-nocheck
2
- // Auto-generated by DjangoCFG - see CLAUDE.md
3
- /**
4
- * HTTP Client Adapter Pattern
5
- *
6
- * Allows switching between fetch/axios/httpx without changing generated code.
7
- * Provides unified interface for making HTTP requests.
8
- */
9
-
10
- export interface HttpRequest {
11
- method: string;
12
- url: string;
13
- headers?: Record<string, string>;
14
- body?: any;
15
- params?: Record<string, any>;
16
- /** FormData for file uploads (multipart/form-data) */
17
- formData?: FormData;
18
- /** Binary data for octet-stream uploads */
19
- binaryBody?: Blob | ArrayBuffer;
20
- /**
21
- * Force a specific response parser. When set, overrides Content-Type sniffing.
22
- * Generated for endpoints whose primary response is binary (file downloads).
23
- */
24
- responseType?: 'json' | 'text' | 'blob';
25
- }
26
-
27
- export interface HttpResponse<T = any> {
28
- data: T;
29
- status: number;
30
- statusText: string;
31
- headers: Record<string, string>;
32
- }
33
-
34
- /**
35
- * HTTP Client Adapter Interface.
36
- * Implement this to use custom HTTP clients (axios, httpx, etc.)
37
- */
38
- export interface HttpClientAdapter {
39
- request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;
40
- }
41
-
42
- /**
43
- * Default Fetch API adapter.
44
- * Uses native browser fetch() with proper error handling.
45
- */
46
- export class FetchAdapter implements HttpClientAdapter {
47
- async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {
48
- const { method, url, headers, body, params, formData, binaryBody, responseType } = request;
49
-
50
- // Build URL with query params
51
- let finalUrl = url;
52
- if (params) {
53
- const searchParams = new URLSearchParams();
54
- Object.entries(params).forEach(([key, value]) => {
55
- if (value !== null && value !== undefined) {
56
- searchParams.append(key, String(value));
57
- }
58
- });
59
- const queryString = searchParams.toString();
60
- if (queryString) {
61
- finalUrl = url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;
62
- }
63
- }
64
-
65
- // Build headers
66
- const finalHeaders: Record<string, string> = { ...headers };
67
-
68
- // Determine body and content-type
69
- let requestBody: string | FormData | Blob | ArrayBuffer | undefined;
70
-
71
- if (formData) {
72
- // For multipart/form-data, let browser set Content-Type with boundary
73
- requestBody = formData;
74
- // Don't set Content-Type - browser will set it with boundary
75
- } else if (binaryBody) {
76
- // Binary upload (application/octet-stream)
77
- finalHeaders['Content-Type'] = 'application/octet-stream';
78
- requestBody = binaryBody;
79
- } else if (body) {
80
- // JSON request
81
- finalHeaders['Content-Type'] = 'application/json';
82
- requestBody = JSON.stringify(body);
83
- }
84
-
85
- // Make request
86
- const response = await fetch(finalUrl, {
87
- method,
88
- headers: finalHeaders,
89
- body: requestBody,
90
- credentials: 'include', // Include Django session cookies
91
- });
92
-
93
- // Parse response. Explicit `responseType` (set by the generator for binary
94
- // endpoints) wins over Content-Type sniffing — backends often serve CSV/JSON
95
- // file downloads with `text/csv` or `application/json`, which would otherwise
96
- // be parsed as string/object instead of the Blob the caller expects.
97
- //
98
- // responseType set → use it directly
99
- // application/json → JSON
100
- // text/* → string
101
- // anything else → Blob (file downloads, octet-stream, …)
102
- let data: any = null;
103
- const contentType = response.headers.get('content-type') ?? '';
104
-
105
- if (response.status !== 204) {
106
- if (responseType === 'blob') {
107
- data = await response.blob();
108
- } else if (responseType === 'text') {
109
- data = await response.text();
110
- } else if (responseType === 'json') {
111
- data = await response.json();
112
- } else if (contentType.includes('application/json')) {
113
- data = await response.json();
114
- } else if (contentType.startsWith('text/')) {
115
- data = await response.text();
116
- } else {
117
- data = await response.blob();
118
- }
119
- }
120
-
121
- // Convert Headers to plain object
122
- const responseHeaders: Record<string, string> = {};
123
- response.headers.forEach((value, key) => {
124
- responseHeaders[key] = value;
125
- });
126
-
127
- return {
128
- data,
129
- status: response.status,
130
- statusText: response.statusText,
131
- headers: responseHeaders,
132
- };
133
- }
134
- }
135
-
136
- /**
137
- * FetchAdapter with keepalive:true.
138
- *
139
- * Use this adapter when you need requests to survive page unload
140
- * (visibilitychange / beforeunload) — the browser will complete the request
141
- * even after the page is navigated away. Typical use: monitor / analytics flush.
142
- *
143
- * @example
144
- * ```typescript
145
- * import { APIClient, KeepAliveFetchAdapter } from './client';
146
- * const client = new APIClient(baseUrl, { httpClient: new KeepAliveFetchAdapter() });
147
- * ```
148
- */
149
- export class KeepAliveFetchAdapter extends FetchAdapter {
150
- async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {
151
- const origFetch = globalThis.fetch;
152
- globalThis.fetch = (input: RequestInfo | URL, init?: RequestInit) =>
153
- origFetch(input, { ...init, keepalive: true });
154
- try {
155
- return await super.request<T>(request);
156
- } finally {
157
- globalThis.fetch = origFetch;
158
- }
159
- }
160
- }
@@ -1,261 +0,0 @@
1
- // @ts-nocheck
2
- // Auto-generated by DjangoCFG - see CLAUDE.md
3
- /**
4
- * API Logger with Consola
5
- * Beautiful console logging for API requests and responses
6
- *
7
- * Installation:
8
- * npm install consola
9
- */
10
-
11
- import { type ConsolaInstance, createConsola } from 'consola';
12
-
13
- /**
14
- * Request log data
15
- */
16
- export interface RequestLog {
17
- method: string;
18
- url: string;
19
- headers?: Record<string, string>;
20
- body?: any;
21
- timestamp: number;
22
- }
23
-
24
- /**
25
- * Response log data
26
- */
27
- export interface ResponseLog {
28
- status: number;
29
- statusText: string;
30
- data?: any;
31
- duration: number;
32
- timestamp: number;
33
- }
34
-
35
- /**
36
- * Error log data
37
- */
38
- export interface ErrorLog {
39
- message: string;
40
- statusCode?: number;
41
- fieldErrors?: Record<string, string[]>;
42
- duration: number;
43
- timestamp: number;
44
- }
45
-
46
- /**
47
- * Logger configuration
48
- */
49
- export interface LoggerConfig {
50
- /** Enable logging */
51
- enabled: boolean;
52
- /** Log requests */
53
- logRequests: boolean;
54
- /** Log responses */
55
- logResponses: boolean;
56
- /** Log errors */
57
- logErrors: boolean;
58
- /** Log request/response bodies */
59
- logBodies: boolean;
60
- /** Log headers (excluding sensitive ones) */
61
- logHeaders: boolean;
62
- /** Custom consola instance */
63
- consola?: ConsolaInstance;
64
- }
65
-
66
- /**
67
- * Default logger configuration
68
- */
69
- const DEFAULT_CONFIG: LoggerConfig = {
70
- enabled: process.env.NODE_ENV !== 'production',
71
- logRequests: true,
72
- logResponses: true,
73
- logErrors: true,
74
- logBodies: true,
75
- logHeaders: false,
76
- };
77
-
78
- /**
79
- * Sensitive header names to filter out
80
- */
81
- const SENSITIVE_HEADERS = [
82
- 'authorization',
83
- 'cookie',
84
- 'set-cookie',
85
- 'x-api-key',
86
- 'x-csrf-token',
87
- ];
88
-
89
- /**
90
- * API Logger class
91
- */
92
- export class APILogger {
93
- private config: LoggerConfig;
94
- private consola: ConsolaInstance;
95
-
96
- constructor(config: Partial<LoggerConfig> = {}) {
97
- this.config = { ...DEFAULT_CONFIG, ...config };
98
- this.consola = config.consola || createConsola({
99
- level: this.config.enabled ? 4 : 0,
100
- });
101
- }
102
-
103
- /**
104
- * Enable logging
105
- */
106
- enable(): void {
107
- this.config.enabled = true;
108
- }
109
-
110
- /**
111
- * Disable logging
112
- */
113
- disable(): void {
114
- this.config.enabled = false;
115
- }
116
-
117
- /**
118
- * Update configuration
119
- */
120
- setConfig(config: Partial<LoggerConfig>): void {
121
- this.config = { ...this.config, ...config };
122
- }
123
-
124
- /**
125
- * Filter sensitive headers
126
- */
127
- private filterHeaders(headers?: Record<string, string>): Record<string, string> {
128
- if (!headers) return {};
129
-
130
- const filtered: Record<string, string> = {};
131
- Object.keys(headers).forEach((key) => {
132
- const lowerKey = key.toLowerCase();
133
- if (SENSITIVE_HEADERS.includes(lowerKey)) {
134
- filtered[key] = '***';
135
- } else {
136
- filtered[key] = headers[key] || '';
137
- }
138
- });
139
-
140
- return filtered;
141
- }
142
-
143
- /**
144
- * Log request
145
- */
146
- logRequest(request: RequestLog): void {
147
- if (!this.config.enabled || !this.config.logRequests) return;
148
-
149
- const { method, url, headers, body } = request;
150
-
151
- this.consola.start(`${method} ${url}`);
152
-
153
- if (this.config.logHeaders && headers) {
154
- this.consola.debug('Headers:', this.filterHeaders(headers));
155
- }
156
-
157
- if (this.config.logBodies && body) {
158
- this.consola.debug('Body:', body);
159
- }
160
- }
161
-
162
- /**
163
- * Log response
164
- */
165
- logResponse(request: RequestLog, response: ResponseLog): void {
166
- if (!this.config.enabled || !this.config.logResponses) return;
167
-
168
- const { method, url } = request;
169
- const { status, statusText, data, duration } = response;
170
-
171
- const statusColor = status >= 500 ? 'red'
172
- : status >= 400 ? 'yellow'
173
- : status >= 300 ? 'cyan'
174
- : 'green';
175
-
176
- this.consola.success(
177
- `${method} ${url} ${status} ${statusText} (${duration}ms)`
178
- );
179
-
180
- if (this.config.logBodies && data) {
181
- this.consola.debug('Response:', data);
182
- }
183
- }
184
-
185
- /**
186
- * Log error
187
- */
188
- logError(request: RequestLog, error: ErrorLog): void {
189
- if (!this.config.enabled || !this.config.logErrors) return;
190
-
191
- const { method, url } = request;
192
- const { message, statusCode, fieldErrors, duration } = error;
193
-
194
- this.consola.error(
195
- `${method} ${url} ${statusCode || 'Network'} Error (${duration}ms)`
196
- );
197
-
198
- this.consola.error('Message:', message);
199
-
200
- if (fieldErrors && Object.keys(fieldErrors).length > 0) {
201
- this.consola.error('Field Errors:');
202
- Object.entries(fieldErrors).forEach(([field, errors]) => {
203
- errors.forEach((err) => {
204
- this.consola.error(` • ${field}: ${err}`);
205
- });
206
- });
207
- }
208
- }
209
-
210
- /**
211
- * Log general info
212
- */
213
- info(message: string, ...args: any[]): void {
214
- if (!this.config.enabled) return;
215
- this.consola.info(message, ...args);
216
- }
217
-
218
- /**
219
- * Log warning
220
- */
221
- warn(message: string, ...args: any[]): void {
222
- if (!this.config.enabled) return;
223
- this.consola.warn(message, ...args);
224
- }
225
-
226
- /**
227
- * Log error
228
- */
229
- error(message: string, ...args: any[]): void {
230
- if (!this.config.enabled) return;
231
- this.consola.error(message, ...args);
232
- }
233
-
234
- /**
235
- * Log debug
236
- */
237
- debug(message: string, ...args: any[]): void {
238
- if (!this.config.enabled) return;
239
- this.consola.debug(message, ...args);
240
- }
241
-
242
- /**
243
- * Log success
244
- */
245
- success(message: string, ...args: any[]): void {
246
- if (!this.config.enabled) return;
247
- this.consola.success(message, ...args);
248
- }
249
-
250
- /**
251
- * Create a sub-logger with prefix
252
- */
253
- withTag(tag: string): ConsolaInstance {
254
- return this.consola.withTag(tag);
255
- }
256
- }
257
-
258
- /**
259
- * Default logger instance
260
- */
261
- export const defaultLogger = new APILogger();
@@ -1,177 +0,0 @@
1
- // @ts-nocheck
2
- // Auto-generated by DjangoCFG - see CLAUDE.md
3
- /**
4
- * Retry Configuration and Utilities
5
- *
6
- * Provides automatic retry logic for failed HTTP requests using p-retry.
7
- * Retries only on network errors and server errors (5xx), not client errors (4xx).
8
- */
9
-
10
- import pRetry, { AbortError } from 'p-retry';
11
- import { APIError, NetworkError } from './errors';
12
-
13
- /**
14
- * Information about a failed retry attempt.
15
- */
16
- export interface FailedAttemptInfo {
17
- /** The error that caused the failure */
18
- error: Error;
19
- /** The attempt number (1-indexed) */
20
- attemptNumber: number;
21
- /** Number of retries left */
22
- retriesLeft: number;
23
- }
24
-
25
- /**
26
- * Retry configuration options.
27
- *
28
- * Uses exponential backoff with jitter by default to avoid thundering herd.
29
- */
30
- export interface RetryConfig {
31
- /**
32
- * Maximum number of retry attempts.
33
- * @default 3
34
- */
35
- retries?: number;
36
-
37
- /**
38
- * Exponential backoff factor.
39
- * @default 2
40
- */
41
- factor?: number;
42
-
43
- /**
44
- * Minimum wait time between retries (ms).
45
- * @default 1000
46
- */
47
- minTimeout?: number;
48
-
49
- /**
50
- * Maximum wait time between retries (ms).
51
- * @default 60000
52
- */
53
- maxTimeout?: number;
54
-
55
- /**
56
- * Add randomness to wait times (jitter).
57
- * Helps avoid thundering herd problem.
58
- * @default true
59
- */
60
- randomize?: boolean;
61
-
62
- /**
63
- * Callback called on each failed attempt.
64
- */
65
- onFailedAttempt?: (info: FailedAttemptInfo) => void;
66
- }
67
-
68
- /**
69
- * Default retry configuration.
70
- */
71
- export const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {
72
- retries: 3,
73
- factor: 2,
74
- minTimeout: 1000,
75
- maxTimeout: 60000,
76
- randomize: true,
77
- onFailedAttempt: () => {},
78
- };
79
-
80
- /**
81
- * Determine if an error should trigger a retry.
82
- *
83
- * Retries on:
84
- * - Network errors (connection refused, timeout, etc.)
85
- * - Server errors (5xx status codes)
86
- * - Rate limiting (429 status code)
87
- *
88
- * Does NOT retry on:
89
- * - Client errors (4xx except 429)
90
- * - Authentication errors (401, 403)
91
- * - Not found (404)
92
- *
93
- * @param error - The error to check
94
- * @returns true if should retry, false otherwise
95
- */
96
- export function shouldRetry(error: any): boolean {
97
- // Always retry network errors
98
- if (error instanceof NetworkError) {
99
- return true;
100
- }
101
-
102
- // For API errors, check status code
103
- if (error instanceof APIError) {
104
- const status = error.statusCode;
105
-
106
- // Retry on 5xx server errors
107
- if (status >= 500 && status < 600) {
108
- return true;
109
- }
110
-
111
- // Retry on 429 (rate limit)
112
- if (status === 429) {
113
- return true;
114
- }
115
-
116
- // Do NOT retry on 4xx client errors
117
- return false;
118
- }
119
-
120
- // Retry on unknown errors (might be network issues)
121
- return true;
122
- }
123
-
124
- /**
125
- * Wrap a function with retry logic.
126
- *
127
- * @param fn - Async function to retry
128
- * @param config - Retry configuration
129
- * @returns Result of the function
130
- *
131
- * @example
132
- * ```typescript
133
- * const result = await withRetry(
134
- * async () => fetch('https://api.example.com/users'),
135
- * { retries: 5, minTimeout: 2000 }
136
- * );
137
- * ```
138
- */
139
- export async function withRetry<T>(
140
- fn: () => Promise<T>,
141
- config?: RetryConfig
142
- ): Promise<T> {
143
- const finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };
144
-
145
- return pRetry(
146
- async () => {
147
- try {
148
- return await fn();
149
- } catch (error) {
150
- // Check if we should retry this error
151
- if (!shouldRetry(error)) {
152
- // Abort retry immediately for non-retryable errors
153
- throw new AbortError(error as Error);
154
- }
155
-
156
- // Re-throw error to trigger retry
157
- throw error;
158
- }
159
- },
160
- {
161
- retries: finalConfig.retries,
162
- factor: finalConfig.factor,
163
- minTimeout: finalConfig.minTimeout,
164
- maxTimeout: finalConfig.maxTimeout,
165
- randomize: finalConfig.randomize,
166
- onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {
167
- // Adapt p-retry's FailedAttemptError to our FailedAttemptInfo
168
- const pRetryError = error as any; // p-retry's internal type
169
- finalConfig.onFailedAttempt!({
170
- error: pRetryError as Error,
171
- attemptNumber: pRetryError.attemptNumber,
172
- retriesLeft: pRetryError.retriesLeft,
173
- });
174
- } : undefined,
175
- }
176
- );
177
- }