@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.
- package/dist/auth-server.cjs +9 -0
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +9 -0
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +76 -72
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +76 -72
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +122 -80
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +129 -172
- package/dist/clients.d.ts +129 -172
- package/dist/clients.mjs +122 -80
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +47 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +80 -57
- package/dist/hooks.d.ts +80 -57
- package/dist/hooks.mjs +47 -1
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +56 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -99
- package/dist/index.d.ts +99 -99
- package/dist/index.mjs +56 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +46 -2
- package/src/_api/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +3 -2
- package/src/_api/generated/cfg_accounts/accounts/models.ts +34 -34
- package/src/_api/generated/cfg_accounts/accounts__oauth/client.ts +1 -1
- package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +54 -54
- package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +14 -14
- package/src/_api/generated/cfg_accounts/client.ts +8 -0
- package/src/_api/generated/cfg_accounts/errors.ts +5 -0
- package/src/_api/generated/cfg_centrifugo/client.ts +8 -0
- package/src/_api/generated/cfg_centrifugo/errors.ts +5 -0
- package/src/_api/generated/cfg_totp/CLAUDE.md +3 -3
- package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +7 -7
- package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +5 -5
- package/src/_api/generated/cfg_totp/_utils/schemas/index.ts +0 -1
- package/src/_api/generated/cfg_totp/client.ts +8 -0
- package/src/_api/generated/cfg_totp/errors.ts +5 -0
- package/src/_api/generated/cfg_totp/schema.json +2 -103
- package/src/_api/generated/cfg_totp/totp__backup_codes/models.ts +10 -10
- package/src/_api/generated/cfg_totp/totp__totp_management/client.ts +2 -13
- package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +9 -34
- package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +12 -12
- package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +8 -8
- package/src/auth/hooks/useTwoFactorStatus.ts +5 -11
- package/src/_api/generated/cfg_totp/_utils/schemas/PaginatedDeviceListResponseList.schema.ts +0 -24
package/dist/index.cjs
CHANGED
|
@@ -492,6 +492,9 @@ var APIError = class extends Error {
|
|
|
492
492
|
if (details.detail) {
|
|
493
493
|
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
494
494
|
}
|
|
495
|
+
if (details.error) {
|
|
496
|
+
return String(details.error);
|
|
497
|
+
}
|
|
495
498
|
if (details.message) {
|
|
496
499
|
return String(details.message);
|
|
497
500
|
}
|
|
@@ -830,6 +833,12 @@ var APIClient = class {
|
|
|
830
833
|
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
831
834
|
headers["Content-Type"] = "application/json";
|
|
832
835
|
}
|
|
836
|
+
if (!headers["Authorization"]) {
|
|
837
|
+
const token = this.getToken();
|
|
838
|
+
if (token) {
|
|
839
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
840
|
+
}
|
|
841
|
+
}
|
|
833
842
|
if (this.logger) {
|
|
834
843
|
this.logger.logRequest({
|
|
835
844
|
method,
|
|
@@ -1582,7 +1591,44 @@ var import_consola4 = require("consola");
|
|
|
1582
1591
|
async function getAccountsOauthConnectionsList(client) {
|
|
1583
1592
|
const api2 = client || getAPIInstance();
|
|
1584
1593
|
const response = await api2.oauth.accountsOauthConnectionsList();
|
|
1585
|
-
|
|
1594
|
+
try {
|
|
1595
|
+
return OAuthConnectionSchema.array().parse(response);
|
|
1596
|
+
} catch (error) {
|
|
1597
|
+
import_consola4.consola.error("\u274C Zod Validation Failed");
|
|
1598
|
+
import_consola4.consola.box(`getAccountsOauthConnectionsList
|
|
1599
|
+
Path: /cfg/accounts/oauth/connections/
|
|
1600
|
+
Method: GET`);
|
|
1601
|
+
if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
|
|
1602
|
+
import_consola4.consola.error("Validation Issues:");
|
|
1603
|
+
error.issues.forEach((issue, index) => {
|
|
1604
|
+
import_consola4.consola.error(` ${index + 1}. ${issue.path.join(".") || "root"}`);
|
|
1605
|
+
import_consola4.consola.error(` \u251C\u2500 Message: ${issue.message}`);
|
|
1606
|
+
if (issue.expected) import_consola4.consola.error(` \u251C\u2500 Expected: ${issue.expected}`);
|
|
1607
|
+
if (issue.received) import_consola4.consola.error(` \u2514\u2500 Received: ${issue.received}`);
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
import_consola4.consola.error("Response data:", response);
|
|
1611
|
+
if (typeof window !== "undefined" && error instanceof Error && "issues" in error) {
|
|
1612
|
+
try {
|
|
1613
|
+
const event = new CustomEvent("zod-validation-error", {
|
|
1614
|
+
detail: {
|
|
1615
|
+
operation: "getAccountsOauthConnectionsList",
|
|
1616
|
+
path: "/cfg/accounts/oauth/connections/",
|
|
1617
|
+
method: "GET",
|
|
1618
|
+
error,
|
|
1619
|
+
response,
|
|
1620
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
1621
|
+
},
|
|
1622
|
+
bubbles: true,
|
|
1623
|
+
cancelable: false
|
|
1624
|
+
});
|
|
1625
|
+
window.dispatchEvent(event);
|
|
1626
|
+
} catch (eventError) {
|
|
1627
|
+
import_consola4.consola.warn("Failed to dispatch validation error event:", eventError);
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
throw error;
|
|
1631
|
+
}
|
|
1586
1632
|
}
|
|
1587
1633
|
__name(getAccountsOauthConnectionsList, "getAccountsOauthConnectionsList");
|
|
1588
1634
|
async function createAccountsOauthDisconnectCreate(data, client) {
|
|
@@ -2315,6 +2361,9 @@ var APIError2 = class extends Error {
|
|
|
2315
2361
|
if (details.detail) {
|
|
2316
2362
|
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
2317
2363
|
}
|
|
2364
|
+
if (details.error) {
|
|
2365
|
+
return String(details.error);
|
|
2366
|
+
}
|
|
2318
2367
|
if (details.message) {
|
|
2319
2368
|
return String(details.message);
|
|
2320
2369
|
}
|
|
@@ -2650,6 +2699,12 @@ var APIClient2 = class {
|
|
|
2650
2699
|
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
2651
2700
|
headers["Content-Type"] = "application/json";
|
|
2652
2701
|
}
|
|
2702
|
+
if (!headers["Authorization"]) {
|
|
2703
|
+
const token = this.getToken();
|
|
2704
|
+
if (token) {
|
|
2705
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2653
2708
|
if (this.logger) {
|
|
2654
2709
|
this.logger.logRequest({
|
|
2655
2710
|
method,
|