@djangocfg/api 2.1.262 → 2.1.264

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 (51) hide show
  1. package/dist/auth-server.cjs +9 -0
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +9 -0
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +76 -72
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.mjs +76 -72
  8. package/dist/auth.mjs.map +1 -1
  9. package/dist/clients.cjs +122 -80
  10. package/dist/clients.cjs.map +1 -1
  11. package/dist/clients.d.cts +129 -172
  12. package/dist/clients.d.ts +129 -172
  13. package/dist/clients.mjs +122 -80
  14. package/dist/clients.mjs.map +1 -1
  15. package/dist/hooks.cjs +47 -1
  16. package/dist/hooks.cjs.map +1 -1
  17. package/dist/hooks.d.cts +80 -57
  18. package/dist/hooks.d.ts +80 -57
  19. package/dist/hooks.mjs +47 -1
  20. package/dist/hooks.mjs.map +1 -1
  21. package/dist/index.cjs +56 -1
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +99 -99
  24. package/dist/index.d.ts +99 -99
  25. package/dist/index.mjs +56 -1
  26. package/dist/index.mjs.map +1 -1
  27. package/package.json +2 -2
  28. package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +46 -2
  29. package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +3 -2
  30. package/src/_api/generated/cfg_accounts/accounts/models.ts +34 -34
  31. package/src/_api/generated/cfg_accounts/accounts__oauth/client.ts +1 -1
  32. package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +54 -54
  33. package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +14 -14
  34. package/src/_api/generated/cfg_accounts/client.ts +8 -0
  35. package/src/_api/generated/cfg_accounts/errors.ts +5 -0
  36. package/src/_api/generated/cfg_centrifugo/client.ts +8 -0
  37. package/src/_api/generated/cfg_centrifugo/errors.ts +5 -0
  38. package/src/_api/generated/cfg_totp/CLAUDE.md +3 -3
  39. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +7 -7
  40. package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +5 -5
  41. package/src/_api/generated/cfg_totp/_utils/schemas/index.ts +0 -1
  42. package/src/_api/generated/cfg_totp/client.ts +8 -0
  43. package/src/_api/generated/cfg_totp/errors.ts +5 -0
  44. package/src/_api/generated/cfg_totp/schema.json +2 -103
  45. package/src/_api/generated/cfg_totp/totp__backup_codes/models.ts +10 -10
  46. package/src/_api/generated/cfg_totp/totp__totp_management/client.ts +2 -13
  47. package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +9 -34
  48. package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +12 -12
  49. package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +8 -8
  50. package/src/auth/hooks/useTwoFactorStatus.ts +5 -11
  51. package/src/_api/generated/cfg_totp/_utils/schemas/PaginatedDeviceListResponseList.schema.ts +0 -24
package/dist/hooks.cjs CHANGED
@@ -352,6 +352,9 @@ var APIError = class extends Error {
352
352
  if (details.detail) {
353
353
  return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
354
354
  }
355
+ if (details.error) {
356
+ return String(details.error);
357
+ }
355
358
  if (details.message) {
356
359
  return String(details.message);
357
360
  }
@@ -690,6 +693,12 @@ var APIClient = class {
690
693
  if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
691
694
  headers["Content-Type"] = "application/json";
692
695
  }
696
+ if (!headers["Authorization"]) {
697
+ const token = this.getToken();
698
+ if (token) {
699
+ headers["Authorization"] = `Bearer ${token}`;
700
+ }
701
+ }
693
702
  if (this.logger) {
694
703
  this.logger.logRequest({
695
704
  method,
@@ -1154,7 +1163,44 @@ var import_consola3 = require("consola");
1154
1163
  async function getAccountsOauthConnectionsList(client) {
1155
1164
  const api = client || getAPIInstance();
1156
1165
  const response = await api.oauth.accountsOauthConnectionsList();
1157
- return response;
1166
+ try {
1167
+ return OAuthConnectionSchema.array().parse(response);
1168
+ } catch (error) {
1169
+ import_consola3.consola.error("\u274C Zod Validation Failed");
1170
+ import_consola3.consola.box(`getAccountsOauthConnectionsList
1171
+ Path: /cfg/accounts/oauth/connections/
1172
+ Method: GET`);
1173
+ if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
1174
+ import_consola3.consola.error("Validation Issues:");
1175
+ error.issues.forEach((issue, index) => {
1176
+ import_consola3.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
1177
+ import_consola3.consola.error(` \u251C\u2500 Message: ${issue.message}`);
1178
+ if (issue.expected) import_consola3.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
1179
+ if (issue.received) import_consola3.consola.error(` \u2514\u2500 Received: ${issue.received}`);
1180
+ });
1181
+ }
1182
+ import_consola3.consola.error("Response data:", response);
1183
+ if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
1184
+ try {
1185
+ const event = new CustomEvent("zod-validation-error", {
1186
+ detail: {
1187
+ operation: "getAccountsOauthConnectionsList",
1188
+ path: "/cfg/accounts/oauth/connections/",
1189
+ method: "GET",
1190
+ error,
1191
+ response,
1192
+ timestamp: /* @__PURE__ */ new Date()
1193
+ },
1194
+ bubbles: true,
1195
+ cancelable: false
1196
+ });
1197
+ window.dispatchEvent(event);
1198
+ } catch (eventError) {
1199
+ import_consola3.consola.warn("Failed to dispatch validation error event:", eventError);
1200
+ }
1201
+ }
1202
+ throw error;
1203
+ }
1158
1204
  }
1159
1205
  __name(getAccountsOauthConnectionsList, "getAccountsOauthConnectionsList");
1160
1206
  async function createAccountsOauthDisconnectCreate(data, client) {