@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/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
|