@djangocfg/api 2.1.192 → 2.1.193

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/index.cjs CHANGED
@@ -1241,6 +1241,7 @@ var UserSchema = import_zod16.z.object({
1241
1241
  company: import_zod16.z.string().max(100).optional(),
1242
1242
  phone: import_zod16.z.string().max(20).optional(),
1243
1243
  position: import_zod16.z.string().max(100).optional(),
1244
+ language: import_zod16.z.string().max(10).optional(),
1244
1245
  avatar: import_zod16.z.union([import_zod16.z.url(), import_zod16.z.literal("")]).nullable(),
1245
1246
  is_staff: import_zod16.z.boolean(),
1246
1247
  is_superuser: import_zod16.z.boolean(),
@@ -1267,7 +1268,8 @@ var PatchedUserProfileUpdateRequestSchema = import_zod18.z.object({
1267
1268
  last_name: import_zod18.z.string().max(50).optional(),
1268
1269
  company: import_zod18.z.string().max(100).optional(),
1269
1270
  phone: import_zod18.z.string().max(20).optional(),
1270
- position: import_zod18.z.string().max(100).optional()
1271
+ position: import_zod18.z.string().max(100).optional(),
1272
+ language: import_zod18.z.string().max(10).optional()
1271
1273
  });
1272
1274
 
1273
1275
  // src/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts
@@ -1290,7 +1292,8 @@ var UserProfileUpdateRequestSchema = import_zod21.z.object({
1290
1292
  last_name: import_zod21.z.string().max(50).optional(),
1291
1293
  company: import_zod21.z.string().max(100).optional(),
1292
1294
  phone: import_zod21.z.string().max(20).optional(),
1293
- position: import_zod21.z.string().max(100).optional()
1295
+ position: import_zod21.z.string().max(100).optional(),
1296
+ language: import_zod21.z.string().max(10).optional()
1294
1297
  });
1295
1298
 
1296
1299
  // src/generated/cfg_accounts/validation-events.ts
@@ -2011,14 +2014,30 @@ __name(partialUpdateAccountsProfileUpdatePartialUpdate, "partialUpdateAccountsPr
2011
2014
  // src/generated/cfg_accounts/index.ts
2012
2015
  var TOKEN_KEY = "auth_token";
2013
2016
  var REFRESH_TOKEN_KEY = "refresh_token";
2017
+ function detectLocale() {
2018
+ try {
2019
+ if (typeof document !== "undefined") {
2020
+ const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
2021
+ if (match) return match[1];
2022
+ }
2023
+ if (typeof navigator !== "undefined" && navigator.language) {
2024
+ return navigator.language;
2025
+ }
2026
+ } catch {
2027
+ }
2028
+ return null;
2029
+ }
2030
+ __name(detectLocale, "detectLocale");
2014
2031
  var API = class {
2015
2032
  constructor(baseUrl, options) {
2016
2033
  this._token = null;
2017
2034
  this._refreshToken = null;
2035
+ this._locale = null;
2018
2036
  this.baseUrl = baseUrl;
2019
2037
  this.options = options;
2020
2038
  const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : void 0;
2021
2039
  this.storage = options?.storage || new LocalStorageAdapter(logger);
2040
+ this._locale = options?.locale || null;
2022
2041
  this._loadTokensFromStorage();
2023
2042
  this._client = new APIClient(this.baseUrl, {
2024
2043
  retryConfig: this.options?.retryConfig,
@@ -2054,11 +2073,13 @@ var API = class {
2054
2073
  const originalRequest = this._client.request.bind(this._client);
2055
2074
  this._client.request = async (method, path, options) => {
2056
2075
  const token = this.getToken();
2076
+ const locale = this._locale || detectLocale();
2057
2077
  const mergedOptions = {
2058
2078
  ...options,
2059
2079
  headers: {
2060
2080
  ...options?.headers || {},
2061
- ...token ? { "Authorization": `Bearer ${token}` } : {}
2081
+ ...token ? { "Authorization": `Bearer ${token}` } : {},
2082
+ ...locale ? { "Accept-Language": locale } : {}
2062
2083
  }
2063
2084
  };
2064
2085
  return originalRequest(method, path, mergedOptions);
@@ -2120,6 +2141,19 @@ var API = class {
2120
2141
  getBaseUrl() {
2121
2142
  return this.baseUrl;
2122
2143
  }
2144
+ /**
2145
+ * Set locale for Accept-Language header
2146
+ * @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
2147
+ */
2148
+ setLocale(locale) {
2149
+ this._locale = locale;
2150
+ }
2151
+ /**
2152
+ * Get current locale
2153
+ */
2154
+ getLocale() {
2155
+ return this._locale;
2156
+ }
2123
2157
  /**
2124
2158
  * Get OpenAPI schema path
2125
2159
  * @returns Path to the OpenAPI schema JSON file
@@ -3370,14 +3404,30 @@ var import_consola10 = require("consola");
3370
3404
  // src/generated/cfg_centrifugo/index.ts
3371
3405
  var TOKEN_KEY2 = "auth_token";
3372
3406
  var REFRESH_TOKEN_KEY2 = "refresh_token";
3407
+ function detectLocale2() {
3408
+ try {
3409
+ if (typeof document !== "undefined") {
3410
+ const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
3411
+ if (match) return match[1];
3412
+ }
3413
+ if (typeof navigator !== "undefined" && navigator.language) {
3414
+ return navigator.language;
3415
+ }
3416
+ } catch {
3417
+ }
3418
+ return null;
3419
+ }
3420
+ __name(detectLocale2, "detectLocale");
3373
3421
  var API2 = class {
3374
3422
  constructor(baseUrl, options) {
3375
3423
  this._token = null;
3376
3424
  this._refreshToken = null;
3425
+ this._locale = null;
3377
3426
  this.baseUrl = baseUrl;
3378
3427
  this.options = options;
3379
3428
  const logger = options?.loggerConfig ? new APILogger2(options.loggerConfig) : void 0;
3380
3429
  this.storage = options?.storage || new LocalStorageAdapter2(logger);
3430
+ this._locale = options?.locale || null;
3381
3431
  this._loadTokensFromStorage();
3382
3432
  this._client = new APIClient2(this.baseUrl, {
3383
3433
  retryConfig: this.options?.retryConfig,
@@ -3413,11 +3463,13 @@ var API2 = class {
3413
3463
  const originalRequest = this._client.request.bind(this._client);
3414
3464
  this._client.request = async (method, path, options) => {
3415
3465
  const token = this.getToken();
3466
+ const locale = this._locale || detectLocale2();
3416
3467
  const mergedOptions = {
3417
3468
  ...options,
3418
3469
  headers: {
3419
3470
  ...options?.headers || {},
3420
- ...token ? { "Authorization": `Bearer ${token}` } : {}
3471
+ ...token ? { "Authorization": `Bearer ${token}` } : {},
3472
+ ...locale ? { "Accept-Language": locale } : {}
3421
3473
  }
3422
3474
  };
3423
3475
  return originalRequest(method, path, mergedOptions);
@@ -3479,6 +3531,19 @@ var API2 = class {
3479
3531
  getBaseUrl() {
3480
3532
  return this.baseUrl;
3481
3533
  }
3534
+ /**
3535
+ * Set locale for Accept-Language header
3536
+ * @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
3537
+ */
3538
+ setLocale(locale) {
3539
+ this._locale = locale;
3540
+ }
3541
+ /**
3542
+ * Get current locale
3543
+ */
3544
+ getLocale() {
3545
+ return this._locale;
3546
+ }
3482
3547
  /**
3483
3548
  * Get OpenAPI schema path
3484
3549
  * @returns Path to the OpenAPI schema JSON file