@djangocfg/api 2.1.87 → 2.1.89
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 +1963 -4
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.d.cts +35 -1
- package/dist/auth-server.d.ts +35 -1
- package/dist/auth-server.mjs +1953 -4
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +692 -497
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +18 -2
- package/dist/auth.d.ts +18 -2
- package/dist/auth.mjs +655 -460
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +460 -383
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +26 -6
- package/dist/clients.d.ts +26 -6
- package/dist/clients.mjs +460 -383
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +130 -105
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +24 -4
- package/dist/hooks.d.ts +24 -4
- package/dist/hooks.mjs +130 -105
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +373 -311
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -8
- package/dist/index.d.ts +54 -8
- package/dist/index.mjs +373 -311
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/auth/context/AccountsContext.tsx +3 -3
- package/src/auth/context/AuthContext.tsx +56 -10
- package/src/auth/hooks/index.ts +3 -0
- package/src/auth/hooks/useProfileCache.ts +1 -1
- package/src/auth/hooks/useTokenRefresh.ts +161 -0
- package/src/auth/middlewares/index.ts +8 -1
- package/src/auth/middlewares/tokenRefresh.ts +158 -0
- package/src/generated/cfg_accounts/CLAUDE.md +2 -9
- package/src/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts +2 -1
- package/src/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts +2 -1
- package/src/generated/cfg_accounts/_utils/schemas/CfgAccountsProfileAvatarCreateRequest.schema.ts +15 -0
- package/src/generated/cfg_accounts/_utils/schemas/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts/models.ts +0 -1
- package/src/generated/cfg_accounts/accounts__user_profile/client.ts +4 -2
- package/src/generated/cfg_accounts/accounts__user_profile/models.ts +9 -1
- package/src/generated/cfg_accounts/client.ts +18 -0
- package/src/generated/cfg_accounts/index.ts +3 -1
- package/src/generated/cfg_accounts/schema.json +2 -2
- package/src/generated/cfg_centrifugo/CLAUDE.md +1 -8
- package/src/generated/cfg_centrifugo/client.ts +18 -0
- package/src/generated/cfg_centrifugo/index.ts +3 -1
- package/src/generated/cfg_totp/CLAUDE.md +1 -8
- package/src/generated/cfg_totp/client.ts +18 -0
- package/src/generated/cfg_totp/index.ts +3 -1
- package/src/generated/cfg_totp/totp/models.ts +2 -0
- package/src/generated/cfg_webpush/CLAUDE.md +1 -8
- package/src/generated/cfg_webpush/client.ts +18 -0
- package/src/generated/cfg_webpush/index.ts +3 -1
package/dist/auth-server.d.cts
CHANGED
|
@@ -13,4 +13,38 @@ declare const proxyMiddlewareConfig: {
|
|
|
13
13
|
matcher: string[];
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Token Auto-Refresh Middleware
|
|
18
|
+
*
|
|
19
|
+
* Automatically refreshes access token when receiving 401 responses.
|
|
20
|
+
* Implements request queuing to prevent multiple simultaneous refresh attempts.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Attempt to refresh the access token using the refresh token
|
|
24
|
+
* @returns New access token or null if refresh failed
|
|
25
|
+
*/
|
|
26
|
+
declare function refreshAccessToken(): Promise<string | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a response indicates an authentication error
|
|
29
|
+
*/
|
|
30
|
+
declare function isAuthenticationError(response: Response): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Create a fetch wrapper that automatically refreshes tokens on 401
|
|
33
|
+
*
|
|
34
|
+
* @param originalFetch - The original fetch function to wrap
|
|
35
|
+
* @returns Wrapped fetch function with auto-refresh capability
|
|
36
|
+
*/
|
|
37
|
+
declare function createAutoRefreshFetch(originalFetch: typeof fetch): typeof fetch;
|
|
38
|
+
/**
|
|
39
|
+
* Check if token is about to expire (within threshold)
|
|
40
|
+
* @param thresholdMs - Time in ms before expiry to consider "expiring soon"
|
|
41
|
+
* @returns true if token expires within threshold
|
|
42
|
+
*/
|
|
43
|
+
declare function isTokenExpiringSoon(thresholdMs?: number): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Proactively refresh token if it's expiring soon
|
|
46
|
+
* Call this periodically or before important operations
|
|
47
|
+
*/
|
|
48
|
+
declare function refreshIfExpiringSoon(thresholdMs?: number): Promise<void>;
|
|
49
|
+
|
|
50
|
+
export { createAutoRefreshFetch, isAuthenticationError, isTokenExpiringSoon, proxyMiddleware, proxyMiddlewareConfig, refreshAccessToken, refreshIfExpiringSoon };
|
package/dist/auth-server.d.ts
CHANGED
|
@@ -13,4 +13,38 @@ declare const proxyMiddlewareConfig: {
|
|
|
13
13
|
matcher: string[];
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Token Auto-Refresh Middleware
|
|
18
|
+
*
|
|
19
|
+
* Automatically refreshes access token when receiving 401 responses.
|
|
20
|
+
* Implements request queuing to prevent multiple simultaneous refresh attempts.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Attempt to refresh the access token using the refresh token
|
|
24
|
+
* @returns New access token or null if refresh failed
|
|
25
|
+
*/
|
|
26
|
+
declare function refreshAccessToken(): Promise<string | null>;
|
|
27
|
+
/**
|
|
28
|
+
* Check if a response indicates an authentication error
|
|
29
|
+
*/
|
|
30
|
+
declare function isAuthenticationError(response: Response): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Create a fetch wrapper that automatically refreshes tokens on 401
|
|
33
|
+
*
|
|
34
|
+
* @param originalFetch - The original fetch function to wrap
|
|
35
|
+
* @returns Wrapped fetch function with auto-refresh capability
|
|
36
|
+
*/
|
|
37
|
+
declare function createAutoRefreshFetch(originalFetch: typeof fetch): typeof fetch;
|
|
38
|
+
/**
|
|
39
|
+
* Check if token is about to expire (within threshold)
|
|
40
|
+
* @param thresholdMs - Time in ms before expiry to consider "expiring soon"
|
|
41
|
+
* @returns true if token expires within threshold
|
|
42
|
+
*/
|
|
43
|
+
declare function isTokenExpiringSoon(thresholdMs?: number): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Proactively refresh token if it's expiring soon
|
|
46
|
+
* Call this periodically or before important operations
|
|
47
|
+
*/
|
|
48
|
+
declare function refreshIfExpiringSoon(thresholdMs?: number): Promise<void>;
|
|
49
|
+
|
|
50
|
+
export { createAutoRefreshFetch, isAuthenticationError, isTokenExpiringSoon, proxyMiddleware, proxyMiddlewareConfig, refreshAccessToken, refreshIfExpiringSoon };
|