@djangocfg/api 2.1.263 → 2.1.266

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 (33) hide show
  1. package/dist/auth.cjs +62 -74
  2. package/dist/auth.cjs.map +1 -1
  3. package/dist/auth.d.cts +0 -18
  4. package/dist/auth.d.ts +0 -18
  5. package/dist/auth.mjs +62 -74
  6. package/dist/auth.mjs.map +1 -1
  7. package/dist/clients.cjs +57 -79
  8. package/dist/clients.cjs.map +1 -1
  9. package/dist/clients.d.cts +113 -179
  10. package/dist/clients.d.ts +113 -179
  11. package/dist/clients.mjs +57 -79
  12. package/dist/clients.mjs.map +1 -1
  13. package/dist/hooks.d.cts +72 -72
  14. package/dist/hooks.d.ts +72 -72
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +97 -97
  17. package/dist/index.d.ts +97 -97
  18. package/dist/index.mjs.map +1 -1
  19. package/package.json +2 -2
  20. package/src/_api/generated/cfg_accounts/accounts/models.ts +31 -31
  21. package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +40 -40
  22. package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +31 -31
  23. package/src/_api/generated/cfg_totp/CLAUDE.md +3 -3
  24. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +7 -7
  25. package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +5 -5
  26. package/src/_api/generated/cfg_totp/_utils/schemas/index.ts +0 -1
  27. package/src/_api/generated/cfg_totp/schema.json +2 -103
  28. package/src/_api/generated/cfg_totp/totp__backup_codes/models.ts +14 -14
  29. package/src/_api/generated/cfg_totp/totp__totp_management/client.ts +2 -13
  30. package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +4 -29
  31. package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +13 -13
  32. package/src/auth/hooks/useTwoFactorStatus.ts +21 -14
  33. package/src/_api/generated/cfg_totp/_utils/schemas/PaginatedDeviceListResponseList.schema.ts +0 -24
package/dist/clients.mjs CHANGED
@@ -2771,15 +2771,8 @@ var TotpManagement = class {
2771
2771
  /**
2772
2772
  * List all TOTP devices for user.
2773
2773
  */
2774
- async totpDevicesList(...args) {
2775
- const isParamsObject = args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0]);
2776
- let params;
2777
- if (isParamsObject) {
2778
- params = args[0];
2779
- } else {
2780
- params = { ordering: args[0], page: args[1], page_size: args[2], search: args[3] };
2781
- }
2782
- const response = await this.client.request("GET", "/cfg/totp/devices/", { params });
2774
+ async totpDevicesRetrieve() {
2775
+ const response = await this.client.request("GET", "/cfg/totp/devices/");
2783
2776
  return response;
2784
2777
  }
