@djangocfg/api 2.1.541 → 2.1.543
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/README.md +1 -2
- package/dist/auth-server.cjs +1 -0
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth.cjs +156 -170
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +134 -29
- package/dist/auth.d.ts +134 -29
- package/dist/auth.mjs +168 -183
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +4 -99
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +4 -136
- package/dist/clients.d.ts +4 -136
- package/dist/clients.mjs +3 -99
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +1 -0
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +2 -4
- package/dist/hooks.d.ts +2 -4
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +4 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -340
- package/dist/index.d.ts +10 -340
- package/dist/index.mjs +3 -100
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts +8 -2
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +8 -2
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +8 -2
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpConsentPolicyRetrieve.ts +8 -2
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +8 -2
- package/src/_api/generated/_cfg_accounts/openapi.json +0 -45
- package/src/_api/generated/_cfg_accounts/schemas/User.ts +0 -2
- package/src/_api/generated/_cfg_accounts/schemas/index.ts +0 -1
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +8 -2
- package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +8 -2
- package/src/_api/generated/index.ts +1 -5
- package/src/_api/generated/openapi.json +0 -135
- package/src/_api/generated/sdk.gen.ts +1 -20
- package/src/_api/generated/types.gen.ts +0 -79
- package/src/_api/index.ts +1 -1
- package/src/auth/__tests__/useTwoFactorStatus.test.ts +2 -2
- package/src/auth/context/AccountsContext.tsx +15 -11
- package/src/auth/hooks/useAuthForm.ts +0 -1
- package/src/auth/hooks/useCfgRouter.ts +1 -4
- package/src/auth/hooks/useGithubAuth.ts +25 -3
- package/src/auth/hooks/useLocalStorage.ts +7 -30
- package/src/auth/hooks/useSessionStorage.ts +6 -29
- package/src/auth/hooks/useTwoFactorVerify.ts +5 -9
- package/src/auth/utils/analytics.ts +22 -2
- package/src/auth/utils/errors.ts +22 -11
- package/src/auth/utils/storage.ts +64 -0
- package/src/clients.ts +2 -4
- package/src/index.ts +0 -2
- package/src/log-control.ts +1 -1
- package/src/server.ts +0 -4
- package/src/_api/generated/_cfg_accounts/schemas/CentrifugoToken.ts +0 -14
- package/src/_api/generated/_cfg_centrifugo/api.ts +0 -87
- package/src/_api/generated/_cfg_centrifugo/hooks/index.ts +0 -4
- package/src/_api/generated/_cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +0 -74
- package/src/_api/generated/_cfg_centrifugo/index.ts +0 -29
- package/src/_api/generated/_cfg_centrifugo/openapi.json +0 -136
- package/src/_api/generated/_cfg_centrifugo/schemas/ConnectionTokenResponse.ts +0 -14
- package/src/_api/generated/_cfg_centrifugo/schemas/index.ts +0 -4
- package/src/_api/generated/_cfg_centrifugo/sdk.gen.ts +0 -5
- package/src/_api/generated/_cfg_centrifugo/types.gen.ts +0 -5
package/dist/index.mjs
CHANGED
|
@@ -2041,27 +2041,6 @@ var CfgAccountsAuth = class {
|
|
|
2041
2041
|
});
|
|
2042
2042
|
}
|
|
2043
2043
|
};
|
|
2044
|
-
var CfgCentrifugo = class {
|
|
2045
|
-
static {
|
|
2046
|
-
__name(this, "CfgCentrifugo");
|
|
2047
|
-
}
|
|
2048
|
-
/**
|
|
2049
|
-
* Get Centrifugo connection token
|
|
2050
|
-
*
|
|
2051
|
-
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
2052
|
-
*/
|
|
2053
|
-
static cfgCentrifugoAuthTokenRetrieve(options) {
|
|
2054
|
-
return (options?.client ?? client).get({
|
|
2055
|
-
security: [
|
|
2056
|
-
{ name: "X-API-Key", type: "apiKey" },
|
|
2057
|
-
{ scheme: "bearer", type: "http" },
|
|
2058
|
-
{ name: "Authorization", type: "apiKey" }
|
|
2059
|
-
],
|
|
2060
|
-
url: "/cfg/centrifugo/auth/token/",
|
|
2061
|
-
...options
|
|
2062
|
-
});
|
|
2063
|
-
}
|
|
2064
|
-
};
|
|
2065
2044
|
var CfgTotpBackupCodes = class {
|
|
2066
2045
|
static {
|
|
2067
2046
|
__name(this, "CfgTotpBackupCodes");
|
|
@@ -2452,80 +2431,8 @@ function formatZodError(error) {
|
|
|
2452
2431
|
}
|
|
2453
2432
|
__name(formatZodError, "formatZodError");
|
|
2454
2433
|
|
|
2455
|
-
// src/_api/generated/_cfg_centrifugo/api.ts
|
|
2456
|
-
var API2 = class {
|
|
2457
|
-
static {
|
|
2458
|
-
__name(this, "API");
|
|
2459
|
-
}
|
|
2460
|
-
logger;
|
|
2461
|
-
cfgCentrifugo = CfgCentrifugo;
|
|
2462
|
-
constructor(_baseUrl, opts = {}) {
|
|
2463
|
-
this.logger = new APILogger(opts.logger);
|
|
2464
|
-
if (_baseUrl) auth.setBaseUrl(_baseUrl);
|
|
2465
|
-
if (opts.locale !== void 0) auth.setLocale(opts.locale);
|
|
2466
|
-
if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
|
|
2467
|
-
if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
|
|
2468
|
-
}
|
|
2469
|
-
// ── Base URL ────────────────────────────────────────────────────────────
|
|
2470
|
-
getBaseUrl() {
|
|
2471
|
-
return auth.getBaseUrl();
|
|
2472
|
-
}
|
|
2473
|
-
setBaseUrl(url) {
|
|
2474
|
-
auth.setBaseUrl(url);
|
|
2475
|
-
}
|
|
2476
|
-
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
2477
|
-
getToken() {
|
|
2478
|
-
return auth.getToken();
|
|
2479
|
-
}
|
|
2480
|
-
setToken(token) {
|
|
2481
|
-
auth.setToken(token);
|
|
2482
|
-
}
|
|
2483
|
-
getRefreshToken() {
|
|
2484
|
-
return auth.getRefreshToken();
|
|
2485
|
-
}
|
|
2486
|
-
setRefreshToken(token) {
|
|
2487
|
-
auth.setRefreshToken(token);
|
|
2488
|
-
}
|
|
2489
|
-
clearToken() {
|
|
2490
|
-
auth.clearTokens();
|
|
2491
|
-
}
|
|
2492
|
-
isAuthenticated() {
|
|
2493
|
-
return auth.isAuthenticated();
|
|
2494
|
-
}
|
|
2495
|
-
// ── Locale / API key ────────────────────────────────────────────────────
|
|
2496
|
-
getLocale() {
|
|
2497
|
-
return auth.getLocale();
|
|
2498
|
-
}
|
|
2499
|
-
setLocale(locale) {
|
|
2500
|
-
auth.setLocale(locale);
|
|
2501
|
-
}
|
|
2502
|
-
getApiKey() {
|
|
2503
|
-
return auth.getApiKey();
|
|
2504
|
-
}
|
|
2505
|
-
setApiKey(key) {
|
|
2506
|
-
auth.setApiKey(key);
|
|
2507
|
-
}
|
|
2508
|
-
// ── 401 handling ────────────────────────────────────────────────────────
|
|
2509
|
-
/** Fired only on terminal 401 (after refresh+retry path is exhausted). */
|
|
2510
|
-
onUnauthorized(cb) {
|
|
2511
|
-
auth.onUnauthorized(cb);
|
|
2512
|
-
}
|
|
2513
|
-
/** Provide a refresh strategy. See `auth.setRefreshHandler` for the contract. */
|
|
2514
|
-
setRefreshHandler(fn) {
|
|
2515
|
-
auth.setRefreshHandler(fn);
|
|
2516
|
-
}
|
|
2517
|
-
/**
|
|
2518
|
-
* Proactively refresh now via the registered handler, sharing the single
|
|
2519
|
-
* 401-recovery flight (rotation + dedup + rotated-token persistence).
|
|
2520
|
-
* See `auth.refreshNow`.
|
|
2521
|
-
*/
|
|
2522
|
-
refreshNow() {
|
|
2523
|
-
return auth.refreshNow();
|
|
2524
|
-
}
|
|
2525
|
-
};
|
|
2526
|
-
|
|
2527
2434
|
// src/_api/generated/_cfg_totp/api.ts
|
|
2528
|
-
var
|
|
2435
|
+
var API2 = class {
|
|
2529
2436
|
static {
|
|
2530
2437
|
__name(this, "API");
|
|
2531
2438
|
}
|
|
@@ -2601,8 +2508,7 @@ var API3 = class {
|
|
|
2601
2508
|
|
|
2602
2509
|
// src/_api/generated/index.ts
|
|
2603
2510
|
var CfgAccountsApi = new API();
|
|
2604
|
-
var
|
|
2605
|
-
var CfgTotpApi = new API3();
|
|
2511
|
+
var CfgTotpApi = new API2();
|
|
2606
2512
|
|
|
2607
2513
|
// src/auth/utils/env.ts
|
|
2608
2514
|
var isDev = process.env.NODE_ENV === "development";
|
|
@@ -2659,11 +2565,8 @@ export {
|
|
|
2659
2565
|
CfgAccountsOauth,
|
|
2660
2566
|
CfgAccountsOtp,
|
|
2661
2567
|
CfgAccountsProfile,
|
|
2662
|
-
CfgCentrifugo,
|
|
2663
|
-
API2 as CfgCentrifugoAPI,
|
|
2664
|
-
CfgCentrifugoApi,
|
|
2665
2568
|
CfgTotp,
|
|
2666
|
-
|
|
2569
|
+
API2 as CfgTotpAPI,
|
|
2667
2570
|
CfgTotpApi,
|
|
2668
2571
|
CfgTotpBackupCodes,
|
|
2669
2572
|
CfgTotpSetup,
|