@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.
- 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/auth-server.mjs
CHANGED
|
@@ -971,6 +971,7 @@ var UserSchema = z16.object({
|
|
|
971
971
|
company: z16.string().max(100).optional(),
|
|
972
972
|
phone: z16.string().max(20).optional(),
|
|
973
973
|
position: z16.string().max(100).optional(),
|
|
974
|
+
language: z16.string().max(10).optional(),
|
|
974
975
|
avatar: z16.union([z16.url(), z16.literal("")]).nullable(),
|
|
975
976
|
is_staff: z16.boolean(),
|
|
976
977
|
is_superuser: z16.boolean(),
|
|
@@ -997,7 +998,8 @@ var PatchedUserProfileUpdateRequestSchema = z18.object({
|
|
|
997
998
|
last_name: z18.string().max(50).optional(),
|
|
998
999
|
company: z18.string().max(100).optional(),
|
|
999
1000
|
phone: z18.string().max(20).optional(),
|
|
1000
|
-
position: z18.string().max(100).optional()
|
|
1001
|
+
position: z18.string().max(100).optional(),
|
|
1002
|
+
language: z18.string().max(10).optional()
|
|
1001
1003
|
});
|
|
1002
1004
|
|
|
1003
1005
|
// src/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts
|
|
@@ -1020,7 +1022,8 @@ var UserProfileUpdateRequestSchema = z21.object({
|
|
|
1020
1022
|
last_name: z21.string().max(50).optional(),
|
|
1021
1023
|
company: z21.string().max(100).optional(),
|
|
1022
1024
|
phone: z21.string().max(20).optional(),
|
|
1023
|
-
position: z21.string().max(100).optional()
|
|
1025
|
+
position: z21.string().max(100).optional(),
|
|
1026
|
+
language: z21.string().max(10).optional()
|
|
1024
1027
|
});
|
|
1025
1028
|
|
|
1026
1029
|
// src/generated/cfg_accounts/_utils/fetchers/accounts.ts
|
|
@@ -1038,14 +1041,30 @@ import { consola as consola4 } from "consola";
|
|
|
1038
1041
|
// src/generated/cfg_accounts/index.ts
|
|
1039
1042
|
var TOKEN_KEY = "auth_token";
|
|
1040
1043
|
var REFRESH_TOKEN_KEY = "refresh_token";
|
|
1044
|
+
function detectLocale() {
|
|
1045
|
+
try {
|
|
1046
|
+
if (typeof document !== "undefined") {
|
|
1047
|
+
const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
1048
|
+
if (match) return match[1];
|
|
1049
|
+
}
|
|
1050
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1051
|
+
return navigator.language;
|
|
1052
|
+
}
|
|
1053
|
+
} catch {
|
|
1054
|
+
}
|
|
1055
|
+
return null;
|
|
1056
|
+
}
|
|
1057
|
+
__name(detectLocale, "detectLocale");
|
|
1041
1058
|
var API = class {
|
|
1042
1059
|
constructor(baseUrl, options) {
|
|
1043
1060
|
this._token = null;
|
|
1044
1061
|
this._refreshToken = null;
|
|
1062
|
+
this._locale = null;
|
|
1045
1063
|
this.baseUrl = baseUrl;
|
|
1046
1064
|
this.options = options;
|
|
1047
1065
|
const logger2 = options?.loggerConfig ? new APILogger(options.loggerConfig) : void 0;
|
|
1048
1066
|
this.storage = options?.storage || new LocalStorageAdapter(logger2);
|
|
1067
|
+
this._locale = options?.locale || null;
|
|
1049
1068
|
this._loadTokensFromStorage();
|
|
1050
1069
|
this._client = new APIClient(this.baseUrl, {
|
|
1051
1070
|
retryConfig: this.options?.retryConfig,
|
|
@@ -1081,11 +1100,13 @@ var API = class {
|
|
|
1081
1100
|
const originalRequest = this._client.request.bind(this._client);
|
|
1082
1101
|
this._client.request = async (method, path, options) => {
|
|
1083
1102
|
const token = this.getToken();
|
|
1103
|
+
const locale = this._locale || detectLocale();
|
|
1084
1104
|
const mergedOptions = {
|
|
1085
1105
|
...options,
|
|
1086
1106
|
headers: {
|
|
1087
1107
|
...options?.headers || {},
|
|
1088
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
1108
|
+
...token ? { "Authorization": `Bearer ${token}` } : {},
|
|
1109
|
+
...locale ? { "Accept-Language": locale } : {}
|
|
1089
1110
|
}
|
|
1090
1111
|
};
|
|
1091
1112
|
return originalRequest(method, path, mergedOptions);
|
|
@@ -1147,6 +1168,19 @@ var API = class {
|
|
|
1147
1168
|
getBaseUrl() {
|
|
1148
1169
|
return this.baseUrl;
|
|
1149
1170
|
}
|
|
1171
|
+
/**
|
|
1172
|
+
* Set locale for Accept-Language header
|
|
1173
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
1174
|
+
*/
|
|
1175
|
+
setLocale(locale) {
|
|
1176
|
+
this._locale = locale;
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* Get current locale
|
|
1180
|
+
*/
|
|
1181
|
+
getLocale() {
|
|
1182
|
+
return this._locale;
|
|
1183
|
+
}
|
|
1150
1184
|
/**
|
|
1151
1185
|
* Get OpenAPI schema path
|
|
1152
1186
|
* @returns Path to the OpenAPI schema JSON file
|