mailsentry-auth 0.2.6 → 0.2.8
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/index.d.mts +34 -24
- package/dist/index.d.ts +34 -24
- package/dist/index.js +147 -110
- package/dist/index.mjs +148 -111
- package/dist/middleware.d.mts +2 -5
- package/dist/middleware.mjs +139 -77
- package/dist/utils/cookie-utils.js +51 -33
- package/dist/utils/cookie-utils.mjs +51 -33
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -518,6 +518,10 @@ declare abstract class BaseService {
|
|
|
518
518
|
* Create generic API error as fallback
|
|
519
519
|
*/
|
|
520
520
|
private createGenericApiError;
|
|
521
|
+
/**
|
|
522
|
+
* Helper method for common request logic
|
|
523
|
+
*/
|
|
524
|
+
private executeRequest;
|
|
521
525
|
/**
|
|
522
526
|
* GET request
|
|
523
527
|
*/
|
|
@@ -743,9 +747,10 @@ declare abstract class BaseErrorHandler implements IErrorHandler {
|
|
|
743
747
|
}
|
|
744
748
|
|
|
745
749
|
/**
|
|
746
|
-
*
|
|
750
|
+
* API Error Handler
|
|
751
|
+
* Handles specific ApiError instances thrown by the HTTP client
|
|
747
752
|
*/
|
|
748
|
-
declare class
|
|
753
|
+
declare class ApiErrorHandler extends BaseErrorHandler {
|
|
749
754
|
protected canHandle(error: unknown): boolean;
|
|
750
755
|
protected handleError(error: unknown, context: string): AuthActionResult;
|
|
751
756
|
}
|
|
@@ -758,14 +763,6 @@ declare class NetworkErrorHandler extends BaseErrorHandler {
|
|
|
758
763
|
protected handleError(error: unknown, context: string): AuthActionResult;
|
|
759
764
|
}
|
|
760
765
|
|
|
761
|
-
/**
|
|
762
|
-
* Generic Error Handler
|
|
763
|
-
*/
|
|
764
|
-
declare class GenericErrorHandler extends BaseErrorHandler {
|
|
765
|
-
protected canHandle(): boolean;
|
|
766
|
-
protected handleError(error: unknown, context: string): AuthActionResult;
|
|
767
|
-
}
|
|
768
|
-
|
|
769
766
|
/**
|
|
770
767
|
* Development Logger Implementation
|
|
771
768
|
*/
|
|
@@ -1405,22 +1402,38 @@ declare const getForgotPasswordField: (options?: ButtonProps) => BaseFormField;
|
|
|
1405
1402
|
/**
|
|
1406
1403
|
* Middleware configuration constants for routing and protection
|
|
1407
1404
|
*/
|
|
1405
|
+
interface ProtectionRule {
|
|
1406
|
+
hostPattern: string | null;
|
|
1407
|
+
pathPattern: string;
|
|
1408
|
+
}
|
|
1408
1409
|
declare class MiddlewareConfig {
|
|
1409
1410
|
static readonly CONSTANTS: {
|
|
1410
1411
|
readonly LOGIN_PATH: "/login";
|
|
1411
1412
|
readonly DASHBOARD_SUBDOMAIN: "dashboard";
|
|
1412
|
-
readonly PUBLIC_PATH: "/public";
|
|
1413
|
-
readonly PUBLIC_API_PATH: "/api/public";
|
|
1414
1413
|
};
|
|
1415
1414
|
/**
|
|
1416
|
-
* Get
|
|
1417
|
-
*
|
|
1415
|
+
* Get dynamic protection rules from environment variable
|
|
1416
|
+
* Format: "host:path" or "path"
|
|
1418
1417
|
*/
|
|
1419
|
-
static
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1418
|
+
static getProtectedRules(): ProtectionRule[];
|
|
1419
|
+
/**
|
|
1420
|
+
* Get public routes whitelist (Exclusions)
|
|
1421
|
+
* Format: "host:path" or "path"
|
|
1422
|
+
*/
|
|
1423
|
+
static getWhitelistRules(): ProtectionRule[];
|
|
1424
|
+
/**
|
|
1425
|
+
* Get guest-only routes (redirects authenticated users away)
|
|
1426
|
+
* Format: "host:path" or "path"
|
|
1427
|
+
*/
|
|
1428
|
+
static getGuestOnlyRules(): ProtectionRule[];
|
|
1429
|
+
/**
|
|
1430
|
+
* Generic parser for environment variables containing rule lists
|
|
1431
|
+
*/
|
|
1432
|
+
private static parseRules;
|
|
1433
|
+
/**
|
|
1434
|
+
* Parse a single rule string into a ProtectionRule object
|
|
1435
|
+
*/
|
|
1436
|
+
private static parseSingleRule;
|
|
1424
1437
|
static readonly ALLOWED_METHODS: readonly ["GET", "HEAD"];
|
|
1425
1438
|
static readonly QUERY_PARAMS: {
|
|
1426
1439
|
readonly LOGIN_REQUIRED: "sign_in_required";
|
|
@@ -1442,12 +1455,9 @@ declare class MiddlewareConfig {
|
|
|
1442
1455
|
}
|
|
1443
1456
|
/**
|
|
1444
1457
|
* Middleware matcher patterns
|
|
1445
|
-
*
|
|
1458
|
+
* Already excludes /api routes and static files automatically
|
|
1446
1459
|
*/
|
|
1447
1460
|
declare const middlewareMatcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
|
|
1448
|
-
/**
|
|
1449
|
-
* Middleware configuration
|
|
1450
|
-
*/
|
|
1451
1461
|
declare const config: {
|
|
1452
1462
|
matcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
|
|
1453
1463
|
};
|
|
@@ -1768,4 +1778,4 @@ declare const useAuthFlowModal: () => {
|
|
|
1768
1778
|
openModal: () => void;
|
|
1769
1779
|
};
|
|
1770
1780
|
|
|
1771
|
-
export { AUTH_ENDPOINTS, AlertDisplay, type AlertDisplayProps, type AnyStepProps, type ApiErrorResponse, type ApiKeyConfig, type AuthActionCallbacks, type AuthActionOptions, type AuthActionResult, type AuthActionResultFailure, type AuthActionResultSuccess, type AuthActionState, type AuthEvent, AuthEventType, AuthFlowContainer, type AuthFlowContainerProps, AuthFlowModal, type AuthFlowModalProps, type AuthFlowProps, AuthFlowStep, AuthFlowVariant, AuthInitializer, AuthOrchestrator, AuthOrchestratorFactory, AuthResultFactory, AuthService, type AuthState, AuthenticatedState, type AuthenticatedStateProps, AuthenticationStatusContext, type BaseComponentProps, BaseErrorHandler, BaseEventBus, BaseForm, type BaseFormField, type BaseFormProps, type BaseResponse, BaseService, type BaseStepProps, BroadcastChannelEventBus, Channel, CookieUtils, CrossTabBehaviorConfig, CrossTabBehaviorHandler, CrossTabDemo, DevelopmentLogger, EMAIL_SUBMISSION_NAVIGATION, type EmailCheckResult, type EmailExistResponse, type EmailProviderConfig, EmailProviderUtils, EmailStep, type EmailStepProps, EndpointBuilder, type EventBus, ExistingUserLoginStrategy, type ForgotPasswordStepProps, FormFields, type FormFieldsProps, FormHeader, type FormHeaderProps,
|
|
1781
|
+
export { AUTH_ENDPOINTS, AlertDisplay, type AlertDisplayProps, type AnyStepProps, ApiErrorHandler, type ApiErrorResponse, type ApiKeyConfig, type AuthActionCallbacks, type AuthActionOptions, type AuthActionResult, type AuthActionResultFailure, type AuthActionResultSuccess, type AuthActionState, type AuthEvent, AuthEventType, AuthFlowContainer, type AuthFlowContainerProps, AuthFlowModal, type AuthFlowModalProps, type AuthFlowProps, AuthFlowStep, AuthFlowVariant, AuthInitializer, AuthOrchestrator, AuthOrchestratorFactory, AuthResultFactory, AuthService, type AuthState, AuthenticatedState, type AuthenticatedStateProps, AuthenticationStatusContext, type BaseComponentProps, BaseErrorHandler, BaseEventBus, BaseForm, type BaseFormField, type BaseFormProps, type BaseResponse, BaseService, type BaseStepProps, BroadcastChannelEventBus, Channel, CookieUtils, CrossTabBehaviorConfig, CrossTabBehaviorHandler, CrossTabDemo, DevelopmentLogger, EMAIL_SUBMISSION_NAVIGATION, type EmailCheckResult, type EmailExistResponse, type EmailProviderConfig, EmailProviderUtils, EmailStep, type EmailStepProps, EndpointBuilder, type EventBus, ExistingUserLoginStrategy, type ForgotPasswordStepProps, FormFields, type FormFieldsProps, FormHeader, type FormHeaderProps, HttpClient, type HttpClientConfig, type HttpError, HttpMethod, type HttpRequestOptions, type HttpResponse, type IAuthOrchestrator, type IAuthService, type IAuthStatusState, type ICleanupStrategy, type IErrorHandler, type ILogger, type ILoginFlowStrategy, type ITokenManager, LocalStorageUtils, LoggerFactory, type LoginData, LoginFlowStrategyFactory, type LoginRequest, type LoginResponse, LoginStrategyResolver, LoginVerificationStrategy, MiddlewareConfig, type MiddlewareContext, type MiddlewareHandler, NavigationAction, NetworkErrorHandler, NextAction, PASSWORD_SUBMISSION_NAVIGATION, PageType, PageTypePatterns, PasswordInputWithStrength, type PasswordInputWithStrengthProps, PasswordStep, type PasswordStepProps, type PasswordStrengthRule, ProductionLogger, ProfileStateRenderer, ProfileUIState, type PropsFactory, type ProtectionRule, type PublicUserProfile, type PublicUserProfileResponse, RoleType, SignupFlowStrategy, type Step, type StepComponent, type StepComponentRetriever, type StepConfig, type StepPropsFactoryRegistry, type StepRegistry, type StepRegistryBaseProps, type StepRegistryConfigs, type StepRegistryHandlers, type StepRegistryParams, type StepRegistryState, type StepperActions, type StepperState$1 as StepperState, StrategyResolutionMode, type StrengthResult, type Subscription, TokenManager, UnauthenticatedState, UrlCleanupHandler, UrlUtils, type UseAuthActionHandler, type UseAuthEventBusProps, type UseFormSubmissionProps, type UseStepRegistryParams, type UseStepperReturn, type UserProfile, type UserProfileResponse, type UserSession, type UserState, UserStorageManager, type UserStoreState, VERIFICATION_SUBMISSION_NAVIGATION, VerificationStep, type VerificationStepProps, type VerifyEmailRequest, type VerifyEmailResponse, config, createAuthSteps, createPropsFactoryRegistry, createStepRegistry, getAuthPageStepMessage, getEmailField, getForgotPasswordField, getPasswordField, getStepForEmailSubmission, getStepForPasswordSubmission, getStepForVerificationSubmission, getStepProgressMessage, getTermsCheckboxField, getVerificationField, isPublicUser, isPublicUserEmail, middlewareMatcher, useAuth, useAuthActionHandler, useAuthEventBus, useAuthFlowModal, useAuthInitializer, useIsAuthenticated, useLogout, usePublicUserSession, useRefreshUser, useSharedEventBus, useSignInRequiredParams, useStepRegistry, useStepRenderer, useStepper, useUser, useUserActions, useUserData, useUserError, useUserLoading, useUserProfile, useUserSelectors, useUserStore, userSelectors };
|
package/dist/index.d.ts
CHANGED
|
@@ -518,6 +518,10 @@ declare abstract class BaseService {
|
|
|
518
518
|
* Create generic API error as fallback
|
|
519
519
|
*/
|
|
520
520
|
private createGenericApiError;
|
|
521
|
+
/**
|
|
522
|
+
* Helper method for common request logic
|
|
523
|
+
*/
|
|
524
|
+
private executeRequest;
|
|
521
525
|
/**
|
|
522
526
|
* GET request
|
|
523
527
|
*/
|
|
@@ -743,9 +747,10 @@ declare abstract class BaseErrorHandler implements IErrorHandler {
|
|
|
743
747
|
}
|
|
744
748
|
|
|
745
749
|
/**
|
|
746
|
-
*
|
|
750
|
+
* API Error Handler
|
|
751
|
+
* Handles specific ApiError instances thrown by the HTTP client
|
|
747
752
|
*/
|
|
748
|
-
declare class
|
|
753
|
+
declare class ApiErrorHandler extends BaseErrorHandler {
|
|
749
754
|
protected canHandle(error: unknown): boolean;
|
|
750
755
|
protected handleError(error: unknown, context: string): AuthActionResult;
|
|
751
756
|
}
|
|
@@ -758,14 +763,6 @@ declare class NetworkErrorHandler extends BaseErrorHandler {
|
|
|
758
763
|
protected handleError(error: unknown, context: string): AuthActionResult;
|
|
759
764
|
}
|
|
760
765
|
|
|
761
|
-
/**
|
|
762
|
-
* Generic Error Handler
|
|
763
|
-
*/
|
|
764
|
-
declare class GenericErrorHandler extends BaseErrorHandler {
|
|
765
|
-
protected canHandle(): boolean;
|
|
766
|
-
protected handleError(error: unknown, context: string): AuthActionResult;
|
|
767
|
-
}
|
|
768
|
-
|
|
769
766
|
/**
|
|
770
767
|
* Development Logger Implementation
|
|
771
768
|
*/
|
|
@@ -1405,22 +1402,38 @@ declare const getForgotPasswordField: (options?: ButtonProps) => BaseFormField;
|
|
|
1405
1402
|
/**
|
|
1406
1403
|
* Middleware configuration constants for routing and protection
|
|
1407
1404
|
*/
|
|
1405
|
+
interface ProtectionRule {
|
|
1406
|
+
hostPattern: string | null;
|
|
1407
|
+
pathPattern: string;
|
|
1408
|
+
}
|
|
1408
1409
|
declare class MiddlewareConfig {
|
|
1409
1410
|
static readonly CONSTANTS: {
|
|
1410
1411
|
readonly LOGIN_PATH: "/login";
|
|
1411
1412
|
readonly DASHBOARD_SUBDOMAIN: "dashboard";
|
|
1412
|
-
readonly PUBLIC_PATH: "/public";
|
|
1413
|
-
readonly PUBLIC_API_PATH: "/api/public";
|
|
1414
1413
|
};
|
|
1415
1414
|
/**
|
|
1416
|
-
* Get
|
|
1417
|
-
*
|
|
1415
|
+
* Get dynamic protection rules from environment variable
|
|
1416
|
+
* Format: "host:path" or "path"
|
|
1418
1417
|
*/
|
|
1419
|
-
static
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1418
|
+
static getProtectedRules(): ProtectionRule[];
|
|
1419
|
+
/**
|
|
1420
|
+
* Get public routes whitelist (Exclusions)
|
|
1421
|
+
* Format: "host:path" or "path"
|
|
1422
|
+
*/
|
|
1423
|
+
static getWhitelistRules(): ProtectionRule[];
|
|
1424
|
+
/**
|
|
1425
|
+
* Get guest-only routes (redirects authenticated users away)
|
|
1426
|
+
* Format: "host:path" or "path"
|
|
1427
|
+
*/
|
|
1428
|
+
static getGuestOnlyRules(): ProtectionRule[];
|
|
1429
|
+
/**
|
|
1430
|
+
* Generic parser for environment variables containing rule lists
|
|
1431
|
+
*/
|
|
1432
|
+
private static parseRules;
|
|
1433
|
+
/**
|
|
1434
|
+
* Parse a single rule string into a ProtectionRule object
|
|
1435
|
+
*/
|
|
1436
|
+
private static parseSingleRule;
|
|
1424
1437
|
static readonly ALLOWED_METHODS: readonly ["GET", "HEAD"];
|
|
1425
1438
|
static readonly QUERY_PARAMS: {
|
|
1426
1439
|
readonly LOGIN_REQUIRED: "sign_in_required";
|
|
@@ -1442,12 +1455,9 @@ declare class MiddlewareConfig {
|
|
|
1442
1455
|
}
|
|
1443
1456
|
/**
|
|
1444
1457
|
* Middleware matcher patterns
|
|
1445
|
-
*
|
|
1458
|
+
* Already excludes /api routes and static files automatically
|
|
1446
1459
|
*/
|
|
1447
1460
|
declare const middlewareMatcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
|
|
1448
|
-
/**
|
|
1449
|
-
* Middleware configuration
|
|
1450
|
-
*/
|
|
1451
1461
|
declare const config: {
|
|
1452
1462
|
matcher: readonly ["/((?!api|_next/static|_next/image|_next/webpack-hmr|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp|ico|css|js)$).*)"];
|
|
1453
1463
|
};
|
|
@@ -1768,4 +1778,4 @@ declare const useAuthFlowModal: () => {
|
|
|
1768
1778
|
openModal: () => void;
|
|
1769
1779
|
};
|
|
1770
1780
|
|
|
1771
|
-
export { AUTH_ENDPOINTS, AlertDisplay, type AlertDisplayProps, type AnyStepProps, type ApiErrorResponse, type ApiKeyConfig, type AuthActionCallbacks, type AuthActionOptions, type AuthActionResult, type AuthActionResultFailure, type AuthActionResultSuccess, type AuthActionState, type AuthEvent, AuthEventType, AuthFlowContainer, type AuthFlowContainerProps, AuthFlowModal, type AuthFlowModalProps, type AuthFlowProps, AuthFlowStep, AuthFlowVariant, AuthInitializer, AuthOrchestrator, AuthOrchestratorFactory, AuthResultFactory, AuthService, type AuthState, AuthenticatedState, type AuthenticatedStateProps, AuthenticationStatusContext, type BaseComponentProps, BaseErrorHandler, BaseEventBus, BaseForm, type BaseFormField, type BaseFormProps, type BaseResponse, BaseService, type BaseStepProps, BroadcastChannelEventBus, Channel, CookieUtils, CrossTabBehaviorConfig, CrossTabBehaviorHandler, CrossTabDemo, DevelopmentLogger, EMAIL_SUBMISSION_NAVIGATION, type EmailCheckResult, type EmailExistResponse, type EmailProviderConfig, EmailProviderUtils, EmailStep, type EmailStepProps, EndpointBuilder, type EventBus, ExistingUserLoginStrategy, type ForgotPasswordStepProps, FormFields, type FormFieldsProps, FormHeader, type FormHeaderProps,
|
|
1781
|
+
export { AUTH_ENDPOINTS, AlertDisplay, type AlertDisplayProps, type AnyStepProps, ApiErrorHandler, type ApiErrorResponse, type ApiKeyConfig, type AuthActionCallbacks, type AuthActionOptions, type AuthActionResult, type AuthActionResultFailure, type AuthActionResultSuccess, type AuthActionState, type AuthEvent, AuthEventType, AuthFlowContainer, type AuthFlowContainerProps, AuthFlowModal, type AuthFlowModalProps, type AuthFlowProps, AuthFlowStep, AuthFlowVariant, AuthInitializer, AuthOrchestrator, AuthOrchestratorFactory, AuthResultFactory, AuthService, type AuthState, AuthenticatedState, type AuthenticatedStateProps, AuthenticationStatusContext, type BaseComponentProps, BaseErrorHandler, BaseEventBus, BaseForm, type BaseFormField, type BaseFormProps, type BaseResponse, BaseService, type BaseStepProps, BroadcastChannelEventBus, Channel, CookieUtils, CrossTabBehaviorConfig, CrossTabBehaviorHandler, CrossTabDemo, DevelopmentLogger, EMAIL_SUBMISSION_NAVIGATION, type EmailCheckResult, type EmailExistResponse, type EmailProviderConfig, EmailProviderUtils, EmailStep, type EmailStepProps, EndpointBuilder, type EventBus, ExistingUserLoginStrategy, type ForgotPasswordStepProps, FormFields, type FormFieldsProps, FormHeader, type FormHeaderProps, HttpClient, type HttpClientConfig, type HttpError, HttpMethod, type HttpRequestOptions, type HttpResponse, type IAuthOrchestrator, type IAuthService, type IAuthStatusState, type ICleanupStrategy, type IErrorHandler, type ILogger, type ILoginFlowStrategy, type ITokenManager, LocalStorageUtils, LoggerFactory, type LoginData, LoginFlowStrategyFactory, type LoginRequest, type LoginResponse, LoginStrategyResolver, LoginVerificationStrategy, MiddlewareConfig, type MiddlewareContext, type MiddlewareHandler, NavigationAction, NetworkErrorHandler, NextAction, PASSWORD_SUBMISSION_NAVIGATION, PageType, PageTypePatterns, PasswordInputWithStrength, type PasswordInputWithStrengthProps, PasswordStep, type PasswordStepProps, type PasswordStrengthRule, ProductionLogger, ProfileStateRenderer, ProfileUIState, type PropsFactory, type ProtectionRule, type PublicUserProfile, type PublicUserProfileResponse, RoleType, SignupFlowStrategy, type Step, type StepComponent, type StepComponentRetriever, type StepConfig, type StepPropsFactoryRegistry, type StepRegistry, type StepRegistryBaseProps, type StepRegistryConfigs, type StepRegistryHandlers, type StepRegistryParams, type StepRegistryState, type StepperActions, type StepperState$1 as StepperState, StrategyResolutionMode, type StrengthResult, type Subscription, TokenManager, UnauthenticatedState, UrlCleanupHandler, UrlUtils, type UseAuthActionHandler, type UseAuthEventBusProps, type UseFormSubmissionProps, type UseStepRegistryParams, type UseStepperReturn, type UserProfile, type UserProfileResponse, type UserSession, type UserState, UserStorageManager, type UserStoreState, VERIFICATION_SUBMISSION_NAVIGATION, VerificationStep, type VerificationStepProps, type VerifyEmailRequest, type VerifyEmailResponse, config, createAuthSteps, createPropsFactoryRegistry, createStepRegistry, getAuthPageStepMessage, getEmailField, getForgotPasswordField, getPasswordField, getStepForEmailSubmission, getStepForPasswordSubmission, getStepForVerificationSubmission, getStepProgressMessage, getTermsCheckboxField, getVerificationField, isPublicUser, isPublicUserEmail, middlewareMatcher, useAuth, useAuthActionHandler, useAuthEventBus, useAuthFlowModal, useAuthInitializer, useIsAuthenticated, useLogout, usePublicUserSession, useRefreshUser, useSharedEventBus, useSignInRequiredParams, useStepRegistry, useStepRenderer, useStepper, useUser, useUserActions, useUserData, useUserError, useUserLoading, useUserProfile, useUserSelectors, useUserStore, userSelectors };
|