@djangocfg/api 2.1.456 → 2.1.457
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.cjs +2109 -2380
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +24 -5
- package/dist/auth.d.ts +24 -5
- package/dist/auth.mjs +2229 -290
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +1906 -2024
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.mjs +2090 -14
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +1026 -1672
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.mjs +1543 -4
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +1892 -2015
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2105 -20
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/helpers/auth.ts +24 -12
- package/src/auth/constants.ts +5 -5
- package/src/auth/context/AuthContext.tsx +67 -28
- package/src/auth/context/types.ts +13 -0
- package/src/auth/hooks/index.ts +5 -1
- package/src/auth/hooks/useAuthRedirect.ts +17 -0
- package/src/auth/hooks/useTwoFactor.ts +4 -2
package/dist/auth.d.cts
CHANGED
|
@@ -15,10 +15,6 @@ declare const AUTH_CONSTANTS: {
|
|
|
15
15
|
/** Backup code max length. */
|
|
16
16
|
readonly BACKUP_CODE_MAX_LENGTH: 12;
|
|
17
17
|
};
|
|
18
|
-
/** Default route for the sign-in page. Override per app via AuthConfig.routes. */
|
|
19
|
-
declare const DEFAULT_AUTH_PATH = "/auth";
|
|
20
|
-
/** Default post-login destination. Override per app via AuthConfig.routes. */
|
|
21
|
-
declare const DEFAULT_CALLBACK_PATH = "/dashboard";
|
|
22
18
|
|
|
23
19
|
type SessionStatus = 'authenticated' | 'anonymous';
|
|
24
20
|
type SessionSnapshot = {
|
|
@@ -447,11 +443,23 @@ interface AuthConfig {
|
|
|
447
443
|
};
|
|
448
444
|
onLogout?: () => void;
|
|
449
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* AuthConfig.routes resolved against the framework conventions — no field is
|
|
448
|
+
* optional here. This is what components consume (via `useAuth().routes`)
|
|
449
|
+
* instead of defaulting to route constants themselves.
|
|
450
|
+
*/
|
|
451
|
+
interface ResolvedAuthRoutes {
|
|
452
|
+
auth: string;
|
|
453
|
+
defaultCallback: string;
|
|
454
|
+
defaultAuthCallback: string;
|
|
455
|
+
}
|
|
450
456
|
interface AuthContextType {
|
|
451
457
|
user: UserProfile | null;
|
|
452
458
|
isLoading: boolean;
|
|
453
459
|
isAuthenticated: boolean;
|
|
454
460
|
isAdminUser: boolean;
|
|
461
|
+
/** Resolved route conventions (config override or framework default). */
|
|
462
|
+
routes: ResolvedAuthRoutes;
|
|
455
463
|
loadCurrentProfile: (callerId?: string) => Promise<void>;
|
|
456
464
|
checkAuthAndRedirect: () => Promise<void>;
|
|
457
465
|
getToken: () => string | null;
|
|
@@ -849,6 +857,17 @@ interface AuthRedirectOptions {
|
|
|
849
857
|
fallbackUrl?: string;
|
|
850
858
|
clearOnUse?: boolean;
|
|
851
859
|
}
|
|
860
|
+
/**
|
|
861
|
+
* Read the saved back-url without clearing it. Null when nothing saved —
|
|
862
|
+
* unlike getFinalRedirectUrl, never substitutes a fallback.
|
|
863
|
+
*/
|
|
864
|
+
declare const peekSavedRedirect: () => string | null;
|
|
865
|
+
/**
|
|
866
|
+
* Read AND clear the saved back-url (single-use intent). Null when nothing
|
|
867
|
+
* saved. This is the one primitive every post-auth navigator uses to honor
|
|
868
|
+
* "return the user to where the guard bounced them from".
|
|
869
|
+
*/
|
|
870
|
+
declare const consumeSavedRedirect: () => string | null;
|
|
852
871
|
declare const useAuthRedirectManager: (options?: AuthRedirectOptions) => {
|
|
853
872
|
redirectUrl: string;
|
|
854
873
|
setRedirect: (url: string) => void;
|
|
@@ -1092,4 +1111,4 @@ declare const Analytics: {
|
|
|
1092
1111
|
setUser(userId: string): void;
|
|
1093
1112
|
};
|
|
1094
1113
|
|
|
1095
|
-
export { AUTH_CONSTANTS, type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AuthConfig, AuthContext, type AuthContextType, type AuthFormAutoSubmit, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, AuthProvider, type AuthProviderProps, type AuthStep,
|
|
1114
|
+
export { AUTH_CONSTANTS, type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AuthConfig, AuthContext, type AuthContextType, type AuthFormAutoSubmit, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, AuthProvider, type AuthProviderProps, type AuthStep, type DeleteAccountResult, type GuardInput, type OTPRequestResult, type PatchedCfgUserUpdateRequest, PatchedCfgUserUpdateRequestSchema, type ProfileCacheOptions, type SessionSnapshot, type SessionStatus, type TwoFactorDevice, type TwoFactorSetupData, type UseAuthFormOptions, type UseAuthFormStateReturn, type UseAutoAuthOptions, type UseDeleteAccountReturn, type UseGithubAuthOptions, type UseGithubAuthReturn, type UseTwoFactorOptions, type UseTwoFactorReturn, type UseTwoFactorSetupOptions, type UseTwoFactorSetupReturn, type UseTwoFactorStatusReturn, type UserProfile, type WebmailLink, authLogger, clearProfileCache, consumeSavedRedirect, decodeBase64, encodeBase64, formatAuthError, getCacheMetadata, getCachedProfile, hasValidCache, isAllowedAuthPath, logger, normalizePath, peekSavedRedirect, resolveGuardIsAuthenticated, resolveGuardIsLoading, setCachedProfile, shouldRedirectToAuth, useAccountsContext, useAuth, useAuthForm, useAuthFormState, useAuthRedirectManager, useAuthValidation, useAutoAuth, useBase64, useCfgRouter, useDeleteAccount, useGithubAuth, useLocalStorage, useQueryParams, useSession, useSessionStorage, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, validateEmail, validateIdentifier };
|
package/dist/auth.d.ts
CHANGED
|
@@ -15,10 +15,6 @@ declare const AUTH_CONSTANTS: {
|
|
|
15
15
|
/** Backup code max length. */
|
|
16
16
|
readonly BACKUP_CODE_MAX_LENGTH: 12;
|
|
17
17
|
};
|
|
18
|
-
/** Default route for the sign-in page. Override per app via AuthConfig.routes. */
|
|
19
|
-
declare const DEFAULT_AUTH_PATH = "/auth";
|
|
20
|
-
/** Default post-login destination. Override per app via AuthConfig.routes. */
|
|
21
|
-
declare const DEFAULT_CALLBACK_PATH = "/dashboard";
|
|
22
18
|
|
|
23
19
|
type SessionStatus = 'authenticated' | 'anonymous';
|
|
24
20
|
type SessionSnapshot = {
|
|
@@ -447,11 +443,23 @@ interface AuthConfig {
|
|
|
447
443
|
};
|
|
448
444
|
onLogout?: () => void;
|
|
449
445
|
}
|
|
446
|
+
/**
|
|
447
|
+
* AuthConfig.routes resolved against the framework conventions — no field is
|
|
448
|
+
* optional here. This is what components consume (via `useAuth().routes`)
|
|
449
|
+
* instead of defaulting to route constants themselves.
|
|
450
|
+
*/
|
|
451
|
+
interface ResolvedAuthRoutes {
|
|
452
|
+
auth: string;
|
|
453
|
+
defaultCallback: string;
|
|
454
|
+
defaultAuthCallback: string;
|
|
455
|
+
}
|
|
450
456
|
interface AuthContextType {
|
|
451
457
|
user: UserProfile | null;
|
|
452
458
|
isLoading: boolean;
|
|
453
459
|
isAuthenticated: boolean;
|
|
454
460
|
isAdminUser: boolean;
|
|
461
|
+
/** Resolved route conventions (config override or framework default). */
|
|
462
|
+
routes: ResolvedAuthRoutes;
|
|
455
463
|
loadCurrentProfile: (callerId?: string) => Promise<void>;
|
|
456
464
|
checkAuthAndRedirect: () => Promise<void>;
|
|
457
465
|
getToken: () => string | null;
|
|
@@ -849,6 +857,17 @@ interface AuthRedirectOptions {
|
|
|
849
857
|
fallbackUrl?: string;
|
|
850
858
|
clearOnUse?: boolean;
|
|
851
859
|
}
|
|
860
|
+
/**
|
|
861
|
+
* Read the saved back-url without clearing it. Null when nothing saved —
|
|
862
|
+
* unlike getFinalRedirectUrl, never substitutes a fallback.
|
|
863
|
+
*/
|
|
864
|
+
declare const peekSavedRedirect: () => string | null;
|
|
865
|
+
/**
|
|
866
|
+
* Read AND clear the saved back-url (single-use intent). Null when nothing
|
|
867
|
+
* saved. This is the one primitive every post-auth navigator uses to honor
|
|
868
|
+
* "return the user to where the guard bounced them from".
|
|
869
|
+
*/
|
|
870
|
+
declare const consumeSavedRedirect: () => string | null;
|
|
852
871
|
declare const useAuthRedirectManager: (options?: AuthRedirectOptions) => {
|
|
853
872
|
redirectUrl: string;
|
|
854
873
|
setRedirect: (url: string) => void;
|
|
@@ -1092,4 +1111,4 @@ declare const Analytics: {
|
|
|
1092
1111
|
setUser(userId: string): void;
|
|
1093
1112
|
};
|
|
1094
1113
|
|
|
1095
|
-
export { AUTH_CONSTANTS, type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AuthConfig, AuthContext, type AuthContextType, type AuthFormAutoSubmit, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, AuthProvider, type AuthProviderProps, type AuthStep,
|
|
1114
|
+
export { AUTH_CONSTANTS, type AccountsContextValue, AccountsProvider, Analytics, AnalyticsCategory, type AnalyticsCategoryType, AnalyticsEvent, type AnalyticsEventType, type AuthConfig, AuthContext, type AuthContextType, type AuthFormAutoSubmit, type AuthFormReturn, type AuthFormState, type AuthFormStateHandlers, type AuthFormSubmitHandlers, type AuthFormValidation, AuthProvider, type AuthProviderProps, type AuthStep, type DeleteAccountResult, type GuardInput, type OTPRequestResult, type PatchedCfgUserUpdateRequest, PatchedCfgUserUpdateRequestSchema, type ProfileCacheOptions, type SessionSnapshot, type SessionStatus, type TwoFactorDevice, type TwoFactorSetupData, type UseAuthFormOptions, type UseAuthFormStateReturn, type UseAutoAuthOptions, type UseDeleteAccountReturn, type UseGithubAuthOptions, type UseGithubAuthReturn, type UseTwoFactorOptions, type UseTwoFactorReturn, type UseTwoFactorSetupOptions, type UseTwoFactorSetupReturn, type UseTwoFactorStatusReturn, type UserProfile, type WebmailLink, authLogger, clearProfileCache, consumeSavedRedirect, decodeBase64, encodeBase64, formatAuthError, getCacheMetadata, getCachedProfile, hasValidCache, isAllowedAuthPath, logger, normalizePath, peekSavedRedirect, resolveGuardIsAuthenticated, resolveGuardIsLoading, setCachedProfile, shouldRedirectToAuth, useAccountsContext, useAuth, useAuthForm, useAuthFormState, useAuthRedirectManager, useAuthValidation, useAutoAuth, useBase64, useCfgRouter, useDeleteAccount, useGithubAuth, useLocalStorage, useQueryParams, useSession, useSessionStorage, useTwoFactor, useTwoFactorSetup, useTwoFactorStatus, validateEmail, validateIdentifier };
|