@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.cjs
CHANGED
|
@@ -1010,6 +1010,7 @@ var UserSchema = import_zod16.z.object({
|
|
|
1010
1010
|
company: import_zod16.z.string().max(100).optional(),
|
|
1011
1011
|
phone: import_zod16.z.string().max(20).optional(),
|
|
1012
1012
|
position: import_zod16.z.string().max(100).optional(),
|
|
1013
|
+
language: import_zod16.z.string().max(10).optional(),
|
|
1013
1014
|
avatar: import_zod16.z.union([import_zod16.z.url(), import_zod16.z.literal("")]).nullable(),
|
|
1014
1015
|
is_staff: import_zod16.z.boolean(),
|
|
1015
1016
|
is_superuser: import_zod16.z.boolean(),
|
|
@@ -1036,7 +1037,8 @@ var PatchedUserProfileUpdateRequestSchema = import_zod18.z.object({
|
|
|
1036
1037
|
last_name: import_zod18.z.string().max(50).optional(),
|
|
1037
1038
|
company: import_zod18.z.string().max(100).optional(),
|
|
1038
1039
|
phone: import_zod18.z.string().max(20).optional(),
|
|
1039
|
-
position: import_zod18.z.string().max(100).optional()
|
|
1040
|
+
position: import_zod18.z.string().max(100).optional(),
|
|
1041
|
+
language: import_zod18.z.string().max(10).optional()
|
|
1040
1042
|
});
|
|
1041
1043
|
|
|
1042
1044
|
// src/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts
|
|
@@ -1059,7 +1061,8 @@ var UserProfileUpdateRequestSchema = import_zod21.z.object({
|
|
|
1059
1061
|
last_name: import_zod21.z.string().max(50).optional(),
|
|
1060
1062
|
company: import_zod21.z.string().max(100).optional(),
|
|
1061
1063
|
phone: import_zod21.z.string().max(20).optional(),
|
|
1062
|
-
position: import_zod21.z.string().max(100).optional()
|
|
1064
|
+
position: import_zod21.z.string().max(100).optional(),
|
|
1065
|
+
language: import_zod21.z.string().max(10).optional()
|
|
1063
1066
|
});
|
|
1064
1067
|
|
|
1065
1068
|
// src/generated/cfg_accounts/_utils/fetchers/accounts.ts
|
|
@@ -1077,14 +1080,30 @@ var import_consola5 = require("consola");
|
|
|
1077
1080
|
// src/generated/cfg_accounts/index.ts
|
|
1078
1081
|
var TOKEN_KEY = "auth_token";
|
|
1079
1082
|
var REFRESH_TOKEN_KEY = "refresh_token";
|
|
1083
|
+
function detectLocale() {
|
|
1084
|
+
try {
|
|
1085
|
+
if (typeof document !== "undefined") {
|
|
1086
|
+
const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
1087
|
+
if (match) return match[1];
|
|
1088
|
+
}
|
|
1089
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1090
|
+
return navigator.language;
|
|
1091
|
+
}
|
|
1092
|
+
} catch {
|
|
1093
|
+
}
|
|
1094
|
+
return null;
|
|
1095
|
+
}
|
|
1096
|
+
__name(detectLocale, "detectLocale");
|
|
1080
1097
|
var API = class {
|
|
1081
1098
|
constructor(baseUrl, options) {
|
|
1082
1099
|
this._token = null;
|
|
1083
1100
|
this._refreshToken = null;
|
|
1101
|
+
this._locale = null;
|
|
1084
1102
|
this.baseUrl = baseUrl;
|
|
1085
1103
|
this.options = options;
|
|
1086
1104
|
const logger2 = options?.loggerConfig ? new APILogger(options.loggerConfig) : void 0;
|
|
1087
1105
|
this.storage = options?.storage || new LocalStorageAdapter(logger2);
|
|
1106
|
+
this._locale = options?.locale || null;
|
|
1088
1107
|
this._loadTokensFromStorage();
|
|
1089
1108
|
this._client = new APIClient(this.baseUrl, {
|
|
1090
1109
|
retryConfig: this.options?.retryConfig,
|
|
@@ -1120,11 +1139,13 @@ var API = class {
|
|
|
1120
1139
|
const originalRequest = this._client.request.bind(this._client);
|
|
1121
1140
|
this._client.request = async (method, path, options) => {
|
|
1122
1141
|
const token = this.getToken();
|
|
1142
|
+
const locale = this._locale || detectLocale();
|
|
1123
1143
|
const mergedOptions = {
|
|
1124
1144
|
...options,
|
|
1125
1145
|
headers: {
|
|
1126
1146
|
...options?.headers || {},
|
|
1127
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
1147
|
+
...token ? { "Authorization": `Bearer ${token}` } : {},
|
|
1148
|
+
...locale ? { "Accept-Language": locale } : {}
|
|
1128
1149
|
}
|
|
1129
1150
|
};
|
|
1130
1151
|
return originalRequest(method, path, mergedOptions);
|
|
@@ -1186,6 +1207,19 @@ var API = class {
|
|
|
1186
1207
|
getBaseUrl() {
|
|
1187
1208
|
return this.baseUrl;
|
|
1188
1209
|
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Set locale for Accept-Language header
|
|
1212
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
1213
|
+
*/
|
|
1214
|
+
setLocale(locale) {
|
|
1215
|
+
this._locale = locale;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Get current locale
|
|
1219
|
+
*/
|
|
1220
|
+
getLocale() {
|
|
1221
|
+
return this._locale;
|
|
1222
|
+
}
|
|
1189
1223
|
/**
|
|
1190
1224
|
* Get OpenAPI schema path
|
|
1191
1225
|
* @returns Path to the OpenAPI schema JSON file
|