@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.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -30,11 +31,8 @@ __export(index_exports, {
|
|
|
30
31
|
CfgAccountsOauth: () => CfgAccountsOauth,
|
|
31
32
|
CfgAccountsOtp: () => CfgAccountsOtp,
|
|
32
33
|
CfgAccountsProfile: () => CfgAccountsProfile,
|
|
33
|
-
CfgCentrifugo: () => CfgCentrifugo,
|
|
34
|
-
CfgCentrifugoAPI: () => API2,
|
|
35
|
-
CfgCentrifugoApi: () => CfgCentrifugoApi,
|
|
36
34
|
CfgTotp: () => CfgTotp,
|
|
37
|
-
CfgTotpAPI: () =>
|
|
35
|
+
CfgTotpAPI: () => API2,
|
|
38
36
|
CfgTotpApi: () => CfgTotpApi,
|
|
39
37
|
CfgTotpBackupCodes: () => CfgTotpBackupCodes,
|
|
40
38
|
CfgTotpSetup: () => CfgTotpSetup,
|
|
@@ -2101,27 +2099,6 @@ var CfgAccountsAuth = class {
|
|
|
2101
2099
|
});
|
|
2102
2100
|
}
|
|
2103
2101
|
};
|
|
2104
|
-
var CfgCentrifugo = class {
|
|
2105
|
-
static {
|
|
2106
|
-
__name(this, "CfgCentrifugo");
|
|
2107
|
-
}
|
|
2108
|
-
/**
|
|
2109
|
-
* Get Centrifugo connection token
|
|
2110
|
-
*
|
|
2111
|
-
* Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
|
|
2112
|
-
*/
|
|
2113
|
-
static cfgCentrifugoAuthTokenRetrieve(options) {
|
|
2114
|
-
return (options?.client ?? client).get({
|
|
2115
|
-
security: [
|
|
2116
|
-
{ name: "X-API-Key", type: "apiKey" },
|
|
2117
|
-
{ scheme: "bearer", type: "http" },
|
|
2118
|
-
{ name: "Authorization", type: "apiKey" }
|
|
2119
|
-
],
|
|
2120
|
-
url: "/cfg/centrifugo/auth/token/",
|
|
2121
|
-
...options
|
|
2122
|
-
});
|
|
2123
|
-
}
|
|
2124
|
-
};
|
|
2125
2102
|
var CfgTotpBackupCodes = class {
|
|
2126
2103
|
static {
|
|
2127
2104
|
__name(this, "CfgTotpBackupCodes");
|
|
@@ -2512,80 +2489,8 @@ function formatZodError(error) {
|
|
|
2512
2489
|
}
|
|
2513
2490
|
__name(formatZodError, "formatZodError");
|
|
2514
2491
|
|
|
2515
|
-
// src/_api/generated/_cfg_centrifugo/api.ts
|
|
2516
|
-
var API2 = class {
|
|
2517
|
-
static {
|
|
2518
|
-
__name(this, "API");
|
|
2519
|
-
}
|
|
2520
|
-
logger;
|
|
2521
|
-
cfgCentrifugo = CfgCentrifugo;
|
|
2522
|
-
constructor(_baseUrl, opts = {}) {
|
|
2523
|
-
this.logger = new APILogger(opts.logger);
|
|
2524
|
-
if (_baseUrl) auth.setBaseUrl(_baseUrl);
|
|
2525
|
-
if (opts.locale !== void 0) auth.setLocale(opts.locale);
|
|
2526
|
-
if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
|
|
2527
|
-
if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
|
|
2528
|
-
}
|
|
2529
|
-
// ── Base URL ────────────────────────────────────────────────────────────
|
|
2530
|
-
getBaseUrl() {
|
|
2531
|
-
return auth.getBaseUrl();
|
|
2532
|
-
}
|
|
2533
|
-
setBaseUrl(url) {
|
|
2534
|
-
auth.setBaseUrl(url);
|
|
2535
|
-
}
|
|
2536
|
-
// ── Tokens ──────────────────────────────────────────────────────────────
|
|
2537
|
-
getToken() {
|
|
2538
|
-
return auth.getToken();
|
|
2539
|
-
}
|
|
2540
|
-
setToken(token) {
|
|
2541
|
-
auth.setToken(token);
|
|
2542
|
-
}
|
|
2543
|
-
getRefreshToken() {
|
|
2544
|
-
return auth.getRefreshToken();
|
|
2545
|
-
}
|
|
2546
|
-
setRefreshToken(token) {
|
|
2547
|
-
auth.setRefreshToken(token);
|
|
2548
|
-
}
|
|
2549
|
-
clearToken() {
|
|
2550
|
-
auth.clearTokens();
|
|
2551
|
-
}
|
|
2552
|
-
isAuthenticated() {
|
|
2553
|
-
return auth.isAuthenticated();
|
|
2554
|
-
}
|
|
2555
|
-
// ── Locale / API key ────────────────────────────────────────────────────
|
|
2556
|
-
getLocale() {
|
|
2557
|
-
return auth.getLocale();
|
|
2558
|
-
}
|
|
2559
|
-
setLocale(locale) {
|
|
2560
|
-
auth.setLocale(locale);
|
|
2561
|
-
}
|
|
2562
|
-
getApiKey() {
|
|
2563
|
-
return auth.getApiKey();
|
|
2564
|
-
}
|
|
2565
|
-
setApiKey(key) {
|
|
2566
|
-
auth.setApiKey(key);
|
|
2567
|
-
}
|
|
2568
|
-
// ── 401 handling ────────────────────────────────────────────────────────
|
|
2569
|
-
/** Fired only on terminal 401 (after refresh+retry path is exhausted). */
|
|
2570
|
-
onUnauthorized(cb) {
|
|
2571
|
-
auth.onUnauthorized(cb);
|
|
2572
|
-
}
|
|
2573
|
-
/** Provide a refresh strategy. See `auth.setRefreshHandler` for the contract. */
|
|
2574
|
-
setRefreshHandler(fn) {
|
|
2575
|
-
auth.setRefreshHandler(fn);
|
|
2576
|
-
}
|
|
2577
|
-
/**
|
|
2578
|
-
* Proactively refresh now via the registered handler, sharing the single
|
|
2579
|
-
* 401-recovery flight (rotation + dedup + rotated-token persistence).
|
|
2580
|
-
* See `auth.refreshNow`.
|
|
2581
|
-
*/
|
|
2582
|
-
refreshNow() {
|
|
2583
|
-
return auth.refreshNow();
|
|
2584
|
-
}
|
|
2585
|
-
};
|
|
2586
|
-
|
|
2587
2492
|
// src/_api/generated/_cfg_totp/api.ts
|
|
2588
|
-
var
|
|
2493
|
+
var API2 = class {
|
|
2589
2494
|
static {
|
|
2590
2495
|
__name(this, "API");
|
|
2591
2496
|
}
|
|
@@ -2661,8 +2566,7 @@ var API3 = class {
|
|
|
2661
2566
|
|
|
2662
2567
|
// src/_api/generated/index.ts
|
|
2663
2568
|
var CfgAccountsApi = new API();
|
|
2664
|
-
var
|
|
2665
|
-
var CfgTotpApi = new API3();
|
|
2569
|
+
var CfgTotpApi = new API2();
|
|
2666
2570
|
|
|
2667
2571
|
// src/auth/utils/env.ts
|
|
2668
2572
|
var isDev = process.env.NODE_ENV === "development";
|