@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.
- package/dist/auth-server.cjs +37 -3
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +37 -3
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +102 -5
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +4 -0
- package/dist/auth.d.ts +4 -0
- package/dist/auth.mjs +102 -5
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +107 -10
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +47 -0
- package/dist/clients.d.ts +47 -0
- package/dist/clients.mjs +107 -10
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +37 -3
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +20 -0
- package/dist/hooks.d.ts +20 -0
- package/dist/hooks.mjs +37 -3
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +69 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.mjs +69 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/generated/cfg_accounts/_utils/fetchers/accounts.ts +1 -0
- package/src/generated/cfg_accounts/_utils/fetchers/accounts__auth.ts +1 -0
- package/src/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +1 -0
- package/src/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts +1 -0
- package/src/generated/cfg_accounts/_utils/fetchers/index.ts +1 -0
- package/src/generated/cfg_accounts/_utils/hooks/accounts.ts +1 -0
- package/src/generated/cfg_accounts/_utils/hooks/accounts__auth.ts +1 -0
- package/src/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +1 -0
- package/src/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts +1 -0
- package/src/generated/cfg_accounts/_utils/hooks/index.ts +1 -0
- package/src/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts +1 -0
- package/src/generated/cfg_accounts/_utils/schemas/User.schema.ts +1 -0
- package/src/generated/cfg_accounts/_utils/schemas/UserProfileUpdateRequest.schema.ts +1 -0
- package/src/generated/cfg_accounts/_utils/schemas/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts/client.ts +1 -0
- package/src/generated/cfg_accounts/accounts/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts/models.ts +2 -0
- package/src/generated/cfg_accounts/accounts__auth/client.ts +1 -0
- package/src/generated/cfg_accounts/accounts__auth/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts__auth/models.ts +1 -0
- package/src/generated/cfg_accounts/accounts__oauth/client.ts +1 -0
- package/src/generated/cfg_accounts/accounts__oauth/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts__oauth/models.ts +1 -0
- package/src/generated/cfg_accounts/accounts__user_profile/client.ts +1 -0
- package/src/generated/cfg_accounts/accounts__user_profile/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts__user_profile/models.ts +4 -0
- package/src/generated/cfg_accounts/api-instance.ts +1 -0
- package/src/generated/cfg_accounts/enums.ts +1 -0
- package/src/generated/cfg_accounts/errors.ts +1 -0
- package/src/generated/cfg_accounts/http.ts +1 -0
- package/src/generated/cfg_accounts/index.ts +37 -0
- package/src/generated/cfg_accounts/logger.ts +1 -0
- package/src/generated/cfg_accounts/retry.ts +1 -0
- package/src/generated/cfg_accounts/schema.json +12 -0
- package/src/generated/cfg_accounts/storage.ts +1 -0
- package/src/generated/cfg_accounts/validation-events.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/fetchers/index.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_admin_api.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts +5 -4
- package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_testing.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/hooks/index.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/schemas/index.ts +1 -0
- package/src/generated/cfg_centrifugo/api-instance.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/client.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/index.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/models.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/client.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/index.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/models.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/client.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/index.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/models.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/client.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/index.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/models.ts +1 -0
- package/src/generated/cfg_centrifugo/errors.ts +1 -0
- package/src/generated/cfg_centrifugo/http.ts +1 -0
- package/src/generated/cfg_centrifugo/index.ts +37 -0
- package/src/generated/cfg_centrifugo/logger.ts +1 -0
- package/src/generated/cfg_centrifugo/retry.ts +1 -0
- package/src/generated/cfg_centrifugo/storage.ts +1 -0
- package/src/generated/cfg_centrifugo/validation-events.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/index.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__totp_setup.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__totp_verification.ts +1 -0
- package/src/generated/cfg_totp/_utils/hooks/index.ts +1 -0
- package/src/generated/cfg_totp/_utils/hooks/totp.ts +1 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts +1 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +2 -1
- package/src/generated/cfg_totp/_utils/hooks/totp__totp_setup.ts +1 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__totp_verification.ts +1 -0
- package/src/generated/cfg_totp/_utils/schemas/TotpVerifyUser.schema.ts +1 -0
- package/src/generated/cfg_totp/_utils/schemas/index.ts +1 -0
- package/src/generated/cfg_totp/api-instance.ts +1 -0
- package/src/generated/cfg_totp/enums.ts +1 -0
- package/src/generated/cfg_totp/errors.ts +1 -0
- package/src/generated/cfg_totp/http.ts +1 -0
- package/src/generated/cfg_totp/index.ts +37 -0
- package/src/generated/cfg_totp/logger.ts +1 -0
- package/src/generated/cfg_totp/retry.ts +1 -0
- package/src/generated/cfg_totp/schema.json +4 -0
- package/src/generated/cfg_totp/storage.ts +1 -0
- package/src/generated/cfg_totp/totp/client.ts +1 -0
- package/src/generated/cfg_totp/totp/index.ts +1 -0
- package/src/generated/cfg_totp/totp/models.ts +1 -0
- package/src/generated/cfg_totp/totp__backup_codes/client.ts +1 -0
- package/src/generated/cfg_totp/totp__backup_codes/index.ts +1 -0
- package/src/generated/cfg_totp/totp__backup_codes/models.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_management/client.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_management/index.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_management/models.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_setup/client.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_setup/index.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_setup/models.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_verification/client.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_verification/index.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_verification/models.ts +2 -0
- package/src/generated/cfg_totp/validation-events.ts +1 -0
package/dist/hooks.cjs
CHANGED
|
@@ -1013,6 +1013,7 @@ var UserSchema = import_zod17.z.object({
|
|
|
1013
1013
|
company: import_zod17.z.string().max(100).optional(),
|
|
1014
1014
|
phone: import_zod17.z.string().max(20).optional(),
|
|
1015
1015
|
position: import_zod17.z.string().max(100).optional(),
|
|
1016
|
+
language: import_zod17.z.string().max(10).optional(),
|
|
1016
1017
|
avatar: import_zod17.z.union([import_zod17.z.url(), import_zod17.z.literal("")]).nullable(),
|
|
1017
1018
|
is_staff: import_zod17.z.boolean(),
|
|
1018
1019
|
is_superuser: import_zod17.z.boolean(),
|
|
@@ -1039,7 +1040,8 @@ var PatchedUserProfileUpdateRequestSchema = import_zod19.z.object({
|
|
|
1039
1040
|
last_name: import_zod19.z.string().max(50).optional(),
|
|
1040
1041
|
company: import_zod19.z.string().max(100).optional(),
|
|
1041
1042
|
phone: import_zod19.z.string().max(20).optional(),
|
|
1042
|
-
position: import_zod19.z.string().max(100).optional()
|
|
1043
|
+
position: import_zod19.z.string().max(100).optional(),
|
|
1044
|
+
language: import_zod19.z.string().max(10).optional()
|
|
1043
1045
|
});
|
|
1044
1046
|
|
|
1045
1047
|
// src/generated/cfg_accounts/_utils/schemas/TokenRefreshRequest.schema.ts
|
|
@@ -1055,7 +1057,8 @@ var UserProfileUpdateRequestSchema = import_zod21.z.object({
|
|
|
1055
1057
|
last_name: import_zod21.z.string().max(50).optional(),
|
|
1056
1058
|
company: import_zod21.z.string().max(100).optional(),
|
|
1057
1059
|
phone: import_zod21.z.string().max(20).optional(),
|
|
1058
|
-
position: import_zod21.z.string().max(100).optional()
|
|
1060
|
+
position: import_zod21.z.string().max(100).optional(),
|
|
1061
|
+
language: import_zod21.z.string().max(10).optional()
|
|
1059
1062
|
});
|
|
1060
1063
|
|
|
1061
1064
|
// src/generated/cfg_accounts/_utils/fetchers/accounts.ts
|
|
@@ -1598,14 +1601,30 @@ __name(partialUpdateAccountsProfileUpdatePartialUpdate, "partialUpdateAccountsPr
|
|
|
1598
1601
|
// src/generated/cfg_accounts/index.ts
|
|
1599
1602
|
var TOKEN_KEY = "auth_token";
|
|
1600
1603
|
var REFRESH_TOKEN_KEY = "refresh_token";
|
|
1604
|
+
function detectLocale() {
|
|
1605
|
+
try {
|
|
1606
|
+
if (typeof document !== "undefined") {
|
|
1607
|
+
const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
1608
|
+
if (match) return match[1];
|
|
1609
|
+
}
|
|
1610
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1611
|
+
return navigator.language;
|
|
1612
|
+
}
|
|
1613
|
+
} catch {
|
|
1614
|
+
}
|
|
1615
|
+
return null;
|
|
1616
|
+
}
|
|
1617
|
+
__name(detectLocale, "detectLocale");
|
|
1601
1618
|
var API = class {
|
|
1602
1619
|
constructor(baseUrl, options) {
|
|
1603
1620
|
this._token = null;
|
|
1604
1621
|
this._refreshToken = null;
|
|
1622
|
+
this._locale = null;
|
|
1605
1623
|
this.baseUrl = baseUrl;
|
|
1606
1624
|
this.options = options;
|
|
1607
1625
|
const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : void 0;
|
|
1608
1626
|
this.storage = options?.storage || new LocalStorageAdapter(logger);
|
|
1627
|
+
this._locale = options?.locale || null;
|
|
1609
1628
|
this._loadTokensFromStorage();
|
|
1610
1629
|
this._client = new APIClient(this.baseUrl, {
|
|
1611
1630
|
retryConfig: this.options?.retryConfig,
|
|
@@ -1641,11 +1660,13 @@ var API = class {
|
|
|
1641
1660
|
const originalRequest = this._client.request.bind(this._client);
|
|
1642
1661
|
this._client.request = async (method, path, options) => {
|
|
1643
1662
|
const token = this.getToken();
|
|
1663
|
+
const locale = this._locale || detectLocale();
|
|
1644
1664
|
const mergedOptions = {
|
|
1645
1665
|
...options,
|
|
1646
1666
|
headers: {
|
|
1647
1667
|
...options?.headers || {},
|
|
1648
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
1668
|
+
...token ? { "Authorization": `Bearer ${token}` } : {},
|
|
1669
|
+
...locale ? { "Accept-Language": locale } : {}
|
|
1649
1670
|
}
|
|
1650
1671
|
};
|
|
1651
1672
|
return originalRequest(method, path, mergedOptions);
|
|
@@ -1707,6 +1728,19 @@ var API = class {
|
|
|
1707
1728
|
getBaseUrl() {
|
|
1708
1729
|
return this.baseUrl;
|
|
1709
1730
|
}
|
|
1731
|
+
/**
|
|
1732
|
+
* Set locale for Accept-Language header
|
|
1733
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
1734
|
+
*/
|
|
1735
|
+
setLocale(locale) {
|
|
1736
|
+
this._locale = locale;
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Get current locale
|
|
1740
|
+
*/
|
|
1741
|
+
getLocale() {
|
|
1742
|
+
return this._locale;
|
|
1743
|
+
}
|
|
1710
1744
|
/**
|
|
1711
1745
|
* Get OpenAPI schema path
|
|
1712
1746
|
* @returns Path to the OpenAPI schema JSON file
|