@passflow/core 0.27.0 → 0.28.0
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/README.md +29 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.mjs +1096 -1079
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -854,6 +854,35 @@ try {
|
|
|
854
854
|
}
|
|
855
855
|
```
|
|
856
856
|
|
|
857
|
+
### Service unavailable
|
|
858
|
+
|
|
859
|
+
In a browser, when the Passflow API cannot be reached or its gateway answers 502, 503 or 504 itself,
|
|
860
|
+
an SDK API call rejects with one `PassflowError`:
|
|
861
|
+
|
|
862
|
+
- `id`: `error.service.unavailable`, exported as `SERVICE_UNAVAILABLE_ERROR_ID`
|
|
863
|
+
- `message`: `Passflow is temporarily unavailable. Please try again in a moment.`, exported as
|
|
864
|
+
`SERVICE_UNAVAILABLE_MESSAGE`
|
|
865
|
+
- `status`: the gateway status (502, 503 or 504), or `0` when no answer arrived
|
|
866
|
+
- `cause`: the underlying network error, without the request's config, body or headers
|
|
867
|
+
|
|
868
|
+
```typescript
|
|
869
|
+
import { PassflowError, SERVICE_UNAVAILABLE_ERROR_ID } from "@passflow/core";
|
|
870
|
+
|
|
871
|
+
try {
|
|
872
|
+
await passflow.signIn({ email: "user@example.com", password: "secret" });
|
|
873
|
+
} catch (e) {
|
|
874
|
+
if (e instanceof PassflowError && e.id === SERVICE_UNAVAILABLE_ERROR_ID) {
|
|
875
|
+
showBanner(e.message);
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
It also covers a device that is offline and a request the browser blocked (a gateway answer with no
|
|
881
|
+
CORS headers). The call is not retried; token refresh keeps its own retry schedule. A tab that
|
|
882
|
+
joins another tab's failed token refresh gets `error.refresh.unavailable` instead (see
|
|
883
|
+
[docs/token-refresh.md](docs/token-refresh.md)). An error the Passflow server wrote keeps its own
|
|
884
|
+
id, even with status 503. Calls that wrap their errors in a result object report it in that shape.
|
|
885
|
+
|
|
857
886
|
## API Reference
|
|
858
887
|
|
|
859
888
|
### Passflow Class
|