@djangocfg/api 2.1.54 → 2.1.56

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 (93) hide show
  1. package/dist/auth.cjs +28 -15
  2. package/dist/auth.cjs.map +1 -1
  3. package/dist/auth.d.cts +6 -6
  4. package/dist/auth.d.ts +6 -6
  5. package/dist/auth.mjs +28 -15
  6. package/dist/auth.mjs.map +1 -1
  7. package/dist/clients.cjs +56 -17
  8. package/dist/clients.cjs.map +1 -1
  9. package/dist/clients.d.cts +17 -17
  10. package/dist/clients.d.ts +17 -17
  11. package/dist/clients.mjs +56 -17
  12. package/dist/clients.mjs.map +1 -1
  13. package/dist/hooks.cjs +763 -12
  14. package/dist/hooks.cjs.map +1 -1
  15. package/dist/hooks.d.cts +11 -11
  16. package/dist/hooks.d.ts +11 -11
  17. package/dist/hooks.mjs +763 -12
  18. package/dist/hooks.mjs.map +1 -1
  19. package/dist/index.cjs +893 -69
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +59 -41
  22. package/dist/index.d.ts +59 -41
  23. package/dist/index.mjs +893 -69
  24. package/dist/index.mjs.map +1 -1
  25. package/package.json +3 -3
  26. package/src/generated/cfg_accounts/_utils/schemas/CentrifugoToken.schema.ts +1 -1
  27. package/src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts +2 -2
  28. package/src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts +1 -1
  29. package/src/generated/cfg_accounts/_utils/schemas/OAuthCallbackRequestRequest.schema.ts +1 -1
  30. package/src/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts +1 -1
  31. package/src/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts +1 -1
  32. package/src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts +1 -1
  33. package/src/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts +1 -1
  34. package/src/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts +1 -1
  35. package/src/generated/cfg_accounts/_utils/schemas/User.schema.ts +1 -1
  36. package/src/generated/cfg_accounts/api-instance.ts +61 -13
  37. package/src/generated/cfg_centrifugo/api-instance.ts +61 -13
  38. package/src/generated/cfg_totp/CLAUDE.md +90 -0
  39. package/src/generated/cfg_totp/_utils/fetchers/index.ts +33 -0
  40. package/src/generated/cfg_totp/_utils/fetchers/totp.ts +49 -0
  41. package/src/generated/cfg_totp/_utils/fetchers/totp__2fa_management.ts +108 -0
  42. package/src/generated/cfg_totp/_utils/fetchers/totp__2fa_setup.ts +153 -0
  43. package/src/generated/cfg_totp/_utils/fetchers/totp__2fa_verification.ts +152 -0
  44. package/src/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts +152 -0
  45. package/src/generated/cfg_totp/_utils/hooks/index.ts +33 -0
  46. package/src/generated/cfg_totp/_utils/hooks/totp.ts +42 -0
  47. package/src/generated/cfg_totp/_utils/hooks/totp__2fa_management.ts +58 -0
  48. package/src/generated/cfg_totp/_utils/hooks/totp__2fa_setup.ts +63 -0
  49. package/src/generated/cfg_totp/_utils/hooks/totp__2fa_verification.ts +62 -0
  50. package/src/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts +59 -0
  51. package/src/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateRequest.schema.ts +19 -0
  52. package/src/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateResponse.schema.ts +20 -0
  53. package/src/generated/cfg_totp/_utils/schemas/BackupCodesStatus.schema.ts +21 -0
  54. package/src/generated/cfg_totp/_utils/schemas/ConfirmSetupRequest.schema.ts +20 -0
  55. package/src/generated/cfg_totp/_utils/schemas/ConfirmSetupResponse.schema.ts +21 -0
  56. package/src/generated/cfg_totp/_utils/schemas/DeviceList.schema.ts +26 -0
  57. package/src/generated/cfg_totp/_utils/schemas/DisableRequest.schema.ts +19 -0
  58. package/src/generated/cfg_totp/_utils/schemas/PaginatedDeviceListList.schema.ts +24 -0
  59. package/src/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts +19 -0
  60. package/src/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts +23 -0
  61. package/src/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts +20 -0
  62. package/src/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts +20 -0
  63. package/src/generated/cfg_totp/_utils/schemas/VerifyResponse.schema.ts +24 -0
  64. package/src/generated/cfg_totp/_utils/schemas/index.ts +32 -0
  65. package/src/generated/cfg_totp/api-instance.ts +180 -0
  66. package/src/generated/cfg_totp/client.ts +313 -0
  67. package/src/generated/cfg_totp/enums.ts +12 -0
  68. package/src/generated/cfg_totp/errors.ts +117 -0
  69. package/src/generated/cfg_totp/http.ts +104 -0
  70. package/src/generated/cfg_totp/index.ts +302 -0
  71. package/src/generated/cfg_totp/logger.ts +260 -0
  72. package/src/generated/cfg_totp/retry.ts +176 -0
  73. package/src/generated/cfg_totp/schema.json +859 -0
  74. package/src/generated/cfg_totp/storage.ts +162 -0
  75. package/src/generated/cfg_totp/totp/client.ts +23 -0
  76. package/src/generated/cfg_totp/totp/index.ts +3 -0
  77. package/src/generated/cfg_totp/totp/models.ts +1 -0
  78. package/src/generated/cfg_totp/totp__2fa_management/client.ts +41 -0
  79. package/src/generated/cfg_totp/totp__2fa_management/index.ts +3 -0
  80. package/src/generated/cfg_totp/totp__2fa_management/models.ts +60 -0
  81. package/src/generated/cfg_totp/totp__2fa_setup/client.ts +32 -0
  82. package/src/generated/cfg_totp/totp__2fa_setup/index.ts +3 -0
  83. package/src/generated/cfg_totp/totp__2fa_setup/models.ts +54 -0
  84. package/src/generated/cfg_totp/totp__2fa_verification/client.ts +32 -0
  85. package/src/generated/cfg_totp/totp__2fa_verification/index.ts +3 -0
  86. package/src/generated/cfg_totp/totp__2fa_verification/models.ts +44 -0
  87. package/src/generated/cfg_totp/totp__backup_codes/client.ts +31 -0
  88. package/src/generated/cfg_totp/totp__backup_codes/index.ts +3 -0
  89. package/src/generated/cfg_totp/totp__backup_codes/models.ts +37 -0
  90. package/src/generated/cfg_totp/validation-events.ts +134 -0
  91. package/src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts +2 -2
  92. package/src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts +1 -1
  93. package/src/generated/cfg_webpush/api-instance.ts +61 -13
