@djangocfg/api 2.1.127 → 2.1.130

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 +10 -19
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +10 -19
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +35 -48
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.d.cts +11 -17
  8. package/dist/auth.d.ts +11 -17
  9. package/dist/auth.mjs +35 -48
  10. package/dist/auth.mjs.map +1 -1
  11. package/dist/clients.cjs +20 -31
  12. package/dist/clients.cjs.map +1 -1
  13. package/dist/clients.d.cts +46 -54
  14. package/dist/clients.d.ts +46 -54
  15. package/dist/clients.mjs +20 -31
  16. package/dist/clients.mjs.map +1 -1
  17. package/dist/hooks.cjs +8 -17
  18. package/dist/hooks.cjs.map +1 -1
  19. package/dist/hooks.d.cts +11 -20
  20. package/dist/hooks.d.ts +11 -20
  21. package/dist/hooks.mjs +8 -17
  22. package/dist/hooks.mjs.map +1 -1
  23. package/dist/index.cjs +12 -23
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +15 -35
  26. package/dist/index.d.ts +15 -35
  27. package/dist/index.mjs +12 -23
  28. package/dist/index.mjs.map +1 -1
  29. package/package.json +2 -2
  30. package/src/auth/context/AccountsContext.tsx +23 -28
  31. package/src/auth/context/AuthContext.tsx +2 -2
  32. package/src/generated/cfg_accounts/_utils/schemas/CentrifugoToken.schema.ts +1 -1
  33. package/src/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts +2 -2
  34. package/src/generated/cfg_accounts/_utils/schemas/OAuthDisconnectRequestRequest.schema.ts +1 -1
  35. package/src/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts +1 -1
  36. package/src/generated/cfg_accounts/_utils/schemas/User.schema.ts +2 -2
  37. package/src/generated/cfg_accounts/accounts/models.ts +1 -1
  38. package/src/generated/cfg_accounts/accounts__oauth/client.ts +1 -1
  39. package/src/generated/cfg_accounts/accounts__oauth/models.ts +1 -1
  40. package/src/generated/cfg_accounts/enums.ts +1 -19
  41. package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts +2 -2
  42. package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts +1 -1
  43. package/src/generated/cfg_centrifugo/_utils/schemas/Publish.schema.ts +2 -2
  44. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/client.ts +3 -3
  45. package/src/generated/cfg_centrifugo/schema.json +18 -0
  46. package/src/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +2 -2
  47. package/src/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +1 -1
  48. package/src/generated/cfg_totp/_utils/schemas/DeviceList.schema.ts +3 -3
  49. package/src/generated/cfg_totp/_utils/schemas/TotpVerifyUser.schema.ts +2 -2
  50. package/src/generated/cfg_totp/schema.json +18 -0
  51. package/src/generated/cfg_totp/totp__totp_management/client.ts +3 -3
