@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/auth.cjs
CHANGED
|
@@ -600,6 +600,9 @@ var APIError = class extends Error {
|
|
|
600
600
|
if (details.detail) {
|
|
601
601
|
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
602
602
|
}
|
|
603
|
+
if (details.error) {
|
|
604
|
+
return String(details.error);
|
|
605
|
+
}
|
|
603
606
|
if (details.message) {
|
|
604
607
|
return String(details.message);
|
|
605
608
|
}
|
|
@@ -938,6 +941,12 @@ var APIClient = class {
|
|
|
938
941
|
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
939
942
|
headers["Content-Type"] = "application/json";
|
|
940
943
|
}
|
|
944
|
+
if (!headers["Authorization"]) {
|
|
945
|
+
const token = this.getToken();
|
|
946
|
+
if (token) {
|
|
947
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
948
|
+
}
|
|
949
|
+
}
|
|
941
950
|
if (this.logger) {
|
|
942
951
|
this.logger.logRequest({
|
|
943
952
|
method,
|
|
@@ -1944,6 +1953,9 @@ var APIError2 = class extends Error {
|
|
|
1944
1953
|
if (details.detail) {
|
|
1945
1954
|
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
1946
1955
|
}
|
|
1956
|
+
if (details.error) {
|
|
1957
|
+
return String(details.error);
|
|
1958
|
+
}
|
|
1947
1959
|
if (details.message) {
|
|
1948
1960
|
return String(details.message);
|
|
1949
1961
|
}
|
|
@@ -2279,6 +2291,12 @@ var APIClient2 = class {
|
|
|
2279
2291
|
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
2280
2292
|
headers["Content-Type"] = "application/json";
|
|
2281
2293
|
}
|
|
2294
|
+
if (!headers["Authorization"]) {
|
|
2295
|
+
const token = this.getToken();
|
|
2296
|
+
if (token) {
|
|
2297
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2282
2300
|
if (this.logger) {
|
|
2283
2301
|
this.logger.logRequest({
|
|
2284
2302
|
method,
|
|
@@ -2665,15 +2683,8 @@ var TotpManagement = class {
|
|
|
2665
2683
|
/**
|
|
2666
2684
|
* List all TOTP devices for user.
|
|
2667
2685
|
*/
|
|
2668
|
-
async
|
|
2669
|
-
const
|
|
2670
|
-
let params;
|
|
2671
|
-
if (isParamsObject) {
|
|
2672
|
-
params = args[0];
|
|
2673
|
-
} else {
|
|
2674
|
-
params = { ordering: args[0], page: args[1], page_size: args[2], search: args[3] };
|
|
2675
|
-
}
|
|
2676
|
-
const response = await this.client.request("GET", "/cfg/totp/devices/", { params });
|
|
2686
|
+
async totpDevicesRetrieve() {
|
|
2687
|
+
const response = await this.client.request("GET", "/cfg/totp/devices/");
|
|
2677
2688
|
return response;
|
|
2678
2689
|
}
|
|
2679
2690
|
/**
|
|
@@ -2861,6 +2872,9 @@ var APIError3 = class extends Error {
|
|
|
2861
2872
|
if (details.detail) {
|
|
2862
2873
|
return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
|
|
2863
2874
|
}
|
|
2875
|
+
if (details.error) {
|
|
2876
|
+
return String(details.error);
|
|
2877
|
+
}
|
|
2864
2878
|
if (details.message) {
|
|
2865
2879
|
return String(details.message);
|
|
2866
2880
|
}
|
|
@@ -3200,6 +3214,12 @@ var APIClient3 = class {
|
|
|
3200
3214
|
if (!options?.formData && !options?.binaryBody && !headers["Content-Type"]) {
|
|
3201
3215
|
headers["Content-Type"] = "application/json";
|
|
3202
3216
|
}
|
|
3217
|
+
if (!headers["Authorization"]) {
|
|
3218
|
+
const token = this.getToken();
|
|
3219
|
+
if (token) {
|
|
3220
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
3221
|
+
}
|
|
3222
|
+
}
|
|
3203
3223
|
if (this.logger) {
|
|
3204
3224
|
this.logger.logRequest({
|
|
3205
3225
|
method,
|
|
@@ -3451,81 +3471,67 @@ var DisableRequestSchema = import_zod30.z.object({
|
|
|
3451
3471
|
code: import_zod30.z.string().min(6).max(6)
|
|
3452
3472
|
});
|
|
3453
3473
|
|
|
3454
|
-
// src/_api/generated/cfg_totp/_utils/schemas/
|
|
3474
|
+
// src/_api/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts
|
|
3455
3475
|
var import_zod31 = require("zod");
|
|
3456
|
-
var
|
|
3457
|
-
|
|
3458
|
-
page: import_zod31.z.number().int(),
|
|
3459
|
-
pages: import_zod31.z.number().int(),
|
|
3460
|
-
page_size: import_zod31.z.number().int(),
|
|
3461
|
-
has_next: import_zod31.z.boolean(),
|
|
3462
|
-
has_previous: import_zod31.z.boolean(),
|
|
3463
|
-
next_page: import_zod31.z.number().int().nullable().optional(),
|
|
3464
|
-
previous_page: import_zod31.z.number().int().nullable().optional(),
|
|
3465
|
-
results: import_zod31.z.array(DeviceListResponseSchema)
|
|
3476
|
+
var SetupRequestSchema = import_zod31.z.object({
|
|
3477
|
+
device_name: import_zod31.z.string().min(1).max(100).optional()
|
|
3466
3478
|
});
|
|
3467
3479
|
|
|
3468
|
-
// src/_api/generated/cfg_totp/_utils/schemas/
|
|
3480
|
+
// src/_api/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts
|
|
3469
3481
|
var import_zod32 = require("zod");
|
|
3470
|
-
var
|
|
3471
|
-
|
|
3482
|
+
var SetupResponseSchema = import_zod32.z.object({
|
|
3483
|
+
device_id: import_zod32.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
3484
|
+
secret: import_zod32.z.string(),
|
|
3485
|
+
provisioning_uri: import_zod32.z.string(),
|
|
3486
|
+
qr_code_base64: import_zod32.z.string(),
|
|
3487
|
+
expires_in: import_zod32.z.number().int()
|
|
3472
3488
|
});
|
|
3473
3489
|
|
|
3474
|
-
// src/_api/generated/cfg_totp/_utils/schemas/
|
|
3490
|
+
// src/_api/generated/cfg_totp/_utils/schemas/TotpVerifyUser.schema.ts
|
|
3475
3491
|
var import_zod33 = require("zod");
|
|
3476
|
-
var
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3492
|
+
var TotpVerifyUserSchema = import_zod33.z.object({
|
|
3493
|
+
id: import_zod33.z.number().int(),
|
|
3494
|
+
email: import_zod33.z.email(),
|
|
3495
|
+
first_name: import_zod33.z.string().max(50).optional(),
|
|
3496
|
+
last_name: import_zod33.z.string().max(50).optional(),
|
|
3497
|
+
full_name: import_zod33.z.string(),
|
|
3498
|
+
initials: import_zod33.z.string(),
|
|
3499
|
+
display_username: import_zod33.z.string(),
|
|
3500
|
+
company: import_zod33.z.string().max(100).optional(),
|
|
3501
|
+
phone: import_zod33.z.string().max(20).optional(),
|
|
3502
|
+
position: import_zod33.z.string().max(100).optional(),
|
|
3503
|
+
language: import_zod33.z.string().max(10).optional(),
|
|
3504
|
+
avatar: import_zod33.z.string().nullable(),
|
|
3505
|
+
is_staff: import_zod33.z.boolean(),
|
|
3506
|
+
is_superuser: import_zod33.z.boolean(),
|
|
3507
|
+
date_joined: import_zod33.z.string().datetime({ offset: true }),
|
|
3508
|
+
last_login: import_zod33.z.string().datetime({ offset: true }).nullable(),
|
|
3509
|
+
unanswered_messages_count: import_zod33.z.number().int()
|
|
3482
3510
|
});
|
|
3483
3511
|
|
|
3484
|
-
// src/_api/generated/cfg_totp/_utils/schemas/
|
|
3512
|
+
// src/_api/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts
|
|
3485
3513
|
var import_zod34 = require("zod");
|
|
3486
|
-
var
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
first_name: import_zod34.z.string().max(50).optional(),
|
|
3490
|
-
last_name: import_zod34.z.string().max(50).optional(),
|
|
3491
|
-
full_name: import_zod34.z.string(),
|
|
3492
|
-
initials: import_zod34.z.string(),
|
|
3493
|
-
display_username: import_zod34.z.string(),
|
|
3494
|
-
company: import_zod34.z.string().max(100).optional(),
|
|
3495
|
-
phone: import_zod34.z.string().max(20).optional(),
|
|
3496
|
-
position: import_zod34.z.string().max(100).optional(),
|
|
3497
|
-
language: import_zod34.z.string().max(10).optional(),
|
|
3498
|
-
avatar: import_zod34.z.string().nullable(),
|
|
3499
|
-
is_staff: import_zod34.z.boolean(),
|
|
3500
|
-
is_superuser: import_zod34.z.boolean(),
|
|
3501
|
-
date_joined: import_zod34.z.string().datetime({ offset: true }),
|
|
3502
|
-
last_login: import_zod34.z.string().datetime({ offset: true }).nullable(),
|
|
3503
|
-
unanswered_messages_count: import_zod34.z.number().int()
|
|
3514
|
+
var VerifyBackupRequestSchema = import_zod34.z.object({
|
|
3515
|
+
session_id: import_zod34.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
|
|
3516
|
+
backup_code: import_zod34.z.string().min(8).max(8)
|
|
3504
3517
|
});
|
|
3505
3518
|
|
|
3506
|
-
// src/_api/generated/cfg_totp/_utils/schemas/
|
|
3519
|
+
// src/_api/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts
|
|
3507
3520
|
var import_zod35 = require("zod");
|
|
3508
|
-
var
|
|
3521
|
+
var VerifyRequestSchema = import_zod35.z.object({
|
|
3509
3522
|
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),
|
|
3510
|
-
|
|
3511
|
-
});
|
|
3512
|
-
|
|
3513
|
-
// src/_api/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts
|
|
3514
|
-
var import_zod36 = require("zod");
|
|
3515
|
-
var VerifyRequestSchema = import_zod36.z.object({
|
|
3516
|
-
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),
|
|
3517
|
-
code: import_zod36.z.string().min(6).max(6)
|
|
3523
|
+
code: import_zod35.z.string().min(6).max(6)
|
|
3518
3524
|
});
|
|
3519
3525
|
|
|
3520
3526
|
// src/_api/generated/cfg_totp/_utils/schemas/VerifyResponse.schema.ts
|
|
3521
|
-
var
|
|
3522
|
-
var VerifyResponseSchema =
|
|
3523
|
-
message:
|
|
3524
|
-
access_token:
|
|
3525
|
-
refresh_token:
|
|
3527
|
+
var import_zod36 = require("zod");
|
|
3528
|
+
var VerifyResponseSchema = import_zod36.z.object({
|
|
3529
|
+
message: import_zod36.z.string(),
|
|
3530
|
+
access_token: import_zod36.z.string(),
|
|
3531
|
+
refresh_token: import_zod36.z.string(),
|
|
3526
3532
|
user: TotpVerifyUserSchema,
|
|
3527
|
-
remaining_backup_codes:
|
|
3528
|
-
warning:
|
|
3533
|
+
remaining_backup_codes: import_zod36.z.number().int().optional(),
|
|
3534
|
+
warning: import_zod36.z.string().optional()
|
|
3529
3535
|
});
|
|
3530
3536
|
|
|
3531
3537
|
// src/_api/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts
|
|
@@ -4479,9 +4485,8 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
|
|
|
4479
4485
|
setError(null);
|
|
4480
4486
|
try {
|
|
4481
4487
|
authLogger.info("Fetching 2FA status...");
|
|
4482
|
-
const response = await apiTotp.totp_management.
|
|
4483
|
-
const
|
|
4484
|
-
const mappedDevices = devices2.map((device) => ({
|
|
4488
|
+
const response = await apiTotp.totp_management.totpDevicesRetrieve();
|
|
4489
|
+
const mappedDevices = response.devices.map((device) => ({
|
|
4485
4490
|
id: device.id,
|
|
4486
4491
|
name: device.name,
|
|
4487
4492
|
createdAt: device.created_at,
|
|
@@ -4489,9 +4494,8 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
|
|
|
4489
4494
|
isPrimary: device.is_primary
|
|
4490
4495
|
}));
|
|
4491
4496
|
setDevices(mappedDevices);
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
authLogger.info("2FA status:", enabled ? "enabled" : "disabled");
|
|
4497
|
+
setHas2FAEnabled(response.has_2fa_enabled);
|
|
4498
|
+
authLogger.info("2FA status:", response.has_2fa_enabled ? "enabled" : "disabled");
|
|
4495
4499
|
} catch (err) {
|
|
4496
4500
|
const errorMessage = err instanceof Error ? err.message : "Failed to fetch 2FA status";
|
|
4497
4501
|
authLogger.error("Failed to fetch 2FA status:", err);
|