package/dist/auth.d.cts CHANGED
@@ -35,7 +35,7 @@ declare enum OTPVerifyRequestChannel {
35
35
  declare const OTPRequestRequestSchema: z.ZodObject<{
36
36
  identifier: z.ZodString;
37
37
  channel: z.ZodOptional<z.ZodEnum<typeof OTPRequestRequestChannel>>;
38
- source_url: z.ZodOptional<z.ZodURL>;
38
+ source_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
39
39
  }, z.core.$strip>;
40
40
  /**
41
41
  * Infer TypeScript type from Zod schema
@@ -74,7 +74,7 @@ declare const OTPVerifyRequestSchema: z.ZodObject<{
74
74
  identifier: z.ZodString;
75
75
  otp: z.ZodString;
76
76
  channel: z.ZodOptional<z.ZodEnum<typeof OTPVerifyRequestChannel>>;
77
- source_url: z.ZodOptional<z.ZodURL>;
77
+ source_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
78
78
  }, z.core.$strip>;
79
79
  /**
80
80
  * Infer TypeScript type from Zod schema
@@ -105,7 +105,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
105
105
  company: z.ZodOptional<z.ZodString>;
106
106
  phone: z.ZodOptional<z.ZodString>;
107
107
  position: z.ZodOptional<z.ZodString>;
108
- avatar: z.ZodNullable<z.ZodURL>;
108
+ avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
109
109
  is_staff: z.ZodBoolean;
110
110
  is_superuser: z.ZodBoolean;
111
111
  date_joined: z.ZodISODateTime;
@@ -113,7 +113,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
113
113
  unanswered_messages_count: z.ZodInt;
114
114
  centrifugo: z.ZodNullable<z.ZodObject<{
115
115
  token: z.ZodString;
116
- centrifugo_url: z.ZodURL;
116
+ centrifugo_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
117
117
  expires_at: z.ZodISODateTime;
118
118
  channels: z.ZodArray<z.ZodString>;
119
119
  }, z.core.$strip>>;
@@ -182,7 +182,7 @@ declare const UserSchema: z.ZodObject<{
182
182
  company: z.ZodOptional<z.ZodString>;
183
183
  phone: z.ZodOptional<z.ZodString>;
184
184
  position: z.ZodOptional<z.ZodString>;
185
- avatar: z.ZodNullable<z.ZodURL>;
185
+ avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
186
186
  is_staff: z.ZodBoolean;
187
187
  is_superuser: z.ZodBoolean;
188
188
  date_joined: z.ZodISODateTime;
@@ -190,7 +190,7 @@ declare const UserSchema: z.ZodObject<{
190
190
  unanswered_messages_count: z.ZodInt;
191
191
  centrifugo: z.ZodNullable<z.ZodObject<{
192
192
  token: z.ZodString;
193
- centrifugo_url: z.ZodURL;
193
+ centrifugo_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
194
194
  expires_at: z.ZodISODateTime;
195
195
  channels: z.ZodArray<z.ZodString>;
196
196
  }, z.core.$strip>>;
package/dist/auth.d.ts CHANGED
@@ -35,7 +35,7 @@ declare enum OTPVerifyRequestChannel {
35
35
  declare const OTPRequestRequestSchema: z.ZodObject<{
36
36
  identifier: z.ZodString;
37
37
  channel: z.ZodOptional<z.ZodEnum<typeof OTPRequestRequestChannel>>;
38
- source_url: z.ZodOptional<z.ZodURL>;
38
+ source_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
39
39
  }, z.core.$strip>;
40
40
  /**
41
41
  * Infer TypeScript type from Zod schema
@@ -74,7 +74,7 @@ declare const OTPVerifyRequestSchema: z.ZodObject<{
74
74
  identifier: z.ZodString;
75
75
  otp: z.ZodString;
76
76
  channel: z.ZodOptional<z.ZodEnum<typeof OTPVerifyRequestChannel>>;
77
- source_url: z.ZodOptional<z.ZodURL>;
77
+ source_url: z.ZodOptional<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
78
78
  }, z.core.$strip>;
79
79
  /**
80
80
  * Infer TypeScript type from Zod schema
@@ -105,7 +105,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
105
105
  company: z.ZodOptional<z.ZodString>;
106
106
  phone: z.ZodOptional<z.ZodString>;
107
107
  position: z.ZodOptional<z.ZodString>;
108
- avatar: z.ZodNullable<z.ZodURL>;
108
+ avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
109
109
  is_staff: z.ZodBoolean;
110
110
  is_superuser: z.ZodBoolean;
111
111
  date_joined: z.ZodISODateTime;
@@ -113,7 +113,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
113
113
  unanswered_messages_count: z.ZodInt;
114
114
  centrifugo: z.ZodNullable<z.ZodObject<{
115
115
  token: z.ZodString;
116
- centrifugo_url: z.ZodURL;
116
+ centrifugo_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
117
117
  expires_at: z.ZodISODateTime;
118
118
  channels: z.ZodArray<z.ZodString>;
119
119
  }, z.core.$strip>>;
@@ -182,7 +182,7 @@ declare const UserSchema: z.ZodObject<{
182
182
  company: z.ZodOptional<z.ZodString>;
183
183
  phone: z.ZodOptional<z.ZodString>;
184
184
  position: z.ZodOptional<z.ZodString>;
185
- avatar: z.ZodNullable<z.ZodURL>;
185
+ avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
186
186
  is_staff: z.ZodBoolean;
187
187
  is_superuser: z.ZodBoolean;
188
188
  date_joined: z.ZodISODateTime;
@@ -190,7 +190,7 @@ declare const UserSchema: z.ZodObject<{
190
190
  unanswered_messages_count: z.ZodInt;
191
191
  centrifugo: z.ZodNullable<z.ZodObject<{
192
192
  token: z.ZodString;
193
- centrifugo_url: z.ZodURL;
193
+ centrifugo_url: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
194
194
  expires_at: z.ZodISODateTime;
195
195
  channels: z.ZodArray<z.ZodString>;
196
196
  }, z.core.$strip>>;
package/dist/auth.mjs CHANGED
@@ -817,7 +817,7 @@ var OTPVerifyRequestChannel = /* @__PURE__ */ ((OTPVerifyRequestChannel2) => {
817
817
  import { z } from "zod";
818
818
  var CentrifugoTokenSchema = z.object({
819
819
  token: z.string(),
820
- centrifugo_url: z.url(),
820
+ centrifugo_url: z.union([z.url(), z.literal("")]),
821
821
  expires_at: z.iso.datetime(),
822
822
  channels: z.array(z.string())
823
823
  });
@@ -825,14 +825,14 @@ var CentrifugoTokenSchema = z.object({
825
825
  // src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts
826
826
  import { z as z2 } from "zod";
827
827
  var OAuthAuthorizeRequestRequestSchema = z2.object({
828
- redirect_uri: z2.url().optional(),
829
- source_url: z2.url().optional()
828
+ redirect_uri: z2.union([z2.url(), z2.literal("")]).optional(),
829
+ source_url: z2.union([z2.url(), z2.literal("")]).optional()
830
830
  });
831
831
 
832
832
  // src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts
833
833
  import { z as z3 } from "zod";
834
834
  var OAuthAuthorizeResponseSchema = z3.object({
835
- authorization_url: z3.url(),
835
+ authorization_url: z3.union([z3.url(), z3.literal("")]),
836
836
  state: z3.string()
837
837
  });
838
838
 
@@ -841,7 +841,7 @@ import { z as z4 } from "zod";
841
841
  var OAuthCallbackRequestRequestSchema = z4.object({
842
842
  code: z4.string().min(10).max(500),
843
843
  state: z4.string().min(20).max(100),
844
- redirect_uri: z4.url().optional()
844
+ redirect_uri: z4.union([z4.url(), z4.literal("")]).optional()
845
845
  });
846
846
 
847
847
  // src/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts
@@ -852,7 +852,7 @@ var OAuthConnectionSchema = z5.object({
852
852
  provider_display: z5.string(),
853
853
  provider_username: z5.string(),
854
854
  provider_email: z5.email(),
855
- provider_avatar_url: z5.url(),
855
+ provider_avatar_url: z5.union([z5.url(), z5.literal("")]),
856
856
  connected_at: z5.iso.datetime(),
857
857
  last_login_at: z5.iso.datetime()
858
858
  });
@@ -873,7 +873,7 @@ var OAuthErrorSchema = z7.object({
873
873
  // src/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts
874
874
  import { z as z8 } from "zod";
875
875
  var OAuthProvidersResponseSchema = z8.object({
876
- providers: z8.array(z8.record(z8.string(), z8.record(z8.string(), z8.any())))
876
+ providers: z8.array(z8.record(z8.string(), z8.any()))
877
877
  });
878
878
 
879
879
  // src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts
@@ -881,7 +881,7 @@ import { z as z9 } from "zod";
881
881
  var OAuthTokenResponseSchema = z9.object({
882
882
  access: z9.string(),
883
883
  refresh: z9.string(),
884
- user: z9.record(z9.string(), z9.record(z9.string(), z9.any())),
884
+ user: z9.record(z9.string(), z9.any()),
885
885
  is_new_user: z9.boolean(),
886
886
  is_new_connection: z9.boolean()
887
887
  });
@@ -897,7 +897,7 @@ import { z as z11 } from "zod";
897
897
  var OTPRequestRequestSchema = z11.object({
898
898
  identifier: z11.string().min(1),
899
899
  channel: z11.nativeEnum(OTPRequestRequestChannel).optional(),
900
- source_url: z11.url().optional()
900
+ source_url: z11.union([z11.url(), z11.literal("")]).optional()
901
901
  });
902
902
 
903
903
  // src/generated/cfg_accounts/_utils/schemas/OTPRequestResponse.schema.ts
@@ -912,7 +912,7 @@ var OTPVerifyRequestSchema = z13.object({
912
912
  identifier: z13.string().min(1),
913
913
  otp: z13.string().min(6).max(6),
914
914
  channel: z13.nativeEnum(OTPVerifyRequestChannel).optional(),
915
- source_url: z13.url().optional()
915
+ source_url: z13.union([z13.url(), z13.literal("")]).optional()
916
916
  });
917
917
 
918
918
  // src/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts
@@ -931,7 +931,7 @@ var UserSchema = z14.object({
931
931
  company: z14.string().max(100).optional(),
932
932
  phone: z14.string().max(20).optional(),
933
933
  position: z14.string().max(100).optional(),
934
- avatar: z14.url().nullable(),
934
+ avatar: z14.union([z14.url(), z14.literal("")]).nullable(),
935
935
  is_staff: z14.boolean(),
936
936
  is_superuser: z14.boolean(),
937
937
  date_joined: z14.iso.datetime(),
@@ -985,10 +985,23 @@ import { consola } from "consola";
985
985
 
986
986
  // src/generated/cfg_accounts/api-instance.ts
987
987
  var globalAPI = null;
988
+ var autoConfigAttempted = false;
989
+ function tryAutoConfigureFromEnv() {
990
+ if (autoConfigAttempted) return;
991
+ autoConfigAttempted = true;
992
+ if (globalAPI) return;
993
+ if (typeof process === "undefined" || !process.env) return;
994
+ const baseUrl = process.env.NEXT_PUBLIC_API_URL || process.env.VITE_API_URL || process.env.REACT_APP_API_URL || process.env.API_URL;
995
+ if (baseUrl) {
996
+ globalAPI = new API(baseUrl);
997
+ }
998
+ }
999
+ __name(tryAutoConfigureFromEnv, "tryAutoConfigureFromEnv");
988
1000
  function getAPIInstance() {
1001
+ tryAutoConfigureFromEnv();
989
1002
  if (!globalAPI) {
990
1003
  throw new Error(
991
- 'API not configured. Call configureAPI() with your base URL before using fetchers or hooks.\n\nExample:\n import { configureAPI } from "./api-instance"\n configureAPI({ baseUrl: "https://api.example.com" })'
1004
+ 'API not configured. Call configureAPI() with your base URL before using fetchers or hooks.\n\nExample:\n import { configureAPI } from "./api-instance"\n configureAPI({ baseUrl: "https://api.example.com" })\n\nOr set environment variable: NEXT_PUBLIC_API_URL, VITE_API_URL, or REACT_APP_API_URL'
992
1005
  );
993
1006
  }
994
1007
  return globalAPI;
@@ -3346,8 +3359,8 @@ import { z as z55 } from "zod";
3346
3359
  var SendPushRequestRequestSchema = z55.object({
3347
3360
  title: z55.string().min(1).max(255),
3348
3361
  body: z55.string().min(1),
3349
- icon: z55.url().nullable().optional(),
3350
- url: z55.url().nullable().optional()
3362
+ icon: z55.union([z55.url(), z55.literal("")]).nullable().optional(),
3363
+ url: z55.union([z55.url(), z55.literal("")]).nullable().optional()
3351
3364
  });
3352
3365
 
3353
3366
  // src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts
@@ -3360,7 +3373,7 @@ var SendPushResponseSchema = z56.object({
3360
3373
  // src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts
3361
3374
  import { z as z57 } from "zod";
3362
3375
  var SubscribeRequestRequestSchema = z57.object({
3363
- endpoint: z57.url(),
3376
+ endpoint: z57.union([z57.url(), z57.literal("")]),
3364
3377
  keys: z57.record(z57.string(), z57.string().min(1))
3365
3378
  });
3366
3379