@djangocfg/api 2.1.192 → 2.1.194

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 (135) hide show
  1. package/dist/auth-server.cjs +37 -3
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +37 -3
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +102 -5
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.d.cts +4 -0
  8. package/dist/auth.d.ts +4 -0
  9. package/dist/auth.mjs +102 -5
  10. package/dist/auth.mjs.map +1 -1
  11. package/dist/clients.cjs +107 -10
  12. package/dist/clients.cjs.map +1 -1
  13. package/dist/clients.d.cts +47 -0
  14. package/dist/clients.d.ts +47 -0
  15. package/dist/clients.mjs +107 -10
  16. package/dist/clients.mjs.map +1 -1
  17. package/dist/hooks.cjs +37 -3
  18. package/dist/hooks.cjs.map +1 -1
  19. package/dist/hooks.d.cts +20 -0
  20. package/dist/hooks.d.ts +20 -0
  21. package/dist/hooks.mjs +37 -3
  22. package/dist/hooks.mjs.map +1 -1
  23. package/dist/index.cjs +69 -4
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +20 -0
  26. package/dist/index.d.ts +20 -0
  27. package/dist/index.mjs +69 -4
  28. package/dist/index.mjs.map +1 -1
  29. package/package.json +2 -2
  30. package/src/generated/cfg_accounts/_utils/fetchers/accounts.ts +1 -0
  31. package/src/generated/cfg_accounts/_utils/fetchers/accounts__auth.ts +1 -0
  32. package/src/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +1 -0
  33. package/src/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts +1 -0
  34. package/src/generated/cfg_accounts/_utils/fetchers/index.ts +1 -0
  35. package/src/generated/cfg_accounts/_utils/hooks/accounts.ts +1 -0
  36. package/src/generated/cfg_accounts/_utils/hooks/accounts__auth.ts +1 -0
  37. package/src/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +1 -0
  38. package/src/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts +1 -0
  39. package/src/generated/cfg_accounts/_utils/hooks/index.ts +1 -0
  40. package/src/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts +1 -0
  41. package/src/generated/cfg_accounts/_utils/schemas/User.schema.ts +1 -0
  42. package/src/generated/cfg_accounts/_utils/schemas/UserProfileUpdateRequest.schema.ts +1 -0
  43. package/src/generated/cfg_accounts/_utils/schemas/index.ts +1 -0
  44. package/src/generated/cfg_accounts/accounts/client.ts +1 -0
  45. package/src/generated/cfg_accounts/accounts/index.ts +1 -0
  46. package/src/generated/cfg_accounts/accounts/models.ts +2 -0
  47. package/src/generated/cfg_accounts/accounts__auth/client.ts +1 -0
  48. package/src/generated/cfg_accounts/accounts__auth/index.ts +1 -0
  49. package/src/generated/cfg_accounts/accounts__auth/models.ts +1 -0
  50. package/src/generated/cfg_accounts/accounts__oauth/client.ts +1 -0
  51. package/src/generated/cfg_accounts/accounts__oauth/index.ts +1 -0
  52. package/src/generated/cfg_accounts/accounts__oauth/models.ts +1 -0
  53. package/src/generated/cfg_accounts/accounts__user_profile/client.ts +1 -0
  54. package/src/generated/cfg_accounts/accounts__user_profile/index.ts +1 -0
  55. package/src/generated/cfg_accounts/accounts__user_profile/models.ts +4 -0
  56. package/src/generated/cfg_accounts/api-instance.ts +1 -0
  57. package/src/generated/cfg_accounts/enums.ts +1 -0
  58. package/src/generated/cfg_accounts/errors.ts +1 -0
  59. package/src/generated/cfg_accounts/http.ts +1 -0
  60. package/src/generated/cfg_accounts/index.ts +37 -0
  61. package/src/generated/cfg_accounts/logger.ts +1 -0
  62. package/src/generated/cfg_accounts/retry.ts +1 -0
  63. package/src/generated/cfg_accounts/schema.json +12 -0
  64. package/src/generated/cfg_accounts/storage.ts +1 -0
  65. package/src/generated/cfg_accounts/validation-events.ts +1 -0
  66. package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts +1 -0
  67. package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts +1 -0
  68. package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts +1 -0
  69. package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts +1 -0
  70. package/src/generated/cfg_centrifugo/_utils/fetchers/index.ts +1 -0
  71. package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_admin_api.ts +1 -0
  72. package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts +1 -0
  73. package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts +5 -4
  74. package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_testing.ts +1 -0
  75. package/src/generated/cfg_centrifugo/_utils/hooks/index.ts +1 -0
  76. package/src/generated/cfg_centrifugo/_utils/schemas/index.ts +1 -0
  77. package/src/generated/cfg_centrifugo/api-instance.ts +1 -0
  78. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/client.ts +1 -0
  79. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/index.ts +1 -0
  80. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/models.ts +1 -0
  81. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/client.ts +1 -0
  82. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/index.ts +1 -0
  83. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/models.ts +1 -0
  84. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/client.ts +1 -0
  85. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/index.ts +1 -0
  86. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/models.ts +1 -0
  87. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/client.ts +1 -0
  88. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/index.ts +1 -0
  89. package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/models.ts +1 -0
  90. package/src/generated/cfg_centrifugo/errors.ts +1 -0
  91. package/src/generated/cfg_centrifugo/http.ts +1 -0
  92. package/src/generated/cfg_centrifugo/index.ts +37 -0
  93. package/src/generated/cfg_centrifugo/logger.ts +1 -0
  94. package/src/generated/cfg_centrifugo/retry.ts +1 -0
  95. package/src/generated/cfg_centrifugo/storage.ts +1 -0
  96. package/src/generated/cfg_centrifugo/validation-events.ts +1 -0
  97. package/src/generated/cfg_totp/_utils/fetchers/index.ts +1 -0
  98. package/src/generated/cfg_totp/_utils/fetchers/totp.ts +1 -0
  99. package/src/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts +1 -0
  100. package/src/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +1 -0
  101. package/src/generated/cfg_totp/_utils/fetchers/totp__totp_setup.ts +1 -0
  102. package/src/generated/cfg_totp/_utils/fetchers/totp__totp_verification.ts +1 -0
  103. package/src/generated/cfg_totp/_utils/hooks/index.ts +1 -0
  104. package/src/generated/cfg_totp/_utils/hooks/totp.ts +1 -0
  105. package/src/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts +1 -0
  106. package/src/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +2 -1
  107. package/src/generated/cfg_totp/_utils/hooks/totp__totp_setup.ts +1 -0
  108. package/src/generated/cfg_totp/_utils/hooks/totp__totp_verification.ts +1 -0
  109. package/src/generated/cfg_totp/_utils/schemas/TotpVerifyUser.schema.ts +1 -0
  110. package/src/generated/cfg_totp/_utils/schemas/index.ts +1 -0
  111. package/src/generated/cfg_totp/api-instance.ts +1 -0
  112. package/src/generated/cfg_totp/enums.ts +1 -0
  113. package/src/generated/cfg_totp/errors.ts +1 -0
  114. package/src/generated/cfg_totp/http.ts +1 -0
  115. package/src/generated/cfg_totp/index.ts +37 -0
  116. package/src/generated/cfg_totp/logger.ts +1 -0
  117. package/src/generated/cfg_totp/retry.ts +1 -0
  118. package/src/generated/cfg_totp/schema.json +4 -0
  119. package/src/generated/cfg_totp/storage.ts +1 -0
  120. package/src/generated/cfg_totp/totp/client.ts +1 -0
  121. package/src/generated/cfg_totp/totp/index.ts +1 -0
  122. package/src/generated/cfg_totp/totp/models.ts +1 -0
  123. package/src/generated/cfg_totp/totp__backup_codes/client.ts +1 -0
  124. package/src/generated/cfg_totp/totp__backup_codes/index.ts +1 -0
  125. package/src/generated/cfg_totp/totp__backup_codes/models.ts +1 -0
  126. package/src/generated/cfg_totp/totp__totp_management/client.ts +1 -0
  127. package/src/generated/cfg_totp/totp__totp_management/index.ts +1 -0
  128. package/src/generated/cfg_totp/totp__totp_management/models.ts +1 -0
  129. package/src/generated/cfg_totp/totp__totp_setup/client.ts +1 -0
  130. package/src/generated/cfg_totp/totp__totp_setup/index.ts +1 -0
  131. package/src/generated/cfg_totp/totp__totp_setup/models.ts +1 -0
  132. package/src/generated/cfg_totp/totp__totp_verification/client.ts +1 -0
  133. package/src/generated/cfg_totp/totp__totp_verification/index.ts +1 -0
  134. package/src/generated/cfg_totp/totp__totp_verification/models.ts +2 -0
  135. package/src/generated/cfg_totp/validation-events.ts +1 -0
