@rdlabo/ionic-angular-kit 22.0.6 → 22.0.7-beta.pr111.sha5d3e06b75932
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/docs/auth-http.md
CHANGED
|
@@ -93,3 +93,24 @@ export const appConfig: ApplicationConfig = {
|
|
|
93
93
|
Automatic retry is limited to `GET`, `HEAD`, `OPTIONS`, or requests carrying an `Idempotency-Key`. Ordinary writes are never retried automatically. Retries cover transient statuses `0`, `408`, `429`, `502`, `503`, and `504`, and honor `Retry-After`.
|
|
94
94
|
|
|
95
95
|
When offline support is enabled, register `offlineInterceptor` before `kitAuthInterceptor`. Local mode then prevents credential generation and network transport while allowing a matched read policy to serve the scoped replica.
|
|
96
|
+
|
|
97
|
+
### Request-owned error notifications
|
|
98
|
+
|
|
99
|
+
`onServerError` receives the server body message for HTTP 400, 409, 422, and 500.
|
|
100
|
+
For requests whose caller displays its own error UI, set the public boolean context token
|
|
101
|
+
`KIT_SKIP_ERROR_NOTIFICATIONS` (default `false`):
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { HttpContext } from '@angular/common/http';
|
|
105
|
+
import { KIT_SKIP_ERROR_NOTIFICATIONS } from '@rdlabo/ionic-angular-kit';
|
|
106
|
+
|
|
107
|
+
http.post('/applications', payload, {
|
|
108
|
+
context: new HttpContext().set(KIT_SKIP_ERROR_NOTIFICATIONS, true),
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
This suppresses only response-error notification hooks: `onUnauthorized`, `onForbidden`,
|
|
113
|
+
`onNetworkError`, `onRateLimited`, `onMaintenance`, `onServerBusy`, and `onServerError`.
|
|
114
|
+
The original error still rejects to the caller. It does not bypass authentication, stop
|
|
115
|
+
401 recovery/replay, change retry or offline-fallback behavior, prevent access revocation
|
|
116
|
+
(`onAuthAccessDenial`), or suppress auth-header failures (`onAuthError`).
|
|
@@ -1767,6 +1767,12 @@ function kitPreloadAuthLoginForNavigation(router, preload) {
|
|
|
1767
1767
|
* `remote` access requirement is deferred until that exchange succeeds.
|
|
1768
1768
|
*/
|
|
1769
1769
|
const KIT_AUTH_BOOTSTRAP_REQUEST = new HttpContextToken(() => false);
|
|
1770
|
+
/**
|
|
1771
|
+
* Suppresses response-error notification hooks for requests whose caller owns the error UI.
|
|
1772
|
+
* Defaults to false. Errors still propagate unchanged; authentication recovery/replay,
|
|
1773
|
+
* access revocation, auth-header failure hooks, retries, and offline fallback remain active.
|
|
1774
|
+
*/
|
|
1775
|
+
const KIT_SKIP_ERROR_NOTIFICATIONS = new HttpContextToken(() => false);
|
|
1770
1776
|
/**
|
|
1771
1777
|
* Marks an auth-recovery replay so {@link KitHttpConfig.recoverAuthAccess} is not invoked again.
|
|
1772
1778
|
*
|
|
@@ -1928,6 +1934,8 @@ const handleTransportError = (config, access, req, error, isAuthBootstrap) => {
|
|
|
1928
1934
|
* @internal
|
|
1929
1935
|
*/
|
|
1930
1936
|
const dispatchError = (config, req, error) => {
|
|
1937
|
+
if (req.context.get(KIT_SKIP_ERROR_NOTIFICATIONS))
|
|
1938
|
+
return;
|
|
1931
1939
|
const status = error.status;
|
|
1932
1940
|
const retryAfterMs = parseRetryAfterMs(error);
|
|
1933
1941
|
const retryAfterSeconds = retryAfterMs === null ? undefined : Math.round(retryAfterMs / 1000);
|
|
@@ -1955,7 +1963,7 @@ const dispatchError = (config, req, error) => {
|
|
|
1955
1963
|
else if ([502, 503, 504].includes(status)) {
|
|
1956
1964
|
config.onServerBusy?.(status, retryAfterSeconds);
|
|
1957
1965
|
}
|
|
1958
|
-
else if ([400, 422, 500].includes(status) && error.error?.message) {
|
|
1966
|
+
else if ([400, 409, 422, 500].includes(status) && error.error?.message) {
|
|
1959
1967
|
config.onServerError?.(error.error.message);
|
|
1960
1968
|
}
|
|
1961
1969
|
// Every other status (404, 418, …) is left to the caller — no generic alert.
|
|
@@ -1980,7 +1988,7 @@ const dispatchError = (config, req, error) => {
|
|
|
1980
1988
|
* For every other error, `offlineFallback` is consulted first; otherwise the error is classified by
|
|
1981
1989
|
* status (see {@link dispatchError}): `401`→`onUnauthorized`, `403`→`onForbidden`, `0`→
|
|
1982
1990
|
* `onNetworkError` (when connected), `429`→`onRateLimited`, maintenance `503`→`onMaintenance`,
|
|
1983
|
-
* other `502`/`503`/`504`→`onServerBusy`, and `400`/`422`/`500` with a body message→`onServerError`.
|
|
1991
|
+
* other `502`/`503`/`504`→`onServerBusy`, and `400`/`409`/`422`/`500` with a body message→`onServerError`.
|
|
1984
1992
|
*
|
|
1985
1993
|
* @param request - The outgoing request.
|
|
1986
1994
|
* @param next - The next handler in the interceptor chain.
|
|
@@ -2835,5 +2843,5 @@ function mountViewModel(host, onMount) {
|
|
|
2835
2843
|
* Generated bundle index. Do not edit.
|
|
2836
2844
|
*/
|
|
2837
2845
|
|
|
2838
|
-
export { AUTH_FAILURE_SCOPES, AUTH_IDENTITY_INVALID_CODE, KIT_AUTH_BOOTSTRAP_REQUEST, KIT_AUTH_CONFIG, KIT_AUTH_RECOVERY_CONFIG, KIT_HTTP_CONFIG, KIT_LAST_AUTH_EMAIL_KEY, KIT_OVERLAY_CONFIG, KIT_REALTIME_CLIENT_ID, KIT_THEME_STORAGE_KEY, KitAuthAccessService, KitAuthInputDirective, KitAuthLoginExchange, KitAuthRecoveryService, KitLoadingController, KitMaintenanceController, KitOverlayController, KitRealtimeConnection, KitRealtimeLivenessWatchdog, KitReloadAlertController, KitStorageService, arrayConcatById, disableHandler, getAuthFailureScope, isExplicitAuthDenial, isIdentityAuthFailure, isMaintenanceError, kitAuthInterceptor, kitChangeEventDisabled, kitClearStoragePreservingKeys, kitCreateDidEnter, kitForgetEmail, kitImpact, kitIsValidEmail, kitKeyboardInit, kitPreloadAuthLoginForNavigation, kitPresentAuthFailedAlert, kitPresentLanguageActionSheet, kitRealtimeProtocols, kitRecallEmail, kitRememberEmail, kitRequireAuthorizedGuard, kitRequireConfirmingGuard, kitRequiredUnauthorizedGuard, mountViewModel, objectEqual, provideKitAuth, provideKitHttp, provideKitOverlay, toKitWebSocketUrl };
|
|
2846
|
+
export { AUTH_FAILURE_SCOPES, AUTH_IDENTITY_INVALID_CODE, KIT_AUTH_BOOTSTRAP_REQUEST, KIT_AUTH_CONFIG, KIT_AUTH_RECOVERY_CONFIG, KIT_HTTP_CONFIG, KIT_LAST_AUTH_EMAIL_KEY, KIT_OVERLAY_CONFIG, KIT_REALTIME_CLIENT_ID, KIT_SKIP_ERROR_NOTIFICATIONS, KIT_THEME_STORAGE_KEY, KitAuthAccessService, KitAuthInputDirective, KitAuthLoginExchange, KitAuthRecoveryService, KitLoadingController, KitMaintenanceController, KitOverlayController, KitRealtimeConnection, KitRealtimeLivenessWatchdog, KitReloadAlertController, KitStorageService, arrayConcatById, disableHandler, getAuthFailureScope, isExplicitAuthDenial, isIdentityAuthFailure, isMaintenanceError, kitAuthInterceptor, kitChangeEventDisabled, kitClearStoragePreservingKeys, kitCreateDidEnter, kitForgetEmail, kitImpact, kitIsValidEmail, kitKeyboardInit, kitPreloadAuthLoginForNavigation, kitPresentAuthFailedAlert, kitPresentLanguageActionSheet, kitRealtimeProtocols, kitRecallEmail, kitRememberEmail, kitRequireAuthorizedGuard, kitRequireConfirmingGuard, kitRequiredUnauthorizedGuard, mountViewModel, objectEqual, provideKitAuth, provideKitHttp, provideKitOverlay, toKitWebSocketUrl };
|
|
2839
2847
|
//# sourceMappingURL=rdlabo-ionic-angular-kit.mjs.map
|