package/dist/auth.cjs CHANGED
@@ -349,7 +349,7 @@ var Oauth = class {
349
349
  */
350
350
  async accountsOauthConnectionsList() {
351
351
  const response = await this.client.request("GET", "/cfg/accounts/oauth/connections/");
352
- return response;
352
+ return response.results || response;
353
353
  }
354
354
  /**
355
355
  * Disconnect OAuth provider
@@ -1126,28 +1126,17 @@ var LocalStorageAdapter = class {
1126
1126
  var enums_exports = {};
1127
1127
  __export(enums_exports, {
1128
1128
  OAuthConnectionProvider: () => OAuthConnectionProvider,
1129
- OAuthDisconnectRequestRequestProvider: () => OAuthDisconnectRequestRequestProvider,
1130
- OTPRequestRequestChannel: () => OTPRequestRequestChannel,
1131
- OTPVerifyRequestChannel: () => OTPVerifyRequestChannel
1129
+ OTPRequestRequestChannel: () => OTPRequestRequestChannel
1132
1130
  });
1133
1131
  var OAuthConnectionProvider = /* @__PURE__ */ ((OAuthConnectionProvider2) => {
1134
1132
  OAuthConnectionProvider2["GITHUB"] = "github";
1135
1133
  return OAuthConnectionProvider2;
1136
1134
  })(OAuthConnectionProvider || {});
1137
- var OAuthDisconnectRequestRequestProvider = /* @__PURE__ */ ((OAuthDisconnectRequestRequestProvider2) => {
1138
- OAuthDisconnectRequestRequestProvider2["GITHUB"] = "github";
1139
- return OAuthDisconnectRequestRequestProvider2;
1140
- })(OAuthDisconnectRequestRequestProvider || {});
1141
1135
  var OTPRequestRequestChannel = /* @__PURE__ */ ((OTPRequestRequestChannel2) => {
1142
1136
  OTPRequestRequestChannel2["EMAIL"] = "email";
1143
1137
  OTPRequestRequestChannel2["PHONE"] = "phone";
1144
1138
  return OTPRequestRequestChannel2;
1145
1139
  })(OTPRequestRequestChannel || {});
1146
- var OTPVerifyRequestChannel = /* @__PURE__ */ ((OTPVerifyRequestChannel2) => {
1147
- OTPVerifyRequestChannel2["EMAIL"] = "email";
1148
- OTPVerifyRequestChannel2["PHONE"] = "phone";
1149
- return OTPVerifyRequestChannel2;
1150
- })(OTPVerifyRequestChannel || {});
1151
1140
 
1152
1141
  // src/generated/cfg_accounts/_utils/schemas/AccountDeleteResponse.schema.ts
1153
1142
  var import_zod = require("zod");
@@ -1161,7 +1150,7 @@ var import_zod2 = require("zod");
1161
1150
  var CentrifugoTokenSchema = import_zod2.z.object({
1162
1151
  token: import_zod2.z.string(),
1163
1152
  centrifugo_url: import_zod2.z.union([import_zod2.z.url(), import_zod2.z.literal("")]),
1164
- expires_at: import_zod2.z.iso.datetime(),
1153
+ expires_at: import_zod2.z.string().datetime({ offset: true }),
1165
1154
  channels: import_zod2.z.array(import_zod2.z.string())
1166
1155
  });
1167
1156
 
@@ -1202,14 +1191,14 @@ var OAuthConnectionSchema = import_zod7.z.object({
1202
1191
  provider_username: import_zod7.z.string(),
1203
1192
  provider_email: import_zod7.z.email(),
1204
1193
  provider_avatar_url: import_zod7.z.union([import_zod7.z.url(), import_zod7.z.literal("")]),
1205
- connected_at: import_zod7.z.iso.datetime(),
1206
- last_login_at: import_zod7.z.iso.datetime()
1194
+ connected_at: import_zod7.z.string().datetime({ offset: true }),
1195
+ last_login_at: import_zod7.z.string().datetime({ offset: true })
1207
1196
  });
1208
1197
 
1209
1198
  // src/generated/cfg_accounts/_utils/schemas/OAuthDisconnectRequestRequest.schema.ts
1210
1199
  var import_zod8 = require("zod");
1211
1200
  var OAuthDisconnectRequestRequestSchema = import_zod8.z.object({
1212
- provider: import_zod8.z.nativeEnum(OAuthDisconnectRequestRequestProvider)
1201
+ provider: import_zod8.z.nativeEnum(OAuthConnectionProvider)
1213
1202
  });
1214
1203
 
1215
1204
  // src/generated/cfg_accounts/_utils/schemas/OAuthError.schema.ts
@@ -1263,7 +1252,7 @@ var import_zod15 = require("zod");
1263
1252
  var OTPVerifyRequestSchema = import_zod15.z.object({
1264
1253
  identifier: import_zod15.z.string().min(1),
1265
1254
  otp: import_zod15.z.string().min(6).max(6),
1266
- channel: import_zod15.z.nativeEnum(OTPVerifyRequestChannel).optional(),
1255
+ channel: import_zod15.z.nativeEnum(OTPRequestRequestChannel).optional(),
1267
1256
  source_url: import_zod15.z.union([import_zod15.z.url(), import_zod15.z.literal("")]).optional()
1268
1257
  });
1269
1258
 
@@ -1286,8 +1275,8 @@ var UserSchema = import_zod16.z.object({
1286
1275
  avatar: import_zod16.z.union([import_zod16.z.url(), import_zod16.z.literal("")]).nullable(),
1287
1276
  is_staff: import_zod16.z.boolean(),
1288
1277
  is_superuser: import_zod16.z.boolean(),
1289
- date_joined: import_zod16.z.iso.datetime(),
1290
- last_login: import_zod16.z.iso.datetime().nullable(),
1278
+ date_joined: import_zod16.z.string().datetime({ offset: true }),
1279
+ last_login: import_zod16.z.string().datetime({ offset: true }).nullable(),
1291
1280
  unanswered_messages_count: import_zod16.z.int(),
1292
1281
  centrifugo: CentrifugoTokenSchema.nullable()
1293
1282
  });
@@ -1951,7 +1940,7 @@ var CentrifugoMonitoring = class {
1951
1940
  if (isParamsObject) {
1952
1941
  params = args[0];
1953
1942
  } else {
1954
- params = { channel: args[0], page: args[1], page_size: args[2], status: args[3] };
1943
+ params = { channel: args[0], ordering: args[1], page: args[2], page_size: args[3], search: args[4], status: args[5] };
1955
1944
  }
1956
1945
  const response = await this.client.request("GET", "/cfg/centrifugo/monitor/publishes/", { params });
1957
1946
  return response;
@@ -2896,8 +2885,8 @@ var PublishSchema = import_zod51.z.object({
2896
2885
  acks_received: import_zod51.z.int(),
2897
2886
  acks_expected: import_zod51.z.int().nullable(),
2898
2887
  duration_ms: import_zod51.z.number().nullable(),
2899
- created_at: import_zod51.z.iso.datetime(),
2900
- completed_at: import_zod51.z.iso.datetime().nullable(),
2888
+ created_at: import_zod51.z.string().datetime({ offset: true }),
2889
+ completed_at: import_zod51.z.string().datetime({ offset: true }).nullable(),
2901
2890
  error_code: import_zod51.z.string().nullable(),
2902
2891
  error_message: import_zod51.z.string().nullable()
2903
2892
  });
@@ -3136,7 +3125,7 @@ var TotpManagement = class {
3136
3125
  if (isParamsObject) {
3137
3126
  params = args[0];
3138
3127
  } else {
3139
- params = { page: args[0], page_size: args[1] };
3128
+ params = { ordering: args[0], page: args[1], page_size: args[2], search: args[3] };
3140
3129
  }
3141
3130
  const response = await this.client.request("GET", "/cfg/totp/devices/", { params });
3142
3131
  return response;
@@ -3894,9 +3883,9 @@ var DeviceListSchema = import_zod62.z.object({
3894
3883
  name: import_zod62.z.string(),
3895
3884
  is_primary: import_zod62.z.boolean(),
3896
3885
  status: import_zod62.z.nativeEnum(DeviceListStatus),
3897
- created_at: import_zod62.z.iso.datetime(),
3898
- confirmed_at: import_zod62.z.iso.datetime().nullable(),
3899
- last_used_at: import_zod62.z.iso.datetime().nullable()
3886
+ created_at: import_zod62.z.string().datetime({ offset: true }),
3887
+ confirmed_at: import_zod62.z.string().datetime({ offset: true }).nullable(),
3888
+ last_used_at: import_zod62.z.string().datetime({ offset: true }).nullable()
3900
3889
  });
3901
3890
 
3902
3891
  // src/generated/cfg_totp/_utils/schemas/DeviceListResponse.schema.ts
@@ -3958,8 +3947,8 @@ var TotpVerifyUserSchema = import_zod68.z.object({
3958
3947
  avatar: import_zod68.z.union([import_zod68.z.url(), import_zod68.z.literal("")]).nullable(),
3959
3948
  is_staff: import_zod68.z.boolean(),
3960
3949
  is_superuser: import_zod68.z.boolean(),
3961
- date_joined: import_zod68.z.iso.datetime(),
3962
- last_login: import_zod68.z.iso.datetime().nullable(),
3950
+ date_joined: import_zod68.z.string().datetime({ offset: true }),
3951
+ last_login: import_zod68.z.string().datetime({ offset: true }).nullable(),
3963
3952
  unanswered_messages_count: import_zod68.z.int()
3964
3953
  });
3965
3954
 
@@ -6505,20 +6494,18 @@ function AccountsProvider({ children }) {
6505
6494
  const otpRequestMutation = useCreateAccountsOtpRequestCreate();
6506
6495
  const otpVerifyMutation = useCreateAccountsOtpVerifyCreate();
6507
6496
  const tokenRefreshMutation = useCreateAccountsTokenRefreshCreate();
6508
- const refreshProfile = (0, import_react16.useCallback)(async (callerId) => {
6509
- const currentProfile = profileRef.current;
6497
+ const refreshProfile = (0, import_react16.useCallback)(async (options) => {
6498
+ const { callerId, force } = options || {};
6510
6499
  const currentLoading = isLoadingRef.current;
6511
- if (currentProfile && !currentLoading) {
6512
- authLogger.debug(`Profile already loaded, returning cached (caller: ${callerId})`);
6513
- return currentProfile;
6500
+ if (currentLoading) {
6501
+ authLogger.debug(`Profile loading in progress, skipping (caller: ${callerId})`);
6502
+ return profileRef.current;
6514
6503
  }
6515
6504
  setIsLoadingProfile(true);
6516
6505
  isLoadingRef.current = true;
6517
6506
  setProfileError(null);
6518
6507
  try {
6519
- if (callerId) {
6520
- authLogger.debug(`Profile refresh called by: ${callerId}`);
6521
- }
6508
+ authLogger.debug(`Fetching profile from API (caller: ${callerId}, force: ${force})`);
6522
6509
  const result = await getAccountsProfileRetrieve(api);
6523
6510
  setProfile(result);
6524
6511
  profileRef.current = result;
@@ -6534,19 +6521,19 @@ function AccountsProvider({ children }) {
6534
6521
  }
6535
6522
  }, []);
6536
6523
  const updateProfile = /* @__PURE__ */ __name(async (data) => {
6537
- const result = await updateMutation(data, api);
6538
- await refreshProfile("AccountsContext.updateProfile");
6539
- return result;
6524
+ await updateMutation(data, api);
6525
+ const user = await refreshProfile({ callerId: "updateProfile", force: true });
6526
+ return user;
6540
6527
  }, "updateProfile");
6541
6528
  const partialUpdateProfile = /* @__PURE__ */ __name(async (data) => {
6542
- const result = await partialUpdateMutation(data, api);
6543
- await refreshProfile("AccountsContext.partialUpdateProfile");
6544
- return result;
6529
+ await partialUpdateMutation(data, api);
6530
+ const user = await refreshProfile({ callerId: "partialUpdateProfile", force: true });
6531
+ return user;
6545
6532
  }, "partialUpdateProfile");
6546
6533
  const uploadAvatar = /* @__PURE__ */ __name(async (avatar) => {
6547
- const result = await avatarMutation({ avatar }, api);
6548
- await refreshProfile("AccountsContext.uploadAvatar");
6549
- return result;
6534
+ await avatarMutation({ avatar }, api);
6535
+ const user = await refreshProfile({ callerId: "uploadAvatar", force: true });
6536
+ return user;
6550
6537
  }, "uploadAvatar");
6551
6538
  const requestOTP = /* @__PURE__ */ __name(async (data) => {
6552
6539
  const result = await otpRequestMutation(data, api);
@@ -6560,7 +6547,7 @@ function AccountsProvider({ children }) {
6560
6547
  }
6561
6548
  if (result.access && result.refresh) {
6562
6549
  api.setToken(result.access, result.refresh);
6563
- await refreshProfile("AccountsContext.verifyOTP");
6550
+ await refreshProfile({ callerId: "verifyOTP", force: true });
6564
6551
  }
6565
6552
  return result;
6566
6553
  }, "verifyOTP");
@@ -6693,7 +6680,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
6693
6680
  setInitialized(true);
6694
6681
  return;
6695
6682
  }
6696
- const refreshedProfile = await accounts.refreshProfile(finalCallerId);
6683
+ const refreshedProfile = await accounts.refreshProfile({ callerId: finalCallerId });
6697
6684
  if (refreshedProfile) {
6698
6685
  authLogger.info("Profile loaded successfully:", refreshedProfile.id);
6699
6686
  } else {