package/dist/auth.cjs CHANGED
@@ -1273,6 +1273,7 @@ var UserSchema = import_zod16.z.object({
1273
1273
  company: import_zod16.z.string().max(100).optional(),
1274
1274
  phone: import_zod16.z.string().max(20).optional(),
1275
1275
  position: import_zod16.z.string().max(100).optional(),
1276
+ language: import_zod16.z.string().max(10).optional(),
1276
1277
  avatar: import_zod16.z.union([import_zod16.z.url(), import_zod16.z.literal("")]).nullable(),
1277
1278
  is_staff: import_zod16.z.boolean(),
1278
1279
  is_superuser: import_zod16.z.boolean(),
@@ -1299,7 +1300,8 @@ var PatchedUserProfileUpdateRequestSchema = import_zod18.z.object({
1299
1300
  last_name: import_zod18.z.string().max(50).optional(),
1300
1301
  company: import_zod18.z.string().max(100).optional(),
1301
1302
  phone: import_zod18.z.string().max(20).optional(),
1302
- position: import_zod18.z.string().max(100).optional()
1303
+ position: import_zod18.z.string().max(100).optional(),
1304
+ language: import_zod18.z.string().max(10).optional()
1303
1305
  });
1304
1306
 
1305
1307
  // src/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts
@@ -1322,7 +1324,8 @@ var UserProfileUpdateRequestSchema = import_zod21.z.object({
1322
1324
  last_name: import_zod21.z.string().max(50).optional(),
1323
1325
  company: import_zod21.z.string().max(100).optional(),
1324
1326
  phone: import_zod21.z.string().max(20).optional(),
1325
- position: import_zod21.z.string().max(100).optional()
1327
+ position: import_zod21.z.string().max(100).optional(),
1328
+ language: import_zod21.z.string().max(10).optional()
1326
1329
  });
1327
1330
 
1328
1331
  // src/generated/cfg_accounts/_utils/fetchers/accounts.ts
@@ -1668,14 +1671,30 @@ __name(updateAccountsProfileUpdateUpdate, "updateAccountsProfileUpdateUpdate");
1668
1671
  // src/generated/cfg_accounts/index.ts
1669
1672
  var TOKEN_KEY = "auth_token";
1670
1673
  var REFRESH_TOKEN_KEY = "refresh_token";
1674
+ function detectLocale() {
1675
+ try {
1676
+ if (typeof document !== "undefined") {
1677
+ const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
1678
+ if (match) return match[1];
1679
+ }
1680
+ if (typeof navigator !== "undefined" && navigator.language) {
1681
+ return navigator.language;
1682
+ }
1683
+ } catch {
1684
+ }
1685
+ return null;
1686
+ }
1687
+ __name(detectLocale, "detectLocale");
1671
1688
  var API = class {
1672
1689
  constructor(baseUrl, options) {
1673
1690
  this._token = null;
1674
1691
  this._refreshToken = null;
1692
+ this._locale = null;
1675
1693
  this.baseUrl = baseUrl;
1676
1694
  this.options = options;
1677
1695
  const logger2 = options?.loggerConfig ? new APILogger(options.loggerConfig) : void 0;
1678
1696
  this.storage = options?.storage || new LocalStorageAdapter(logger2);
1697
+ this._locale = options?.locale || null;
1679
1698
  this._loadTokensFromStorage();
1680
1699
  this._client = new APIClient(this.baseUrl, {
1681
1700
  retryConfig: this.options?.retryConfig,
@@ -1711,11 +1730,13 @@ var API = class {
1711
1730
  const originalRequest = this._client.request.bind(this._client);
1712
1731
  this._client.request = async (method, path, options) => {
1713
1732
  const token = this.getToken();
1733
+ const locale = this._locale || detectLocale();
1714
1734
  const mergedOptions = {
1715
1735
  ...options,
1716
1736
  headers: {
1717
1737
  ...options?.headers || {},
1718
- ...token ? { "Authorization": `Bearer ${token}` } : {}
1738
+ ...token ? { "Authorization": `Bearer ${token}` } : {},
1739
+ ...locale ? { "Accept-Language": locale } : {}
1719
1740
  }
1720
1741
  };
1721
1742
  return originalRequest(method, path, mergedOptions);
@@ -1777,6 +1798,19 @@ var API = class {
1777
1798
  getBaseUrl() {
1778
1799
  return this.baseUrl;
1779
1800
  }
1801
+ /**
1802
+ * Set locale for Accept-Language header
1803
+ * @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
1804
+ */
1805
+ setLocale(locale) {
1806
+ this._locale = locale;
1807
+ }
1808
+ /**
1809
+ * Get current locale
1810
+ */
1811
+ getLocale() {
1812
+ return this._locale;
1813
+ }
1780
1814
  /**
1781
1815
  * Get OpenAPI schema path
1782
1816
  * @returns Path to the OpenAPI schema JSON file
@@ -2958,14 +2992,30 @@ var import_consola11 = require("consola");
2958
2992
  // src/generated/cfg_centrifugo/index.ts
2959
2993
  var TOKEN_KEY2 = "auth_token";
2960
2994
  var REFRESH_TOKEN_KEY2 = "refresh_token";
2995
+ function detectLocale2() {
2996
+ try {
2997
+ if (typeof document !== "undefined") {
2998
+ const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
2999
+ if (match) return match[1];
3000
+ }
3001
+ if (typeof navigator !== "undefined" && navigator.language) {
3002
+ return navigator.language;
3003
+ }
3004
+ } catch {
3005
+ }
3006
+ return null;
3007
+ }
3008
+ __name(detectLocale2, "detectLocale");
2961
3009
  var API2 = class {
2962
3010
  constructor(baseUrl, options) {
2963
3011
  this._token = null;
2964
3012
  this._refreshToken = null;
3013
+ this._locale = null;
2965
3014
  this.baseUrl = baseUrl;
2966
3015
  this.options = options;
2967
3016
  const logger2 = options?.loggerConfig ? new APILogger2(options.loggerConfig) : void 0;
2968
3017
  this.storage = options?.storage || new LocalStorageAdapter2(logger2);
3018
+ this._locale = options?.locale || null;
2969
3019
  this._loadTokensFromStorage();
2970
3020
  this._client = new APIClient2(this.baseUrl, {
2971
3021
  retryConfig: this.options?.retryConfig,
@@ -3001,11 +3051,13 @@ var API2 = class {
3001
3051
  const originalRequest = this._client.request.bind(this._client);
3002
3052
  this._client.request = async (method, path, options) => {
3003
3053
  const token = this.getToken();
3054
+ const locale = this._locale || detectLocale2();
3004
3055
  const mergedOptions = {
3005
3056
  ...options,
3006
3057
  headers: {
3007
3058
  ...options?.headers || {},
3008
- ...token ? { "Authorization": `Bearer ${token}` } : {}
3059
+ ...token ? { "Authorization": `Bearer ${token}` } : {},
3060
+ ...locale ? { "Accept-Language": locale } : {}
3009
3061
  }
3010
3062
  };
3011
3063
  return originalRequest(method, path, mergedOptions);
@@ -3067,6 +3119,19 @@ var API2 = class {
3067
3119
  getBaseUrl() {
3068
3120
  return this.baseUrl;
3069
3121
  }
3122
+ /**
3123
+ * Set locale for Accept-Language header
3124
+ * @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
3125
+ */
3126
+ setLocale(locale) {
3127
+ this._locale = locale;
3128
+ }
3129
+ /**
3130
+ * Get current locale
3131
+ */
3132
+ getLocale() {
3133
+ return this._locale;
3134
+ }
3070
3135
  /**
3071
3136
  * Get OpenAPI schema path
3072
3137
  * @returns Path to the OpenAPI schema JSON file
@@ -3945,6 +4010,7 @@ var TotpVerifyUserSchema = import_zod68.z.object({
3945
4010
  company: import_zod68.z.string().max(100).optional(),
3946
4011
  phone: import_zod68.z.string().max(20).optional(),
3947
4012
  position: import_zod68.z.string().max(100).optional(),
4013
+ language: import_zod68.z.string().max(10).optional(),
3948
4014
  avatar: import_zod68.z.union([import_zod68.z.url(), import_zod68.z.literal("")]).nullable(),
3949
4015
  is_staff: import_zod68.z.boolean(),
3950
4016
  is_superuser: import_zod68.z.boolean(),
@@ -3993,14 +4059,30 @@ var import_consola16 = require("consola");
3993
4059
  // src/generated/cfg_totp/index.ts
3994
4060
  var TOKEN_KEY3 = "auth_token";
3995
4061
  var REFRESH_TOKEN_KEY3 = "refresh_token";
4062
+ function detectLocale3() {
4063
+ try {
4064
+ if (typeof document !== "undefined") {
4065
+ const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
4066
+ if (match) return match[1];
4067
+ }
4068
+ if (typeof navigator !== "undefined" && navigator.language) {
4069
+ return navigator.language;
4070
+ }
4071
+ } catch {
4072
+ }
4073
+ return null;
4074
+ }
4075
+ __name(detectLocale3, "detectLocale");
3996
4076
  var API3 = class {
3997
4077
  constructor(baseUrl, options) {
3998
4078
  this._token = null;
3999
4079
  this._refreshToken = null;
4080
+ this._locale = null;
4000
4081
  this.baseUrl = baseUrl;
4001
4082
  this.options = options;
4002
4083
  const logger2 = options?.loggerConfig ? new APILogger3(options.loggerConfig) : void 0;
4003
4084
  this.storage = options?.storage || new LocalStorageAdapter3(logger2);
4085
+ this._locale = options?.locale || null;
4004
4086
  this._loadTokensFromStorage();
4005
4087
  this._client = new APIClient3(this.baseUrl, {
4006
4088
  retryConfig: this.options?.retryConfig,
@@ -4038,11 +4120,13 @@ var API3 = class {
4038
4120
  const originalRequest = this._client.request.bind(this._client);
4039
4121
  this._client.request = async (method, path, options) => {
4040
4122
  const token = this.getToken();
4123
+ const locale = this._locale || detectLocale3();
4041
4124
  const mergedOptions = {
4042
4125
  ...options,
4043
4126
  headers: {
4044
4127
  ...options?.headers || {},
4045
- ...token ? { "Authorization": `Bearer ${token}` } : {}
4128
+ ...token ? { "Authorization": `Bearer ${token}` } : {},
4129
+ ...locale ? { "Accept-Language": locale } : {}
4046
4130
  }
4047
4131
  };
4048
4132
  return originalRequest(method, path, mergedOptions);
@@ -4104,6 +4188,19 @@ var API3 = class {
4104
4188
  getBaseUrl() {
4105
4189
  return this.baseUrl;
4106
4190
  }
4191
+ /**
4192
+ * Set locale for Accept-Language header
4193
+ * @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
4194
+ */
4195
+ setLocale(locale) {
4196
+ this._locale = locale;
4197
+ }
4198
+ /**
4199
+ * Get current locale
4200
+ */
4201
+ getLocale() {
4202
+ return this._locale;
4203
+ }
4107
4204
  /**
4108
4205
  * Get OpenAPI schema path
4109
4206
  * @returns Path to the OpenAPI schema JSON file