@africanies/angular-web-sdk 0.1.4 → 0.1.5
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/.nx/cache/14876618240301288353/dist/libs/africanies-ui/README.md +68 -0
- package/.nx/cache/14876618240301288353/dist/libs/africanies-ui/assets/brand/africanies-logo-mini.png +0 -0
- package/.nx/cache/14876618240301288353/dist/libs/africanies-ui/assets/brand/africanies-logo.png +0 -0
- package/.nx/cache/14876618240301288353/dist/libs/africanies-ui/assets/brand/africanies-logo.svg +5 -0
- package/.nx/cache/14876618240301288353/dist/libs/africanies-ui/assets/carriers/dhl.svg +7 -0
- package/.nx/cache/14876618240301288353/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs +19375 -0
- package/.nx/cache/14876618240301288353/dist/libs/africanies-ui/fesm2022/africanies-africanies-ui.mjs.map +1 -0
- package/.nx/cache/14876618240301288353/dist/libs/africanies-ui/package.json +35 -0
- package/.nx/cache/14876618240301288353/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +5490 -0
- package/.nx/cache/17626862048742598274/dist/libs/africanies-theme/README.md +46 -0
- package/.nx/cache/17626862048742598274/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs +221 -0
- package/.nx/cache/17626862048742598274/dist/libs/africanies-theme/fesm2022/africanies-africanies-theme.mjs.map +1 -0
- package/.nx/cache/17626862048742598274/dist/libs/africanies-theme/package.json +35 -0
- package/.nx/cache/17626862048742598274/dist/libs/africanies-theme/tailwind-preset.cjs +253 -0
- package/.nx/cache/17626862048742598274/dist/libs/africanies-theme/types/africanies-africanies-theme.d.ts +166 -0
- package/.nx/cache/9040451482998546630/dist/libs/africanies-core/README.md +85 -0
- package/.nx/cache/9040451482998546630/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +4511 -0
- package/.nx/cache/9040451482998546630/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -0
- package/.nx/cache/9040451482998546630/dist/libs/africanies-core/package.json +31 -0
- package/.nx/cache/9040451482998546630/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +2741 -0
- package/.nx/cache/run.json +25 -25
- package/.nx/cache/terminalOutputs/13555699813138069787 +6 -0
- package/.nx/cache/terminalOutputs/14061940909886036014 +173 -0
- package/.nx/cache/terminalOutputs/14876618240301288353 +21 -0
- package/.nx/cache/terminalOutputs/17626862048742598274 +21 -0
- package/.nx/cache/terminalOutputs/7978448102466861029 +32 -0
- package/.nx/cache/terminalOutputs/9040451482998546630 +21 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-shm +0 -0
- package/.nx/workspace-data/0091ABA9-5C90-580D-953C-8C94E763ADB5-v3.db-wal +0 -0
- package/.nx/workspace-data/d/daemon.log +1518 -0
- package/.nx/workspace-data/d/server-process.json +2 -2
- package/.nx/workspace-data/file-map.json +3240 -3240
- package/.nx/workspace-data/nx_files.nxt +0 -0
- package/.nx/workspace-data/project-graph.json +2 -2
- package/apps/playground/src/app/app.routes.ts +15 -4
- package/apps/playground/src/app/app.ts +2 -2
- package/apps/playground/src/app/pages/home-page.ts +14 -14
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs +8 -43
- package/dist/libs/africanies-core/fesm2022/africanies-africanies-core.mjs.map +1 -1
- package/dist/libs/africanies-core/types/africanies-africanies-core.d.ts +6 -5
- package/dist/libs/africanies-ui/types/africanies-africanies-ui.d.ts +11 -11
- package/libs/africanies-core/src/lib/http/api-client.ts +4 -18
- package/libs/africanies-core/src/lib/http/is-retryable-get-error.ts +8 -4
- package/libs/africanies-core/src/lib/query/provide-africanies-query-defaults.ts +5 -6
- package/package.json +1 -1
|
@@ -11,11 +11,9 @@ import {
|
|
|
11
11
|
map,
|
|
12
12
|
Observable,
|
|
13
13
|
of,
|
|
14
|
-
retry,
|
|
15
14
|
tap,
|
|
16
15
|
throwError,
|
|
17
16
|
timeout,
|
|
18
|
-
timer,
|
|
19
17
|
} from 'rxjs';
|
|
20
18
|
|
|
21
19
|
import {
|
|
@@ -30,7 +28,6 @@ import { AFRICANIES_SDK_CONFIG } from '../config/africanies-sdk.config';
|
|
|
30
28
|
import { ShippingModeService } from '../shipping/shipping-mode.service';
|
|
31
29
|
import { formatApiErrorMessage } from './api-error-message';
|
|
32
30
|
import { HttpResponseCache } from './http-cache';
|
|
33
|
-
import { isRetryableGetError } from './is-retryable-get-error';
|
|
34
31
|
import { normalize } from './normalize';
|
|
35
32
|
import {
|
|
36
33
|
resolveApiRequestContext,
|
|
@@ -102,7 +99,8 @@ type ResponseMode = NonNullable<ApiRequestOptions['responseMode']>;
|
|
|
102
99
|
* - HTTP failures rethrown as `Error` whose `.message` is already
|
|
103
100
|
* user-facing ({@link formatApiErrorMessage}) — consumers do not need to
|
|
104
101
|
* parse `HttpErrorResponse` bodies
|
|
105
|
-
* -
|
|
102
|
+
* - **No automatic retry** — fail fast so UIs can show Select / table /
|
|
103
|
+
* error-state Retry instead of a stuck loading spinner
|
|
106
104
|
* - Optional per-GET TTL cache via `cacheTtlMs`
|
|
107
105
|
*
|
|
108
106
|
* @example
|
|
@@ -474,20 +472,8 @@ export class ApiClient {
|
|
|
474
472
|
break;
|
|
475
473
|
}
|
|
476
474
|
|
|
477
|
-
//
|
|
478
|
-
|
|
479
|
-
req$ = req$.pipe(
|
|
480
|
-
retry({
|
|
481
|
-
count: 1,
|
|
482
|
-
delay: (err, retryCount) => {
|
|
483
|
-
if (!isRetryableGetError(err)) {
|
|
484
|
-
return throwError(() => err);
|
|
485
|
-
}
|
|
486
|
-
return timer(2 ** (retryCount - 1) * 1000);
|
|
487
|
-
},
|
|
488
|
-
}),
|
|
489
|
-
);
|
|
490
|
-
}
|
|
475
|
+
// No automatic GET retry — admin shells own Retry via UI
|
|
476
|
+
// (`africanies-select` showRetry, table error→refreshClick, error-state).
|
|
491
477
|
|
|
492
478
|
if (this.config.timeout != null) {
|
|
493
479
|
req$ = req$.pipe(
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { HttpErrorResponse } from '@angular/common/http';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Whether a failed GET
|
|
4
|
+
* Whether a failed GET *would* be a candidate for automatic retry.
|
|
5
|
+
*
|
|
6
|
+
* {@link ApiClient} no longer auto-retries (fail fast for manual UI Retry).
|
|
7
|
+
* Kept for callers/tests that still want to classify transient vs permanent
|
|
8
|
+
* failures.
|
|
9
|
+
*
|
|
10
|
+
* Transient: network blips, timeouts, 408/429, 5xx.
|
|
11
|
+
* Auth and other 4xx fail fast — retrying 401 does not help.
|
|
5
12
|
*
|
|
6
|
-
* Retries transient failures only (network blips, timeouts, 408/429, 5xx).
|
|
7
|
-
* Auth and other 4xx errors fail fast — retrying 401 does not help and causes
|
|
8
|
-
* duplicate requests + toasts.
|
|
9
13
|
* @param err
|
|
10
14
|
*/
|
|
11
15
|
export function isRetryableGetError(err: unknown): boolean {
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* (no caret/tilde): TanStack marks the Angular adapter experimental and
|
|
10
10
|
* breaking changes land without major bumps.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* Query retries default to **0** to match {@link ApiClient} (fail fast;
|
|
13
|
+
* screens use manual Retry). Apps can override per `QueryClient` if needed.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -23,9 +23,9 @@ export interface AfricaniesQueryClientDefaults {
|
|
|
23
23
|
staleTime: number;
|
|
24
24
|
/** Unused-query garbage-collection time (ms). */
|
|
25
25
|
gcTime: number;
|
|
26
|
-
/** Max failed-fetch retries for queries. */
|
|
26
|
+
/** Max failed-fetch retries for queries (default 0 — fail fast). */
|
|
27
27
|
retry: number;
|
|
28
|
-
/**
|
|
28
|
+
/** Delay between retries when {@link AfricaniesQueryClientDefaults.queries.retry} > 0. */
|
|
29
29
|
retryDelay: (attemptIndex: number) => number;
|
|
30
30
|
};
|
|
31
31
|
mutations: {
|
|
@@ -82,8 +82,7 @@ export function createAfricaniesQueryClientDefaults(): AfricaniesQueryClientDefa
|
|
|
82
82
|
queries: {
|
|
83
83
|
staleTime: 60_000,
|
|
84
84
|
gcTime: 5 * 60_000,
|
|
85
|
-
retry:
|
|
86
|
-
// attemptIndex is 0-based in TanStack; match 1s, 2s, 4s style backoff.
|
|
85
|
+
retry: 0,
|
|
87
86
|
retryDelay: (attemptIndex: number) =>
|
|
88
87
|
Math.min(1000 * 2 ** attemptIndex, 30_000),
|
|
89
88
|
},
|