2785
2778
  /**
@@ -3516,7 +3509,6 @@ __export(schemas_exports3, {
3516
3509
  DeviceListResponseSchema: () => DeviceListResponseSchema,
3517
3510
  DeviceListSchema: () => DeviceListSchema,
3518
3511
  DisableRequestSchema: () => DisableRequestSchema,
3519
- PaginatedDeviceListResponseListSchema: () => PaginatedDeviceListResponseListSchema,
3520
3512
  SetupRequestSchema: () => SetupRequestSchema,
3521
3513
  SetupResponseSchema: () => SetupResponseSchema,
3522
3514
  TotpVerifyUserSchema: () => TotpVerifyUserSchema,
@@ -3586,81 +3578,67 @@ var DisableRequestSchema = z30.object({
3586
3578
  code: z30.string().min(6).max(6)
3587
3579
  });
3588
3580
 
3589
- // src/_api/generated/cfg_totp/_utils/schemas/PaginatedDeviceListResponseList.schema.ts
3581
+ // src/_api/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts
3590
3582
  import { z as z31 } from "zod";
3591
- var PaginatedDeviceListResponseListSchema = z31.object({
3592
- count: z31.number().int(),
3593
- page: z31.number().int(),
3594
- pages: z31.number().int(),
3595
- page_size: z31.number().int(),
3596
- has_next: z31.boolean(),
3597
- has_previous: z31.boolean(),
3598
- next_page: z31.number().int().nullable().optional(),
3599
- previous_page: z31.number().int().nullable().optional(),
3600
- results: z31.array(DeviceListResponseSchema)
3583
+ var SetupRequestSchema = z31.object({
3584
+ device_name: z31.string().min(1).max(100).optional()
3601
3585
  });
3602
3586
 
3603
- // src/_api/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts
3587
+ // src/_api/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts
3604
3588
  import { z as z32 } from "zod";
3605
- var SetupRequestSchema = z32.object({
3606
- device_name: z32.string().min(1).max(100).optional()
3589
+ var SetupResponseSchema = z32.object({
3590
+ device_id: z32.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
3591
+ secret: z32.string(),
3592
+ provisioning_uri: z32.string(),
3593
+ qr_code_base64: z32.string(),
3594
+ expires_in: z32.number().int()
3607
3595
  });
3608
3596
 
3609
- // src/_api/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts
3597
+ // src/_api/generated/cfg_totp/_utils/schemas/TotpVerifyUser.schema.ts
3610
3598
  import { z as z33 } from "zod";
3611
- var SetupResponseSchema = z33.object({
3612
- device_id: z33.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
3613
- secret: z33.string(),
3614
- provisioning_uri: z33.string(),
3615
- qr_code_base64: z33.string(),
3616
- expires_in: z33.number().int()
3599
+ var TotpVerifyUserSchema = z33.object({
3600
+ id: z33.number().int(),
3601
+ email: z33.email(),
3602
+ first_name: z33.string().max(50).optional(),
3603
+ last_name: z33.string().max(50).optional(),
3604
+ full_name: z33.string(),
3605
+ initials: z33.string(),
3606
+ display_username: z33.string(),
3607
+ company: z33.string().max(100).optional(),
3608
+ phone: z33.string().max(20).optional(),
3609
+ position: z33.string().max(100).optional(),
3610
+ language: z33.string().max(10).optional(),
3611
+ avatar: z33.string().nullable(),
3612
+ is_staff: z33.boolean(),
3613
+ is_superuser: z33.boolean(),
3614
+ date_joined: z33.string().datetime({ offset: true }),
3615
+ last_login: z33.string().datetime({ offset: true }).nullable(),
3616
+ unanswered_messages_count: z33.number().int()
3617
3617
  });
3618
3618
 
3619
- // src/_api/generated/cfg_totp/_utils/schemas/TotpVerifyUser.schema.ts
3619
+ // src/_api/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts
3620
3620
  import { z as z34 } from "zod";
3621
- var TotpVerifyUserSchema = z34.object({
3622
- id: z34.number().int(),
3623
- email: z34.email(),
3624
- first_name: z34.string().max(50).optional(),
3625
- last_name: z34.string().max(50).optional(),
3626
- full_name: z34.string(),
3627
- initials: z34.string(),
3628
- display_username: z34.string(),
3629
- company: z34.string().max(100).optional(),
3630
- phone: z34.string().max(20).optional(),
3631
- position: z34.string().max(100).optional(),
3632
- language: z34.string().max(10).optional(),
3633
- avatar: z34.string().nullable(),
3634
- is_staff: z34.boolean(),
3635
- is_superuser: z34.boolean(),
3636
- date_joined: z34.string().datetime({ offset: true }),
3637
- last_login: z34.string().datetime({ offset: true }).nullable(),
3638
- unanswered_messages_count: z34.number().int()
3621
+ var VerifyBackupRequestSchema = z34.object({
3622
+ session_id: z34.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
3623
+ backup_code: z34.string().min(8).max(8)
3639
3624
  });
3640
3625
 
3641
- // src/_api/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts
3626
+ // src/_api/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts
3642
3627
  import { z as z35 } from "zod";
3643
- var VerifyBackupRequestSchema = z35.object({
3628
+ var VerifyRequestSchema = z35.object({
3644
3629
  session_id: z35.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
3645
- backup_code: z35.string().min(8).max(8)
3646
- });
3647
-
3648
- // src/_api/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts
3649
- import { z as z36 } from "zod";
3650
- var VerifyRequestSchema = z36.object({
3651
- session_id: z36.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
3652
- code: z36.string().min(6).max(6)
3630
+ code: z35.string().min(6).max(6)
3653
3631
  });
3654
3632
 
3655
3633
  // src/_api/generated/cfg_totp/_utils/schemas/VerifyResponse.schema.ts
3656
- import { z as z37 } from "zod";
3657
- var VerifyResponseSchema = z37.object({
3658
- message: z37.string(),
3659
- access_token: z37.string(),
3660
- refresh_token: z37.string(),
3634
+ import { z as z36 } from "zod";
3635
+ var VerifyResponseSchema = z36.object({
3636
+ message: z36.string(),
3637
+ access_token: z36.string(),
3638
+ refresh_token: z36.string(),
3661
3639
  user: TotpVerifyUserSchema,
3662
- remaining_backup_codes: z37.number().int().optional(),
3663
- warning: z37.string().optional()
3640
+ remaining_backup_codes: z36.number().int().optional(),
3641
+ warning: z36.string().optional()
3664
3642
  });
3665
3643
 
3666
3644
  // src/_api/generated/cfg_totp/_utils/fetchers/index.ts
@@ -3674,7 +3652,7 @@ __export(fetchers_exports3, {
3674
3652
  createTotpVerifyCreate: () => createTotpVerifyCreate,
3675
3653
  deleteTotpDevicesDestroy: () => deleteTotpDevicesDestroy,
3676
3654
  getTotpBackupCodesRetrieve: () => getTotpBackupCodesRetrieve,
3677
- getTotpDevicesList: () => getTotpDevicesList
3655
+ getTotpDevicesRetrieve: () => getTotpDevicesRetrieve
3678
3656
  });
3679
3657
 
3680
3658
  // src/_api/generated/cfg_totp/api-instance.ts
@@ -3801,14 +3779,14 @@ __name(createTotpBackupCodesRegenerateCreate, "createTotpBackupCodesRegenerateCr
3801
3779
 
3802
3780
  // src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts
3803
3781
  import { consola as consola7 } from "consola";
3804
- async function getTotpDevicesList(params, client) {
3782
+ async function getTotpDevicesRetrieve(client) {
3805
3783
  const api = client || getAPIInstance3();
3806
- const response = await api.totp_management.totpDevicesList(params?.ordering, params?.page, params?.page_size, params?.search);
3784
+ const response = await api.totp_management.totpDevicesRetrieve();
3807
3785
  try {
3808
- return PaginatedDeviceListResponseListSchema.parse(response);
3786
+ return DeviceListResponseSchema.parse(response);
3809
3787
  } catch (error) {
3810
3788
  consola7.error("\u274C Zod Validation Failed");
3811
- consola7.box(`getTotpDevicesList
3789
+ consola7.box(`getTotpDevicesRetrieve
3812
3790
  Path: /cfg/totp/devices/
3813
3791
  Method: GET`);
3814
3792
  if (error instanceof Error && "issues" in error && Array.isArray(error.issues)) {
@@ -3825,7 +3803,7 @@ Method: GET`);
3825
3803
  try {
3826
3804
  const event = new CustomEvent("zod-validation-error", {
3827
3805
  detail: {
3828
- operation: "getTotpDevicesList",
3806
+ operation: "getTotpDevicesRetrieve",
3829
3807
  path: "/cfg/totp/devices/",
3830
3808
  method: "GET",
3831
3809
  error,
@@ -3843,7 +3821,7 @@ Method: GET`);
3843
3821
  throw error;
3844
3822
  }
3845
3823
  }
3846
- __name(getTotpDevicesList, "getTotpDevicesList");
3824
+ __name(getTotpDevicesRetrieve, "getTotpDevicesRetrieve");
3847
3825
  async function createTotpDisableCreate(data, client) {
3848
3826
  const api = client || getAPIInstance3();
3849
3827
  const response = await api.totp_management.totpDisableCreate(data);
@@ -4363,7 +4341,7 @@ __export(hooks_exports2, {
4363
4341
  useCreateTotpVerifyCreate: () => useCreateTotpVerifyCreate,
4364
4342
  useDeleteTotpDevicesDestroy: () => useDeleteTotpDevicesDestroy,
4365
4343
  useTotpBackupCodesRetrieve: () => useTotpBackupCodesRetrieve,
4366
- useTotpDevicesList: () => useTotpDevicesList
4344
+ useTotpDevicesRetrieve: () => useTotpDevicesRetrieve
4367
4345
  });
4368
4346
 
4369
4347
  // src/_api/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts
@@ -4389,13 +4367,13 @@ __name(useCreateTotpBackupCodesRegenerateCreate, "useCreateTotpBackupCodesRegene
4389
4367
  // src/_api/generated/cfg_totp/_utils/hooks/totp__totp_management.ts
4390
4368
  import useSWR5 from "swr";
4391
4369
  import { useSWRConfig as useSWRConfig6 } from "swr";
4392
- function useTotpDevicesList(params, client) {
4370
+ function useTotpDevicesRetrieve(client) {
4393
4371
  return useSWR5(
4394
- ["cfg-totp-devices", params],
4395
- () => getTotpDevicesList(params, client)
4372
+ "cfg-totp-device",
4373
+ () => getTotpDevicesRetrieve(client)
4396
4374
  );
4397
4375
  }
4398
- __name(useTotpDevicesList, "useTotpDevicesList");
4376
+ __name(useTotpDevicesRetrieve, "useTotpDevicesRetrieve");
4399
4377
  function useCreateTotpDisableCreate() {
4400
4378
  const { mutate } = useSWRConfig6();
4401
4379
  return async (data, client) => {