@alxia/react-router 0.36.1 → 0.37.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 +6 -4
- package/dist/chunks/{index-rgy503w9.js → index-2swe47m6.js} +41 -3
- package/dist/chunks/{index-rgy503w9.js.map → index-2swe47m6.js.map} +5 -4
- package/dist/errors/call-failure.d.ts +1 -1
- package/dist/errors/call-failure.d.ts.map +1 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +18 -2
- package/dist/errors/index.js.map +3 -3
- package/dist/errors/problem-error.d.ts +50 -0
- package/dist/errors/problem-error.d.ts.map +1 -0
- package/dist/errors/route-error.d.ts +3 -1
- package/dist/errors/route-error.d.ts.map +1 -1
- package/dist/session/cookies.d.ts +7 -0
- package/dist/session/cookies.d.ts.map +1 -1
- package/dist/session/index.d.ts +2 -1
- package/dist/session/index.d.ts.map +1 -1
- package/dist/session/index.js +89 -7
- package/dist/session/index.js.map +6 -5
- package/dist/session/serialize.d.ts +9 -3
- package/dist/session/serialize.d.ts.map +1 -1
- package/dist/session/signed.d.ts +44 -0
- package/dist/session/signed.d.ts.map +1 -0
- package/docs/README.md +1 -1
- package/docs/guide/errors.md +32 -1
- package/docs/guide/session.md +50 -1
- package/docs/troubleshooting.md +40 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -838,7 +838,7 @@ banner and the rest.
|
|
|
838
838
|
|
|
839
839
|
`@alxia/react-router/errors` has no UI; its one runtime import is `react-router`, never `@alxia/core`. It
|
|
840
840
|
holds the shape of a GraphQL API's refusal, declared structurally (no `@nxgt/graphql-client` at
|
|
841
|
-
runtime), the request id an API echoes, the page a request is for, the
|
|
841
|
+
runtime), a REST API's RFC 9457 problem reply (`problemError`), the request id an API echoes, the page a request is for, the
|
|
842
842
|
catalogue of the API's messages an app keeps, the words of a form's checks,
|
|
843
843
|
the provider that fills the catalogue in the browser, the wording of a refusal, the loaders and actions that answer with it, the JSON actions (CSRF check) with their fetcher hook, and what a failed call to the API becomes (`apiCallFailure`):
|
|
844
844
|
|
|
@@ -1316,7 +1316,8 @@ From `@alxia/react-router/errors` (`react-router` is its only package import, an
|
|
|
1316
1316
|
| `REQUEST_ID_HEADER`, `requestIdOf(response)` | `x-request-id`, and the id a response carries, if the API sent one |
|
|
1317
1317
|
| `nextOf(url)` | the path and search of the page a request is for, without React Router's `.data`, `/_.data`, `_routes` and empty `index`; it never starts with two slashes, but an app still validates `next` before redirecting to it |
|
|
1318
1318
|
| `FormErrors` | what a form action answers when the API refused the input: `fieldErrors` by field and a `formError` (`undefined` when every message sits under a field), already translated; `submitForm` answers it |
|
|
1319
|
-
| `routeError(error, { statuses? }?)`, `RouteErrorOptions` | what a loader throws for the API's error: an `ApiError` of 401, 403, 404 or 503, or such a `Response` carrying a request id, becomes a route error of that status with the `code`, `message` and `requestId`; any other `ApiError` with an id becomes a 500 carrying the id; anything else is returned as it is |
|
|
1319
|
+
| `routeError(error, { statuses? }?)`, `RouteErrorOptions` | what a loader throws for the API's error: an `ApiError` (or a REST `ProblemError`, which has no `code`) of 401, 403, 404 or 503, or such a `Response` carrying a request id, becomes a route error of that status with the `code`, `message` and `requestId`; any other `ApiError` with an id becomes a 500 carrying the id; anything else is returned as it is |
|
|
1320
|
+
| `problemError(reply, { requestId? }?)`, `ProblemError`, `isProblemErrorLike`, `ProblemErrorLike`, `ProblemReply`, `ProblemErrorOptions` | the typed error (`status`, `title`, `detail`, `type`, `instance`) of a REST API's RFC 9457 problem reply built from `{ status, data }`, `Error <status>` on a non-problem body; `routeError` and `apiCallFailure` recognise it like an `ApiError` |
|
|
1320
1321
|
| `errorRequestId(error)`, `RouteErrorData` | the support reference an error page shows: the `requestId` a route error carries, else `undefined`; `RouteErrorData` is the data `routeError` carries (`code?`, `message?`, `requestId?`) |
|
|
1321
1322
|
| `createApiMessages({ format })`, `ApiMessages`, `ApiMessagesOptions` | the catalogue store of an app, an instance (`set`, `add`, `clear` (for tests), `messageOf`, `format`, `apiMessage(code, values, language)`); `format` is the app's ICU formatter, such as `@nxgt/material`'s `formatMessage` |
|
|
1322
1323
|
| `CatalogueMessage`, `CatalogueMessages`, `ParamKind`, `MessageFormat`, `MessageValues` | one API message with the kind of each argument (`TEXT`, `NUMBER`, `DATE`, `PLURAL`, `SELECT`), a language's messages by code, and the formatter's type |
|
|
@@ -1335,8 +1336,9 @@ From `@alxia/react-router/session` (`react-router` and `/errors`' files are its
|
|
|
1335
1336
|
|
|
1336
1337
|
| export | |
|
|
1337
1338
|
| --- | --- |
|
|
1338
|
-
| `sessionCookies({ session, challenge?, secure, challengePath?, challengeSeconds? })`, `SessionCookies`, `SessionCookiesOptions`, `SessionCookiesWithoutChallengeOptions`, `SessionCookiesBase`, `ChallengeCookies`, `NoChallengeCookies`, `CookieSession` | the session and, when `challenge` is given, second-factor challenge cookies (without it the result is `SessionCookies<false>`, with no challenge helper on the type), `HttpOnly; SameSite=Lax
|
|
1339
|
-
| `
|
|
1339
|
+
| `sessionCookies({ session, challenge?, secure, sameSite?, challengePath?, challengeSeconds? })`, `SessionCookies`, `SessionCookiesOptions`, `SessionCookiesWithoutChallengeOptions`, `SessionCookiesBase`, `ChallengeCookies`, `NoChallengeCookies`, `CookieSession` | the session and, when `challenge` is given, second-factor challenge cookies (without it the result is `SessionCookies<false>`, with no challenge helper on the type), `HttpOnly; SameSite=Lax` (`sameSite: 'strict' \| 'none'` changes it), `__Host-` and `__Secure-` when `secure` (required, never read from the environment): `commit(token, expiresAt)`, `read(request)`, `token(request)`, `destroy()`, `refreshed(session, expiresAt)` (a `Set-Cookie` only when the expiry moved), `commitChallenge`, `challengeOf`, `destroyChallenge` (these three: with a second factor), `signInPageHeaders(deadSession)` and `names` (the cookie names as sent, prefixes included); a cookie written by an app's own code in `<expiry ms>.<token>` is read as it is |
|
|
1340
|
+
| `signedSession({ secret, name, maxAge, secure, sameSite? })`, `SignedSession`, `SignedSessionOptions` | a stateless, tokenless session for one local operator with no Janus: an HMAC-SHA256 over `<expiresAt>.<nonce>`, `__Host-` when `secure`, `HttpOnly; Path=/`: `await commit(now?)`, `destroy()`, `await valid(request, now?)` (Web Crypto, so async; constant time, the expiry inside the signed part, `false` and never a throw on anything malformed) |
|
|
1341
|
+
| `serializeCookie(name, value, { maxAge, path?, secure, sameSite? })`, `readCookie(request, name)`, `secondsUntil(expiresAt, now?)`, `SerializeOptions` | the bytes `sessionCookies` writes, for the cookies of your own; a name that is not an RFC 6265 token throws a `TypeError` |
|
|
1340
1342
|
| `signInFlow({ cookies, errors, json, revoke, attemptsLeft?, paths?, clear?, unavailable?, codes?, endedParam? })`, `SignInFlow`, `SignInFlowOptions`, `SignInFlowWithoutSecondFactorOptions`, `SignInFlowBase`, `SecondFactorSteps` | the server side of the sign-in pages; `attemptsLeft` and cookies with a `challenge` go together (giving only one is a compile error, and a `TypeError` at runtime), and without them the flow is `SignInFlow<L, C, false>`, with no `readCodeInput`, `codeStep`, `codeRefusal` or `attemptsLeft`. It also exposes what it was built with (`cookies`, `errors`, `json`, `attemptsLeft`, `unavailable(language)`, `clear()`) and `guard(request)`, the check an app's own POST step runs first: `nextParam`, `signInRedirect`, `landing`, `landReplacing` (revokes the session the browser held), `signInStep` (a same-site JSON post only; an API refusal as the form's message and status, an unreachable API as a 503), `readCodeInput`, `codeStep`, `codeRefusal` (with the tries left) (these four and `attemptsLeft`: with a second factor), `revokeSession`, `signOut` (JSON and same-origin only; it clears the challenge cookie too), `viewer` (`null` for a 401, `undefined` when unknown) and `requireViewer` (throws the sign-in redirect); `revoke(token, request, context)` gets the caller context (`C`, inferred from the annotation of `revoke`'s third parameter) that `signOut`, `revokeSession`, `landReplacing` and `signInStep` take as `context` |
|
|
1341
1343
|
| `SignInAnswer`, `SignInFormError`, `SignInStayed`, `SignInCodes` | what a step answers (`signedIn`, `secondFactor` or `other`), a form step's answer when it stays on the page, and the `codes` option (`invalidCode`, `challengeOver`) |
|
|
1342
1344
|
| `stepUpSteps({ signIn, spent, locked?, wording?, codes?, onSignedOut? })`, `StepUpSteps`, `StepUpStepsOptions`, `StepUpSignIn`, `StepUpCall` | a step-up for a route's action, reading the sign-in's `errors`, `json` and `attemptsLeft` (and `signInRedirect` with `onSignedOut`): `signIn` is a `signInFlow(...)` or a hand-written object with those members (`StepUpSignIn`), no cast, and `onSignedOut: 'sign-in'` without `signInRedirect` throws a `TypeError`, each step taking `{ request, language }` and refusing a post that is not a same-site JSON one: `request(run, { request, language })` answers the challenge and how it is confirmed (a throttled mail or any 429 is `error: 'throttled'` with `retryAfter`), `confirm(run, { request, language, via? })` answers `error: 'invalid'` with the tries left (and `locked: true` for an app or recovery code with none left), `expired` or `failed`; `request` and `confirm` answer `throttled` with `retryAfter` on any 429 (on `confirm` the challenge and its tries stay, `locked: false`); and `isStepUpRequired(error)`; and `route(run, { request, language })`, the whole action of one resource route that any page posts `request-step-up` and `confirm-step-up` to (`run.request()`, `run.confirm({ challenge, code })`; `StepUpRun`); with `onSignedOut: 'sign-in'` it throws the sign-in redirect for a signed-out user (an `ApiError` with `codes.unauthenticated`, default `'UNAUTHENTICATED'`; from `request` also a bare 401 response, from `confirm` never), `next` being a same-site `Referer`'s page, else the route's own path, while a wrong code stays a refusal; `wording`, when it returns a string for a `codes.challengeOver` code, words an ended challenge instead of `spent` (which stays the text when the tries run out) |
|
|
@@ -46,6 +46,37 @@ var isUnavailableError = (error) => isNamed(error, "ApiUnavailableError") && typ
|
|
|
46
46
|
// src/errors/route-error.ts
|
|
47
47
|
import { data } from "react-router";
|
|
48
48
|
|
|
49
|
+
// src/errors/problem-error.ts
|
|
50
|
+
var text = (value) => typeof value === "string" && value ? value : undefined;
|
|
51
|
+
|
|
52
|
+
class ProblemError2 extends Error {
|
|
53
|
+
name = "ProblemError";
|
|
54
|
+
status;
|
|
55
|
+
title;
|
|
56
|
+
detail;
|
|
57
|
+
type;
|
|
58
|
+
instance;
|
|
59
|
+
requestId;
|
|
60
|
+
constructor(reply, { requestId } = {}) {
|
|
61
|
+
const body = typeof reply.data === "object" && reply.data !== null ? reply.data : {};
|
|
62
|
+
const title = text(body.title) ?? `Error ${reply.status}`;
|
|
63
|
+
const detail = text(body.detail);
|
|
64
|
+
super(detail ?? title);
|
|
65
|
+
this.status = reply.status;
|
|
66
|
+
this.title = title;
|
|
67
|
+
this.detail = detail;
|
|
68
|
+
this.type = text(body.type);
|
|
69
|
+
this.instance = text(body.instance);
|
|
70
|
+
this.requestId = requestId;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function problemError2(reply, options) {
|
|
74
|
+
return new ProblemError2(reply, options);
|
|
75
|
+
}
|
|
76
|
+
function isProblemErrorLike2(error) {
|
|
77
|
+
return isNamed(error, "ProblemError") && typeof error.status === "number";
|
|
78
|
+
}
|
|
79
|
+
|
|
49
80
|
// src/errors/request-id.ts
|
|
50
81
|
var REQUEST_ID_HEADER2 = "x-request-id";
|
|
51
82
|
function requestIdOf2(response) {
|
|
@@ -62,6 +93,13 @@ function routeError2(error, { statuses = ROUTED } = {}) {
|
|
|
62
93
|
}
|
|
63
94
|
return requestId ? data({ requestId }, { status: 500 }) : error;
|
|
64
95
|
}
|
|
96
|
+
if (isProblemErrorLike2(error)) {
|
|
97
|
+
const { requestId } = error;
|
|
98
|
+
if (statuses.has(error.status)) {
|
|
99
|
+
return data({ message: error.message, requestId }, { status: error.status });
|
|
100
|
+
}
|
|
101
|
+
return requestId ? data({ requestId }, { status: 500 }) : error;
|
|
102
|
+
}
|
|
65
103
|
if (error instanceof Response && statuses.has(error.status)) {
|
|
66
104
|
const requestId = requestIdOf2(error);
|
|
67
105
|
if (requestId) {
|
|
@@ -119,7 +157,7 @@ function refuseCrossSite(actions, request) {
|
|
|
119
157
|
(typeof check === "function" ? check : siteCheck())(request);
|
|
120
158
|
}
|
|
121
159
|
|
|
122
|
-
export { isApiErrorLike2, waitMinutes2, retryAfterOf2, attemptsLeftOf2, valuesOf, isStatusError, isUnavailableError, REQUEST_ID_HEADER2, requestIdOf2, routeError2, errorRequestId2, nextOf2, siteCheck, rememberSiteCheck, hasSiteCheck, refuseCrossSite };
|
|
160
|
+
export { isApiErrorLike2, waitMinutes2, retryAfterOf2, attemptsLeftOf2, valuesOf, isStatusError, isUnavailableError, ProblemError2, problemError2, isProblemErrorLike2, REQUEST_ID_HEADER2, requestIdOf2, routeError2, errorRequestId2, nextOf2, siteCheck, rememberSiteCheck, hasSiteCheck, refuseCrossSite };
|
|
123
161
|
|
|
124
|
-
//# debugId=
|
|
125
|
-
//# sourceMappingURL=index-
|
|
162
|
+
//# debugId=A88B070738C15B2B64756E2164756E21
|
|
163
|
+
//# sourceMappingURL=index-2swe47m6.js.map
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/errors/api-error.ts", "../src/errors/route-error.ts", "../src/errors/request-id.ts", "../src/errors/page-path.ts", "../src/errors/same-site.ts"],
|
|
3
|
+
"sources": ["../src/errors/api-error.ts", "../src/errors/route-error.ts", "../src/errors/problem-error.ts", "../src/errors/request-id.ts", "../src/errors/page-path.ts", "../src/errors/same-site.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * The shape of an API's refusal, as `@nxgt/graphql-client`'s `ApiError`\n * carries it, declared structurally: `/errors` never imports the client, so\n * an app needs it only if it calls the API through it. `api-error.spec.ts`\n * holds the two in step.\n */\n\n/** One refused input field: `extensions.fields` of a validation refusal. */\nexport interface ApiFieldErrorLike {\n\treadonly path: string;\n\treadonly code: string;\n\treadonly message: string;\n\t/** The values the field's message interpolates. */\n\treadonly params?: Readonly<Record<string, unknown>>;\n}\n\n/** The values a message interpolates; a throttle's wait is `minutes` or `retryAfter`. */\nexport interface ApiErrorParamsLike {\n\treadonly minutes?: unknown;\n\treadonly retryAfter?: unknown;\n\treadonly attemptsLeft?: unknown;\n\treadonly [key: string]: unknown;\n}\n\n/**\n * One GraphQL error's `extensions`. `code` is the API's own\n * `<module>.errors.<slug>`; the rest is what its messages name.\n */\nexport interface ApiErrorExtensionsLike {\n\treadonly code?: string;\n\t/** The values the message interpolates, when the API sends them. */\n\treadonly params?: ApiErrorParamsLike;\n\t/** A validation refusal: every field at fault, by input path. */\n\treadonly fields?: readonly ApiFieldErrorLike[];\n\t/** Any other refusal about one input field, by its path. */\n\treadonly field?: string;\n\t/** A throttle's wait, in minutes (`waitMinutes` coerces a string). */\n\treadonly minutes?: unknown;\n\t/** A throttle's wait, in seconds. */\n\treadonly retryAfter?: unknown;\n\t/** The tries a refused code leaves, as `@nxgt/janus` counts them. */\n\treadonly attemptsLeft?: unknown;\n\treadonly [key: string]: unknown;\n}\n\n/** One error of a response's `errors`. */\nexport interface ApiErrorEntryLike {\n\treadonly message: string;\n\treadonly extensions?: ApiErrorExtensionsLike;\n}\n\n/** A refusal read from a GraphQL API: what `ApiError` has, and the request id. */\nexport interface ApiErrorLike extends Error {\n\treadonly errors: readonly ApiErrorEntryLike[];\n\t/** The first error's `extensions.code`. */\n\treadonly code: string | undefined;\n\t/** The HTTP status to answer with. */\n\treadonly status: number;\n\t/** The id the API logged the request under, when the caller kept it. */\n\treadonly requestId?: string;\n}\n\n/** Whether `error` is an `Error` of this `name`: the client's errors are told by it, never `instanceof`. */\nexport const isNamed = (error: unknown, name: string): error is Error =>\n\terror instanceof Error && error.name === name;\n\n/**\n * Whether `error` is an `ApiError` of `@nxgt/graphql-client`, by the test\n * that client's `isApiError` makes (an `Error` named `ApiError` with an\n * `errors` array), plus a numeric `status`, which `ApiErrorLike` promises.\n * It holds across two copies of the client.\n */\nexport function isApiErrorLike(error: unknown): error is ApiErrorLike {\n\treturn (\n\t\tisNamed(error, 'ApiError') &&\n\t\tArray.isArray((error as { errors?: unknown }).errors) &&\n\t\ttypeof (error as { status?: unknown }).status === 'number'\n\t);\n}\n\n/**\n * The minutes a wait lasts, as the API words it: `minutes` (at least one, in\n * `extensions.params` or beside it), else the `retryAfter` seconds rounded\n * up, else one.\n */\nexport function waitMinutes(\n\textensions: ApiErrorExtensionsLike | undefined,\n): number {\n\tconst minutes = extensions?.params?.minutes ?? extensions?.minutes;\n\tif (minutes !== undefined) return Math.max(1, Number(minutes) || 1);\n\tconst seconds = extensions?.params?.retryAfter ?? extensions?.retryAfter;\n\treturn Math.max(1, Math.ceil(Number(seconds) / 60) || 1);\n}\n\nconst MAX_RETRY_AFTER = 86_400;\n\n/** A wait in seconds from one value: a finite number from 0, or a decimal string. */\nfunction secondsOf(value: unknown): number | undefined {\n\tconst seconds =\n\t\ttypeof value === 'string' && /^\\d+(\\.\\d+)?$/.test(value.trim())\n\t\t\t? Number(value.trim())\n\t\t\t: value;\n\treturn typeof seconds === 'number' && Number.isFinite(seconds) && seconds >= 0\n\t\t? Math.min(MAX_RETRY_AFTER, Math.ceil(seconds)) + 0\n\t\t: undefined;\n}\n\n/**\n * The seconds a throttle asks to wait: `retryAfter` of the first error's\n * `extensions.params`, else (when that is unusable) of its `extensions`.\n * Only a finite number from 0, or a decimal string, counts; it is rounded up\n * and held at a day (86 400), and `-0` is 0. `undefined` when the API sent\n * none usable. Exported from `/errors`; `/session` words it as a typed\n * `retryAfter`.\n */\nexport function retryAfterOf(error: ApiErrorLike): number | undefined {\n\tconst extensions = error.errors[0]?.extensions;\n\treturn (\n\t\tsecondsOf(extensions?.params?.retryAfter) ??\n\t\tsecondsOf(extensions?.retryAfter)\n\t);\n}\n\n/**\n * The tries a refused code leaves, as `@nxgt/janus` counts them:\n * `extensions.attemptsLeft` of the first error, else the same key in its\n * `params`. A whole number from 0 up; `undefined` when the API sent none or\n * something that is not a count.\n */\nexport function attemptsLeftOf(error: ApiErrorLike): number | undefined {\n\tconst extensions = error.errors[0]?.extensions;\n\tfor (const value of [\n\t\textensions?.attemptsLeft,\n\t\textensions?.params?.attemptsLeft,\n\t]) {\n\t\tif (typeof value === 'number' && Number.isInteger(value) && value >= 0) {\n\t\t\treturn value;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * The values a message names: `extensions.params` over the extensions\n * themselves, where older errors and the extras of a few sit.\n */\nexport function valuesOf(\n\textensions: ApiErrorExtensionsLike | undefined,\n): Record<string, unknown> | undefined {\n\tif (!extensions) return undefined;\n\treturn extensions.params\n\t\t? { ...extensions, ...extensions.params }\n\t\t: extensions;\n}\n\n/** `@nxgt/graphql-client`'s `ApiStatusError`, as far as the failure reads it. */\nexport interface StatusErrorLike extends Error {\n\tstatus: number;\n\tstatusText?: string | undefined;\n\tbody?: unknown;\n}\n\n/** `@nxgt/graphql-client`'s `ApiUnavailableError`, as far as the failure reads it. */\nexport interface UnavailableErrorLike extends Error {\n\treason: string;\n}\n\nexport const isStatusError = (error: unknown): error is StatusErrorLike =>\n\tisNamed(error, 'ApiStatusError') &&\n\ttypeof (error as { status?: unknown }).status === 'number';\n\nexport const isUnavailableError = (\n\terror: unknown,\n): error is UnavailableErrorLike =>\n\tisNamed(error, 'ApiUnavailableError') &&\n\ttypeof (error as { reason?: unknown }).reason === 'string';\n",
|
|
6
|
-
"import { data } from 'react-router';\nimport { isApiErrorLike } from './api-error';\nimport { requestIdOf } from './request-id';\n\n/** The statuses an error page words: unauthenticated, forbidden, missing, unavailable. */\nconst ROUTED: ReadonlySet<number> = new Set([401, 403, 404, 503]);\n\n/**\n * What a route error of the API carries to the error page: the API's code\n * and message when it gave a code, and the `X-Request-Id` of the call as the\n * support reference (`errorRequestId`).\n */\nexport type RouteErrorData = {\n\tcode?: string | undefined;\n\tmessage?: string | undefined;\n\trequestId?: string | undefined;\n};\n\nexport interface RouteErrorOptions {\n\t/** The statuses that become a route error of their own; 401, 403, 404 and 503 by default. */\n\tstatuses?: ReadonlySet<number>;\n}\n\n/**\n * What a loader throws for an error from the API: an `ApiError` whose\n * status is routed (401, 403, 404 or 503) becomes a route error response of\n * that status, which the root `ErrorBoundary` renders as its page, with the\n * call's request id when the API gave one. A thrown routed `Response` that\n * carries a request id becomes one too (a bare `Response` hands the browser\n * its body only). Any other `ApiError` that has a request id becomes a 500\n * with just that id, so the generic error page can show it. Anything else\n * is returned as it is.\n */\nexport function routeError(\n\terror: unknown,\n\t{ statuses = ROUTED }: RouteErrorOptions = {},\n): unknown {\n\tif (isApiErrorLike(error)) {\n\t\tconst { requestId } = error;\n\t\tif (statuses.has(error.status)) {\n\t\t\treturn data<RouteErrorData>(\n\t\t\t\t{ code: error.code, message: error.message, requestId },\n\t\t\t\t{ status: error.status },\n\t\t\t);\n\t\t}\n\t\treturn requestId\n\t\t\t? data<RouteErrorData>({ requestId }, { status: 500 })\n\t\t\t: error;\n\t}\n\tif (error instanceof Response && statuses.has(error.status)) {\n\t\tconst requestId = requestIdOf(error);\n\t\tif (requestId) {\n\t\t\treturn data<RouteErrorData>({ requestId }, { status: error.status });\n\t\t}\n\t}\n\treturn error;\n}\n\n/**\n * The support reference an error page shows: the API's `X-Request-Id` a\n * route error carries (`routeError`), if it carries one.\n */\nexport function errorRequestId(error: unknown): string | undefined {\n\tif (typeof error !== 'object' || error === null) return undefined;\n\tconst { data: body } = error as { data?: unknown };\n\tif (typeof body !== 'object' || body === null) return undefined;\n\tconst { requestId } = body as { requestId?: unknown };\n\treturn typeof requestId === 'string' && requestId ? requestId : undefined;\n}\n",
|
|
6
|
+
"import { data } from 'react-router';\nimport { isApiErrorLike } from './api-error';\nimport { isProblemErrorLike } from './problem-error';\nimport { requestIdOf } from './request-id';\n\n/** The statuses an error page words: unauthenticated, forbidden, missing, unavailable. */\nconst ROUTED: ReadonlySet<number> = new Set([401, 403, 404, 503]);\n\n/**\n * What a route error of the API carries to the error page: the API's code\n * and message when it gave a code, and the `X-Request-Id` of the call as the\n * support reference (`errorRequestId`).\n */\nexport type RouteErrorData = {\n\tcode?: string | undefined;\n\tmessage?: string | undefined;\n\trequestId?: string | undefined;\n};\n\nexport interface RouteErrorOptions {\n\t/** The statuses that become a route error of their own; 401, 403, 404 and 503 by default. */\n\tstatuses?: ReadonlySet<number>;\n}\n\n/**\n * What a loader throws for an error from the API: an `ApiError` whose\n * status is routed (401, 403, 404 or 503) becomes a route error response of\n * that status, which the root `ErrorBoundary` renders as its page, with the\n * call's request id when the API gave one. A thrown routed `Response` that\n * carries a request id becomes one too (a bare `Response` hands the browser\n * its body only). Any other `ApiError` that has a request id becomes a 500\n * with just that id, so the generic error page can show it. A `ProblemError`\n * (`problemError`, a REST API's RFC 9457 reply) is treated alike, its message\n * being the problem's detail or title. Anything else\n * is returned as it is.\n */\nexport function routeError(\n\terror: unknown,\n\t{ statuses = ROUTED }: RouteErrorOptions = {},\n): unknown {\n\tif (isApiErrorLike(error)) {\n\t\tconst { requestId } = error;\n\t\tif (statuses.has(error.status)) {\n\t\t\treturn data<RouteErrorData>(\n\t\t\t\t{ code: error.code, message: error.message, requestId },\n\t\t\t\t{ status: error.status },\n\t\t\t);\n\t\t}\n\t\treturn requestId\n\t\t\t? data<RouteErrorData>({ requestId }, { status: 500 })\n\t\t\t: error;\n\t}\n\tif (isProblemErrorLike(error)) {\n\t\tconst { requestId } = error;\n\t\tif (statuses.has(error.status)) {\n\t\t\treturn data<RouteErrorData>(\n\t\t\t\t{ message: error.message, requestId },\n\t\t\t\t{ status: error.status },\n\t\t\t);\n\t\t}\n\t\treturn requestId\n\t\t\t? data<RouteErrorData>({ requestId }, { status: 500 })\n\t\t\t: error;\n\t}\n\tif (error instanceof Response && statuses.has(error.status)) {\n\t\tconst requestId = requestIdOf(error);\n\t\tif (requestId) {\n\t\t\treturn data<RouteErrorData>({ requestId }, { status: error.status });\n\t\t}\n\t}\n\treturn error;\n}\n\n/**\n * The support reference an error page shows: the API's `X-Request-Id` a\n * route error carries (`routeError`), if it carries one.\n */\nexport function errorRequestId(error: unknown): string | undefined {\n\tif (typeof error !== 'object' || error === null) return undefined;\n\tconst { data: body } = error as { data?: unknown };\n\tif (typeof body !== 'object' || body === null) return undefined;\n\tconst { requestId } = body as { requestId?: unknown };\n\treturn typeof requestId === 'string' && requestId ? requestId : undefined;\n}\n",
|
|
7
|
+
"import { isNamed } from './api-error';\n\n/** A reply of a REST/OpenAPI client, as far as `problemError` reads it: `{ status, data }`. */\nexport interface ProblemReply {\n\treadonly status: number;\n\t/** The parsed body; a problem document (RFC 9457) when the API refused. */\n\treadonly data?: unknown;\n}\n\nexport interface ProblemErrorOptions {\n\t/** The `x-request-id` the API answered (`requestIdOf(response)`). */\n\trequestId?: string | undefined;\n}\n\n/** A refusal read from a REST API's RFC 9457 problem reply. */\nexport interface ProblemErrorLike extends Error {\n\t/** The HTTP status of the reply. */\n\treadonly status: number;\n\t/** The problem's `title`, else `Error <status>`. */\n\treadonly title: string;\n\t/** The problem's `detail`, when it has one. */\n\treadonly detail?: string | undefined;\n\t/** The problem's `type` URI, when it has one. */\n\treadonly type?: string | undefined;\n\t/** The problem's `instance` URI, when it has one. */\n\treadonly instance?: string | undefined;\n\t/** The id the API logged the request under, when the caller kept it. */\n\trequestId?: string | undefined;\n}\n\nconst text = (value: unknown): string | undefined =>\n\ttypeof value === 'string' && value ? value : undefined;\n\n/**\n * The error of an RFC 9457 problem reply. Its `message` is the problem's\n * `detail`, else its `title`, else `Error <status>`.\n */\nexport class ProblemError extends Error implements ProblemErrorLike {\n\toverride readonly name = 'ProblemError';\n\treadonly status: number;\n\treadonly title: string;\n\treadonly detail: string | undefined;\n\treadonly type: string | undefined;\n\treadonly instance: string | undefined;\n\trequestId: string | undefined;\n\n\tconstructor(reply: ProblemReply, { requestId }: ProblemErrorOptions = {}) {\n\t\tconst body =\n\t\t\ttypeof reply.data === 'object' && reply.data !== null\n\t\t\t\t? (reply.data as {\n\t\t\t\t\t\ttitle?: unknown;\n\t\t\t\t\t\tdetail?: unknown;\n\t\t\t\t\t\ttype?: unknown;\n\t\t\t\t\t\tinstance?: unknown;\n\t\t\t\t\t})\n\t\t\t\t: {};\n\t\tconst title = text(body.title) ?? `Error ${reply.status}`;\n\t\tconst detail = text(body.detail);\n\t\tsuper(detail ?? title);\n\t\tthis.status = reply.status;\n\t\tthis.title = title;\n\t\tthis.detail = detail;\n\t\tthis.type = text(body.type);\n\t\tthis.instance = text(body.instance);\n\t\tthis.requestId = requestId;\n\t}\n}\n\n/**\n * Turns a REST/OpenAPI client's `{ status, data }` reply into a\n * `ProblemError`; a body that is not a problem document gives `Error <status>`.\n */\nexport function problemError(\n\treply: ProblemReply,\n\toptions?: ProblemErrorOptions,\n): ProblemError {\n\treturn new ProblemError(reply, options);\n}\n\n/**\n * Whether `error` is a `ProblemError`, told by its name and a numeric\n * `status`, never `instanceof`, so it holds across two copies of the package.\n */\nexport function isProblemErrorLike(error: unknown): error is ProblemErrorLike {\n\treturn (\n\t\tisNamed(error, 'ProblemError') &&\n\t\ttypeof (error as { status?: unknown }).status === 'number'\n\t);\n}\n",
|
|
7
8
|
"/** The header an API echoes on every response: the id its logs carry. */\nexport const REQUEST_ID_HEADER = 'x-request-id';\n\n/** The request id a response carries, if the API sent one. */\nexport function requestIdOf(response: Response): string | undefined {\n\treturn response.headers.get(REQUEST_ID_HEADER) || undefined;\n}\n",
|
|
8
9
|
"/**\n * The page a request is for, as `next` carries it back after sign-in: its\n * path and search, without React Router's single-fetch details. A client\n * navigation's `request.url` is `/todos/demo/list.data?q=a&_routes=…`\n * (`/_.data` for `/`, `?index` for an index action), as the server\n * runtime's own `normalizeUrl` strips them.\n */\nexport function nextOf(url: string): string {\n\tconst { pathname, searchParams } = new URL(url);\n\tconst trimmed = pathname.endsWith('/_.data')\n\t\t? pathname.slice(0, -'_.data'.length)\n\t\t: pathname.replace(/\\.data$/, '');\n\t// `new URL('http://h/\\\\evil.com')` has the path `//evil.com`: never let a\n\t// `next` start with two slashes, which a redirect reads as another site.\n\tconst path = trimmed.replace(/^\\/{2,}/, '/');\n\tconst params = new URLSearchParams(searchParams);\n\tparams.delete('_routes');\n\t// An empty `index` names the index route; a valued one is the page's own.\n\tfor (const value of params.getAll('index')) {\n\t\tif (!value) params.delete('index', value);\n\t}\n\tconst search = params.toString();\n\treturn search ? `${path}?${search}` : path;\n}\n",
|
|
9
10
|
"import { data } from 'react-router';\nimport { isCrossSite } from './cross-site';\n\n/** Refuses a request from another site with a 403; reads headers only. */\nexport type SiteCheck = (request: Request) => void;\n\n/**\n * The same-site rule of `readJson`: an `Origin` that is not the app's own, or\n * a `Sec-Fetch-Site` that is neither `same-origin` nor `none`, is a 403.\n * `origin` is the app's configured origin (or a getter), else the request's.\n */\nexport function siteCheck(\n\torigin?: string | (() => string | undefined) | undefined,\n): SiteCheck {\n\treturn (request) => {\n\t\tconst set = typeof origin === 'function' ? origin() : origin;\n\t\tif (isCrossSite(request, set)) {\n\t\t\tthrow data('Cross-site request refused', { status: 403 });\n\t\t}\n\t};\n}\n\n/**\n * Where a `jsonActions` instance keeps its site check: an enumerable property\n * under a registered symbol, so it survives `{ ...json }` and a second copy of\n * the package. Not public.\n */\nexport const SITE_CHECK = Symbol.for('@alxia/react-router:site-check@1');\n\n/** Puts the check on a `jsonActions` instance. */\nexport function rememberSiteCheck(actions: object, check: SiteCheck): void {\n\tObject.defineProperty(actions, SITE_CHECK, {\n\t\tvalue: check,\n\t\tenumerable: true,\n\t\twritable: false,\n\t});\n}\n\n/** Whether `actions` carries a site check, as every `jsonActions()` instance does. */\nexport const hasSiteCheck = (actions: object): boolean =>\n\ttypeof (actions as Record<symbol, unknown>)[SITE_CHECK] === 'function';\n\n/**\n * Refuses a cross-site request with the rule of the `jsonActions` instance\n * (its configured origin, read at each request); an object without a check\n * gets the request's own origin. It reads headers only, never the body.\n */\nexport function refuseCrossSite(actions: object, request: Request): void {\n\tconst check = (actions as Record<symbol, unknown>)[SITE_CHECK];\n\t(typeof check === 'function' ? (check as SiteCheck) : siteCheck())(request);\n}\n"
|
|
10
11
|
],
|
|
11
|
-
"mappings": ";;;;;AA+DO,IAAM,UAAU,CAAC,OAAgB,SACvC,iBAAiB,SAAS,MAAM,SAAS;AAQnC,SAAS,eAAc,CAAC,OAAuC;AAAA,EACrE,OACC,QAAQ,OAAO,UAAU,KACzB,MAAM,QAAS,MAA+B,MAAM,KACpD,OAAQ,MAA+B,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AM,eAAe,CAAC,YAC5B,OAAQ,QAAoC,gBAAgB;AAOtD,SAAS,eAAe,CAAC,SAAiB,SAAwB;AAAA,EACxE,MAAM,QAAS,QAAoC;AAAA,GAClD,OAAO,UAAU,aAAc,QAAsB,UAAU,GAAG,OAAO;AAAA;",
|
|
13
|
+
"debugId": "A88B070738C15B2B64756E2164756E21",
|
|
13
14
|
"names": []
|
|
14
15
|
}
|
|
@@ -14,7 +14,7 @@ export interface CallFailureOptions {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* What a call became once it failed, for a loader or an action to throw: the
|
|
17
|
-
* `ApiError` as it is (carrying `requestId`), a `Response` of the API's own
|
|
17
|
+
* `ApiError` or `ProblemError` as it is (carrying `requestId`), a `Response` of the API's own
|
|
18
18
|
* status for a 401, 403 or 404 without a GraphQL body, a 503 `Response` (with no body; the reason is in the log) for an
|
|
19
19
|
* unreachable, slow, garbled or aborted API, and any other error as it is.
|
|
20
20
|
* Every case it recognises is logged with the request id, when the API gave one, and never
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-failure.d.ts","sourceRoot":"","sources":["../../src/errors/call-failure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"call-failure.d.ts","sourceRoot":"","sources":["../../src/errors/call-failure.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,kBAAkB;IAClC,0FAA0F;IAC1F,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,8GAA8G;IAC9G,aAAa,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,gDAAgD;IAChD,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,OAAO,EACd,EACC,GAAG,EACH,SAAuB,EACvB,SAAS,EACT,MAAM,EACN,aAA8B,EAC9B,GAAG,EAAE,MAAgB,GACrB,EAAE,kBAAkB,GACnB,OAAO,CAgDT;AAED,uFAAuF;AACvF,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,WAAW,EAAE,SAAS;QAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACxC,QAAQ,CAAC,IAAI,CAAC,EAAE;YAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;SAAE,GAAG,SAAS,CAAC;KACvD,EAAE,CAAC;CACJ;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAO5D"}
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type { FormRefusal } from './form-refusal';
|
|
|
9
9
|
export { type JsonActions, type JsonActionsOptions, jsonActions, } from './json-actions';
|
|
10
10
|
export { type ApiMessages, type ApiMessagesOptions, type CatalogueMessage, type CatalogueMessages, createApiMessages, type MessageFormat, type MessageValues, type ParamKind, } from './messages';
|
|
11
11
|
export { nextOf } from './page-path';
|
|
12
|
+
export { isProblemErrorLike, ProblemError, type ProblemErrorLike, type ProblemErrorOptions, type ProblemReply, problemError, } from './problem-error';
|
|
12
13
|
export { ApiMessagesProvider, type ApiMessagesProviderProps, } from './provider';
|
|
13
14
|
export { REQUEST_ID_HEADER, requestIdOf } from './request-id';
|
|
14
15
|
export { errorRequestId, type RouteErrorData, type RouteErrorOptions, routeError, } from './route-error';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,sBAA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Ae,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,KAAK,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,WAAW,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,eAAe,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACN,cAAc,EACd,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,aAAa,GACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,KAAK,cAAc,EACnB,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,qBAAqB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,eAAe,EACf,KAAK,aAAa,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,WAAW,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,iBAAiB,EACjB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,SAAS,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACN,kBAAkB,EAClB,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,YAAY,GACZ,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACN,mBAAmB,EACnB,KAAK,wBAAwB,GAC7B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EACN,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,UAAU,GACV,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,KAAK,QAAQ,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/errors/index.js
CHANGED
|
@@ -6,6 +6,9 @@ import {
|
|
|
6
6
|
valuesOf,
|
|
7
7
|
isStatusError,
|
|
8
8
|
isUnavailableError,
|
|
9
|
+
ProblemError2,
|
|
10
|
+
problemError2,
|
|
11
|
+
isProblemErrorLike2,
|
|
9
12
|
REQUEST_ID_HEADER2,
|
|
10
13
|
requestIdOf2,
|
|
11
14
|
routeError2,
|
|
@@ -13,7 +16,7 @@ import {
|
|
|
13
16
|
nextOf2,
|
|
14
17
|
siteCheck,
|
|
15
18
|
rememberSiteCheck
|
|
16
|
-
} from "../chunks/index-
|
|
19
|
+
} from "../chunks/index-2swe47m6.js";
|
|
17
20
|
// src/errors/code-resolver.ts
|
|
18
21
|
var API_CODE = /^[a-z][a-zA-Z0-9-]*\.errors\.[a-z0-9-]+$/;
|
|
19
22
|
function paramsCode(issue) {
|
|
@@ -214,6 +217,16 @@ function apiCallFailure(error, {
|
|
|
214
217
|
log.warn(line);
|
|
215
218
|
return error;
|
|
216
219
|
}
|
|
220
|
+
if (isProblemErrorLike2(error)) {
|
|
221
|
+
if (requestId)
|
|
222
|
+
error.requestId = requestId;
|
|
223
|
+
const line = `${call} answered ${error.status}`;
|
|
224
|
+
if (error.status >= 500)
|
|
225
|
+
log.error(line);
|
|
226
|
+
else
|
|
227
|
+
log.warn(line);
|
|
228
|
+
return error;
|
|
229
|
+
}
|
|
217
230
|
if (isStatusError(error)) {
|
|
218
231
|
if (passedThrough.has(error.status)) {
|
|
219
232
|
log.warn(`${call} answered ${error.status}`);
|
|
@@ -543,6 +556,7 @@ function useJsonFetcher(key, action) {
|
|
|
543
556
|
}
|
|
544
557
|
export {
|
|
545
558
|
ApiMessagesProvider,
|
|
559
|
+
ProblemError2 as ProblemError,
|
|
546
560
|
REQUEST_ID_HEADER2 as REQUEST_ID_HEADER,
|
|
547
561
|
apiCallFailure,
|
|
548
562
|
apiCodeResolver,
|
|
@@ -552,9 +566,11 @@ export {
|
|
|
552
566
|
createErrorCatalogue,
|
|
553
567
|
errorRequestId2 as errorRequestId,
|
|
554
568
|
isApiErrorLike2 as isApiErrorLike,
|
|
569
|
+
isProblemErrorLike2 as isProblemErrorLike,
|
|
555
570
|
jsonActions,
|
|
556
571
|
nextOf2 as nextOf,
|
|
557
572
|
operationName,
|
|
573
|
+
problemError2 as problemError,
|
|
558
574
|
requestIdOf2 as requestIdOf,
|
|
559
575
|
retryAfterOf2 as retryAfterOf,
|
|
560
576
|
routeError2 as routeError,
|
|
@@ -562,5 +578,5 @@ export {
|
|
|
562
578
|
waitMinutes2 as waitMinutes
|
|
563
579
|
};
|
|
564
580
|
|
|
565
|
-
//# debugId=
|
|
581
|
+
//# debugId=9CF68A4852A1305F64756E2164756E21
|
|
566
582
|
//# sourceMappingURL=index.js.map
|
package/dist/errors/index.js.map
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"import { valuesOf } from './api-error';\nimport type { ApiErrors, ApiErrorsOptions } from './api-errors';\nimport { API_CODE } from './code-resolver';\nimport { fieldErrorsOf, refusalOf } from './describe-refusal';\nimport { fetcherRefusal, fetcherResult } from './fetcher-result';\nimport { formRefusal } from './form-refusal';\nimport { submitForm } from './submit-form';\n\nexport function describeApiErrors<L extends string>({\n\tmessages,\n\tunavailable,\n\trefused,\n\treword,\n\tbyCode = {},\n\tisApiCode = (code) => API_CODE.test(code),\n}: ApiErrorsOptions<L>): ApiErrors<L> {\n\tconst translateCode: ApiErrors<L>['translateCode'] = (\n\t\tcode,\n\t\tfallback,\n\t\tlanguage,\n\t\tvalues,\n\t) => {\n\t\tif (!code) return fallback;\n\t\treturn messages.apiMessage(code, values, language) ?? fallback;\n\t};\n\n\tconst apiErrorMessage: ApiErrors<L>['apiErrorMessage'] = (\n\t\terror,\n\t\tlanguage,\n\t) => {\n\t\tconst code = error.code;\n\t\tif (refused && (!code || !isApiCode(code))) return refused(language);\n\t\tconst own = code && Object.hasOwn(byCode, code) ? byCode[code] : undefined;\n\t\tconst values = valuesOf(error.errors[0]?.extensions);\n\t\tconst text = own\n\t\t\t? own(error, language)\n\t\t\t: translateCode(code, error.message, language, values);\n\t\tif (!reword || !code) return text;\n\t\treturn (\n\t\t\treword(text, error, { code, values: values ?? {}, language }) ?? text\n\t\t);\n\t};\n\n\tconst unavailableMessage = (language: L) => unavailable(language);\n\n\tconst apiRefusal: ApiErrors<L>['apiRefusal'] = (error, language) =>\n\t\trefusalOf({ apiErrorMessage, unavailableMessage }, error, language);\n\n\tconst fieldErrors: ApiErrors<L>['fieldErrors'] = (error, language) =>\n\t\tfieldErrorsOf({ apiErrorMessage, translateCode }, error, language);\n\n\tconst parts = { apiRefusal, apiErrorMessage, fieldErrors };\n\n\treturn {\n\t\ttranslateCode,\n\t\tapiErrorMessage,\n\t\tunavailableMessage,\n\t\tfieldErrors,\n\t\tapiRefusal,\n\t\tfetcherRefusal: (error, language, route) =>\n\t\t\tfetcherRefusal(parts, error, language, route),\n\t\tformRefusal: (error, language, fieldOf, route) =>\n\t\t\tformRefusal(parts, error, language, fieldOf, route),\n\t\tfetcherResult: (language, about, run, options) =>\n\t\t\tfetcherResult(parts, language, about, run, options),\n\t\tsubmitForm: (language, run, fieldOf, route) =>\n\t\t\tsubmitForm(parts, language, run, fieldOf, route),\n\t};\n}\n",
|
|
12
12
|
"import type { data } from 'react-router';\nimport type { ApiErrorLike } from './api-error';\nimport { describeApiErrors } from './describe';\nimport type { FetcherResultOptions } from './fetcher-result';\nimport type { FormErrors } from './form-errors';\nimport type { FormRefusal } from './form-refusal';\nimport type { ApiMessages } from './messages';\nimport type { RouteErrorOptions } from './route-error';\n\n/** A refused call, as a page says it: the message, and the HTTP status to answer. */\nexport type ApiRefusal = { message: string; status: number };\n\nexport interface ApiErrorsOptions<L extends string> {\n\t/** The catalogue the API's codes are worded from. */\n\tmessages: ApiMessages<L>;\n\t/**\n\t * The app's own word for an API it cannot reach (a 503 `Response`): not\n\t * an API error, so never one of the catalogue's codes.\n\t */\n\tunavailable(language: L): string;\n\t/**\n\t * The app's generic refusal, said for an error with no API code (a raw\n\t * `BAD_USER_INPUT` before the API's validation layer), never the raw\n\t * message. Without it, such an error says the message the API sent.\n\t */\n\trefused?(language: L): string;\n\t/**\n\t * An app's own wording for given codes, such as the API's request limits\n\t * (depth, cost, introspection), whose params differ and name no field.\n\t * Checked after `refused`, before the catalogue.\n\t */\n\tbyCode?: Readonly<\n\t\tRecord<string, (error: ApiErrorLike, language: L) => string>\n\t>;\n\t/**\n\t * Words a whole family of codes once, after the text is worded. It runs\n\t * on the final text `apiErrorMessage` (so `apiRefusal`, `fetcherResult`,\n\t * `fetcherRefusal`, `submitForm` and a single `extensions.field`) says\n\t * for an error with a code, whichever produced it: the catalogue, the\n\t * API's own message, or `byCode`. It does not run on `refused`'s text, on\n\t * `unavailable`'s (a network failure), on `translateCode` nor on the\n\t * entries of `extensions.fields`. `values` are the merged values the\n\t * catalogue formats with (`extensions` and `extensions.params`, params\n\t * winning). Return the text to show, or `undefined` to keep `text`.\n\t */\n\treword?(\n\t\ttext: string,\n\t\terror: ApiErrorLike,\n\t\tcontext: {\n\t\t\tcode: string;\n\t\t\tvalues: Readonly<Record<string, unknown>>;\n\t\t\tlanguage: L;\n\t\t},\n\t): string | undefined;\n\t/** Whether a code is an API code; `<module>.errors.<slug>` by default. */\n\tisApiCode?(code: string): boolean;\n}\n\n/** What a page says of an API's refusals, in a language. */\nexport interface ApiErrors<L extends string> {\n\t/**\n\t * The catalogue's text of an API code in `language`, else `fallback` (the\n\t * message the API already worded). `values` are the message's arguments\n\t * (`extensions.params`).\n\t */\n\ttranslateCode(\n\t\tcode: string | undefined,\n\t\tfallback: string,\n\t\tlanguage: L,\n\t\tvalues?: Readonly<Record<string, unknown>>,\n\t): string;\n\t/**\n\t * What to show for an API error: `refused` for an error with no API code,\n\t * when given; else `byCode`'s wording of its code; else the catalogue's\n\t * text; else the message the API already worded.\n\t */\n\tapiErrorMessage(error: ApiErrorLike, language: L): string;\n\t/**\n\t * The message of each refused field, by input path, ready for a form: the\n\t * entries of `extensions.fields`, else the one field `extensions.field`\n\t * names, with the error's own message. Empty for neither.\n\t */\n\tfieldErrors(error: ApiErrorLike, language: L): Record<string, string>;\n\t/** `unavailable`, in `language`. */\n\tunavailableMessage(language: L): string;\n\t/**\n\t * What a failed call says to the user: an API refusal's message and its\n\t * status, or an API it cannot reach (a 503 `Response`: the unavailable\n\t * word). Undefined for anything else, which the caller rethrows.\n\t */\n\tapiRefusal(error: unknown, language: L): ApiRefusal | undefined;\n\t/**\n\t * A fetcher's refusal: `apiRefusal`'s, so the page stays where it was. A\n\t * 401 (the session caller redirects first) or any other failure is\n\t * thrown, through `routeError`, for the error page.\n\t */\n\tfetcherRefusal(\n\t\terror: unknown,\n\t\tlanguage: L,\n\t\troute?: RouteErrorOptions,\n\t): ApiRefusal;\n\t/**\n\t * A fetcher form's refusal (`fetcherRefusal`) with its field issues under\n\t * the form field `fieldOf` names for each input path: `{ error,\n\t * fieldErrors, status }`, `error` empty when every issue found its field.\n\t */\n\tformRefusal(\n\t\terror: unknown,\n\t\tlanguage: L,\n\t\tfieldOf: (path: string) => string | undefined,\n\t\troute?: RouteErrorOptions,\n\t): FormRefusal;\n\t/**\n\t * Runs the mutation of an action a fetcher posted to: `{ ok: true }` with\n\t * `about` and the mutation's value, or `{ ok: false, error }` with `about`\n\t * and the refusal's message, answered with its HTTP status. `options.reword`\n\t * words the refusal of this call from the caught API error (`undefined`\n\t * keeps the worded message); it is not called for an unreachable API.\n\t */\n\tfetcherResult<\n\t\tAbout extends object,\n\t\tValue extends object = Record<never, never>,\n\t>(\n\t\tlanguage: L,\n\t\tabout: About,\n\t\trun: () => Promise<Value>,\n\t\toptions?: FetcherResultOptions,\n\t): Promise<\n\t\t| ({ ok: true } & About & Value)\n\t\t| ReturnType<typeof data<{ ok: false; error: string } & About>>\n\t>;\n\t/**\n\t * Runs a form's mutation: `{ ok: true, value }`, or the form's errors\n\t * (`fieldErrors` under the form field `fieldOf` names an input path by,\n\t * and a `formError` for the rest) with the refusal's status. A 404 about\n\t * none of the form's fields, a 401 and other failures are thrown for the\n\t * error page, through `routeError` (with `route`).\n\t */\n\tsubmitForm<T>(\n\t\tlanguage: L,\n\t\trun: () => Promise<T>,\n\t\tfieldOf: (path: string) => string | undefined,\n\t\troute?: RouteErrorOptions,\n\t): Promise<{ ok: true; value: T } | ReturnType<typeof data<FormErrors>>>;\n}\n\n/**\n * The wording of an API's refusals for the languages `L`, from the\n * catalogue `messages` holds. Make one per app, beside its `createApiMessages`.\n */\nexport function createApiErrors<L extends string>(\n\toptions: ApiErrorsOptions<L>,\n): ApiErrors<L> {\n\treturn describeApiErrors(options);\n}\n",
|
|
13
13
|
"/** The methods of a `console` a report goes through. */\nexport type LogMethod = 'warn' | 'error';\n\n/**\n * A log whose methods can throw without breaking what reports through\n * them: a broken app log must not turn a handled failure into a rejection.\n */\nexport function quietLog<M extends LogMethod>(\n\tlog: Pick<Console, M>,\n\tmethods: readonly M[],\n): Pick<Console, M> {\n\tconst quiet = {} as Pick<Console, M>;\n\tfor (const method of methods) {\n\t\tquiet[method] = ((...args: unknown[]) => {\n\t\t\ttry {\n\t\t\t\t(log[method] as (...args: unknown[]) => void)(...args);\n\t\t\t} catch {\n\t\t\t\t// Swallowed on purpose: see above.\n\t\t\t}\n\t\t}) as Pick<Console, M>[M];\n\t}\n\treturn quiet;\n}\n",
|
|
14
|
-
"import { isApiErrorLike, isStatusError, isUnavailableError } from './api-error';\nimport { quietLog } from './log';\nimport { REQUEST_ID_HEADER } from './request-id';\n\n/** The statuses an API's gateway or auth layer may answer without a GraphQL body. */\nconst PASSED_THROUGH: ReadonlySet<number> = new Set([401, 403, 404]);\n\n/** The statuses a `Response` cannot carry a body with. */\nconst NO_BODY: ReadonlySet<number> = new Set([101, 204, 205, 304]);\n\nexport interface CallFailureOptions {\n\t/** What a log line names the API by, such as `my-api https://api.example.com/graphql`. */\n\tapi: string;\n\t/** The operation's name, for the log (`operationName(document)`). */\n\toperation?: string;\n\t/** The `x-request-id` the API answered, when it did (`requestIdOf(response)`). */\n\trequestId?: string;\n\t/** The incoming request's signal: an aborted call is answered 503. */\n\tsignal?: AbortSignal;\n\t/** The statuses without a GraphQL body that become a `Response` of their own; 401, 403 and 404 by default. */\n\tpassedThrough?: ReadonlySet<number>;\n\t/** Where the lines go; `console` by default. */\n\tlog?: Pick<Console, 'warn' | 'error'>;\n}\n\n/**\n * What a call became once it failed, for a loader or an action to throw: the\n * `ApiError` as it is (carrying `requestId`), a `Response` of the API's own\n * status for a 401, 403 or 404 without a GraphQL body, a 503 `Response` (with no body; the reason is in the log) for an\n * unreachable, slow, garbled or aborted API, and any other error as it is.\n * Every case it recognises is logged with the request id, when the API gave one, and never\n * the headers, the variables nor a token; the id rides on the `ApiError` as\n * `requestId` and on a `Response` as `x-request-id`, where `routeError` reads\n * it.\n *\n * It recognises `@nxgt/graphql-client`'s errors by their `name`, never with\n * `instanceof`, so it needs no import of the client and holds across two\n * copies of it.\n */\nexport function apiCallFailure(\n\terror: unknown,\n\t{\n\t\tapi,\n\t\toperation = 'operation',\n\t\trequestId,\n\t\tsignal,\n\t\tpassedThrough = PASSED_THROUGH,\n\t\tlog: appLog = console,\n\t}: CallFailureOptions,\n): unknown {\n\tconst log = quietLog(appLog, ['warn', 'error']);\n\tconst call = `${api}: ${operation}${requestId ? ` (request ${requestId})` : ''}`;\n\tconst headers: Record<string, string> = requestId\n\t\t? { [REQUEST_ID_HEADER]: requestId }\n\t\t: {};\n\tconst unavailable = (reason: string, cause?: unknown): Response => {\n\t\tlog.error(`${call} ${reason}`, cause ?? '');\n\t\treturn new Response(null, { status: 503, headers });\n\t};\n\tif (isApiErrorLike(error)) {\n\t\t// The client's `ApiError.requestId` is writable, though the structural type marks it readonly.\n\t\tif (requestId) (error as { requestId?: string }).requestId = requestId;\n\t\tconst line = `${call} answered ${error.status}${error.code ? ` ${error.code}` : ''}`;\n\t\tif (error.status >= 500) log.error(line);\n\t\telse log.warn(line);\n\t\treturn error;\n\t}\n\tif (isStatusError(error)) {\n\t\tif (passedThrough.has(error.status)) {\n\t\t\tlog.warn(`${call} answered ${error.status}`);\n\t\t\tconst statusText =\n\t\t\t\ttypeof error.statusText === 'string' ? error.statusText : '';\n\t\t\tif (NO_BODY.has(error.status)) {\n\t\t\t\treturn new Response(null, {\n\t\t\t\t\tstatus: error.status,\n\t\t\t\t\tstatusText,\n\t\t\t\t\theaders,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn new Response(statusText, {\n\t\t\t\tstatus: error.status,\n\t\t\t\tstatusText,\n\t\t\t\theaders,\n\t\t\t});\n\t\t}\n\t\treturn unavailable(`answered ${error.status} without GraphQL`, error.body);\n\t}\n\tif (isUnavailableError(error)) return unavailable(error.reason, error.cause);\n\tif (signal?.aborted) return unavailable('aborted', error);\n\treturn error;\n}\n\n/** A document, as far as `operationName` reads it: `graphql`'s `DocumentNode` fits. */\nexport interface DocumentLike {\n\treadonly definitions: readonly {\n\t\treadonly kind: string;\n\t\treadonly operation?: string | undefined;\n\t\treadonly name?: { readonly value: string } | undefined;\n\t}[];\n}\n\n/**\n * The name of the operation a document holds, for a log line: its name, else\n * its kind (`query`, `mutation`, `subscription`), else `operation`.\n */\nexport function operationName(document: DocumentLike): string {\n\tfor (const definition of document.definitions) {\n\t\tif (definition.kind === 'OperationDefinition') {\n\t\t\treturn definition.name?.value ?? definition.operation ?? 'operation';\n\t\t}\n\t}\n\treturn 'operation';\n}\n",
|
|
14
|
+
"import { isApiErrorLike, isStatusError, isUnavailableError } from './api-error';\nimport { quietLog } from './log';\nimport { isProblemErrorLike } from './problem-error';\nimport { REQUEST_ID_HEADER } from './request-id';\n\n/** The statuses an API's gateway or auth layer may answer without a GraphQL body. */\nconst PASSED_THROUGH: ReadonlySet<number> = new Set([401, 403, 404]);\n\n/** The statuses a `Response` cannot carry a body with. */\nconst NO_BODY: ReadonlySet<number> = new Set([101, 204, 205, 304]);\n\nexport interface CallFailureOptions {\n\t/** What a log line names the API by, such as `my-api https://api.example.com/graphql`. */\n\tapi: string;\n\t/** The operation's name, for the log (`operationName(document)`). */\n\toperation?: string;\n\t/** The `x-request-id` the API answered, when it did (`requestIdOf(response)`). */\n\trequestId?: string;\n\t/** The incoming request's signal: an aborted call is answered 503. */\n\tsignal?: AbortSignal;\n\t/** The statuses without a GraphQL body that become a `Response` of their own; 401, 403 and 404 by default. */\n\tpassedThrough?: ReadonlySet<number>;\n\t/** Where the lines go; `console` by default. */\n\tlog?: Pick<Console, 'warn' | 'error'>;\n}\n\n/**\n * What a call became once it failed, for a loader or an action to throw: the\n * `ApiError` or `ProblemError` as it is (carrying `requestId`), a `Response` of the API's own\n * status for a 401, 403 or 404 without a GraphQL body, a 503 `Response` (with no body; the reason is in the log) for an\n * unreachable, slow, garbled or aborted API, and any other error as it is.\n * Every case it recognises is logged with the request id, when the API gave one, and never\n * the headers, the variables nor a token; the id rides on the `ApiError` as\n * `requestId` and on a `Response` as `x-request-id`, where `routeError` reads\n * it.\n *\n * It recognises `@nxgt/graphql-client`'s errors by their `name`, never with\n * `instanceof`, so it needs no import of the client and holds across two\n * copies of it.\n */\nexport function apiCallFailure(\n\terror: unknown,\n\t{\n\t\tapi,\n\t\toperation = 'operation',\n\t\trequestId,\n\t\tsignal,\n\t\tpassedThrough = PASSED_THROUGH,\n\t\tlog: appLog = console,\n\t}: CallFailureOptions,\n): unknown {\n\tconst log = quietLog(appLog, ['warn', 'error']);\n\tconst call = `${api}: ${operation}${requestId ? ` (request ${requestId})` : ''}`;\n\tconst headers: Record<string, string> = requestId\n\t\t? { [REQUEST_ID_HEADER]: requestId }\n\t\t: {};\n\tconst unavailable = (reason: string, cause?: unknown): Response => {\n\t\tlog.error(`${call} ${reason}`, cause ?? '');\n\t\treturn new Response(null, { status: 503, headers });\n\t};\n\tif (isApiErrorLike(error)) {\n\t\t// The client's `ApiError.requestId` is writable, though the structural type marks it readonly.\n\t\tif (requestId) (error as { requestId?: string }).requestId = requestId;\n\t\tconst line = `${call} answered ${error.status}${error.code ? ` ${error.code}` : ''}`;\n\t\tif (error.status >= 500) log.error(line);\n\t\telse log.warn(line);\n\t\treturn error;\n\t}\n\tif (isProblemErrorLike(error)) {\n\t\tif (requestId) error.requestId = requestId;\n\t\tconst line = `${call} answered ${error.status}`;\n\t\tif (error.status >= 500) log.error(line);\n\t\telse log.warn(line);\n\t\treturn error;\n\t}\n\tif (isStatusError(error)) {\n\t\tif (passedThrough.has(error.status)) {\n\t\t\tlog.warn(`${call} answered ${error.status}`);\n\t\t\tconst statusText =\n\t\t\t\ttypeof error.statusText === 'string' ? error.statusText : '';\n\t\t\tif (NO_BODY.has(error.status)) {\n\t\t\t\treturn new Response(null, {\n\t\t\t\t\tstatus: error.status,\n\t\t\t\t\tstatusText,\n\t\t\t\t\theaders,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn new Response(statusText, {\n\t\t\t\tstatus: error.status,\n\t\t\t\tstatusText,\n\t\t\t\theaders,\n\t\t\t});\n\t\t}\n\t\treturn unavailable(`answered ${error.status} without GraphQL`, error.body);\n\t}\n\tif (isUnavailableError(error)) return unavailable(error.reason, error.cause);\n\tif (signal?.aborted) return unavailable('aborted', error);\n\treturn error;\n}\n\n/** A document, as far as `operationName` reads it: `graphql`'s `DocumentNode` fits. */\nexport interface DocumentLike {\n\treadonly definitions: readonly {\n\t\treadonly kind: string;\n\t\treadonly operation?: string | undefined;\n\t\treadonly name?: { readonly value: string } | undefined;\n\t}[];\n}\n\n/**\n * The name of the operation a document holds, for a log line: its name, else\n * its kind (`query`, `mutation`, `subscription`), else `operation`.\n */\nexport function operationName(document: DocumentLike): string {\n\tfor (const definition of document.definitions) {\n\t\tif (definition.kind === 'OperationDefinition') {\n\t\t\treturn definition.name?.value ?? definition.operation ?? 'operation';\n\t\t}\n\t}\n\treturn 'operation';\n}\n",
|
|
15
15
|
"import type { Held } from './catalogue-read';\n\n/** What the TTL check needs: the reader's state and the app's own calls. */\nexport interface CheckContext<L extends string> {\n\treader: {\n\t\theld: Map<L, Held>;\n\t\tload(language: L, now: number): Promise<void>;\n\t};\n\tversions(): Promise<Partial<Record<L, string>>>;\n\tttl(): number;\n\tretryMs: number;\n\tlog: Pick<Console, 'error'>;\n}\n\n/**\n * Asks the versions in one call and reads again the messages of each\n * language that moved. An API that cannot be reached keeps the messages\n * held (stale, still worded) and is asked again after `retryMs`.\n */\nexport async function checkVersions<L extends string>(\n\t{ reader, versions, ttl, retryMs, log }: CheckContext<L>,\n\tnow: number,\n) {\n\ttry {\n\t\tconst latest = await versions();\n\t\tfor (const [language, entry] of [...reader.held]) {\n\t\t\tif (latest[language] !== entry.version) {\n\t\t\t\tawait reader.load(language, now);\n\t\t\t} else {\n\t\t\t\tentry.checkedAt = now;\n\t\t\t}\n\t\t}\n\t} catch (error) {\n\t\tlog.error(\n\t\t\t'alxia-react-router: the error catalogue was not checked, keeping what is held',\n\t\t\terror,\n\t\t);\n\t\tfor (const entry of reader.held.values()) {\n\t\t\tentry.checkedAt = now - ttl() + retryMs;\n\t\t}\n\t}\n}\n\n/**\n * The TTL, whose getter is the app's: one that throws, or that is not a\n * finite number of at least 0, is logged and `fallback` is used.\n */\nexport function safeTtl(\n\tttlMs: number | (() => number),\n\tfallback: number,\n\tlog: Pick<Console, 'error'>,\n) {\n\treturn () => {\n\t\ttry {\n\t\t\tconst ttl = typeof ttlMs === 'function' ? ttlMs() : ttlMs;\n\t\t\tif (typeof ttl === 'number' && Number.isFinite(ttl) && ttl >= 0) {\n\t\t\t\treturn ttl;\n\t\t\t}\n\t\t\tlog.error('alxia-react-router: ttlMs is not a duration, using retryMs');\n\t\t} catch (error) {\n\t\t\tlog.error('alxia-react-router: ttlMs threw, using retryMs', error);\n\t\t}\n\t\treturn fallback;\n\t};\n}\n",
|
|
16
16
|
"import type { ApiMessages, CatalogueMessage } from './messages';\n\n/** What the API answers for one language: its version and every message. */\nexport type CatalogueReply = {\n\tversion: string;\n\tmessages: ReadonlyArray<CatalogueMessage & { readonly code: string }>;\n};\n\n/** A language's catalogue as held, and when its version was last confirmed. */\nexport type Held = { version: string; checkedAt: number };\n\nexport interface CatalogueReaderOptions<L extends string> {\n\tmessages: ApiMessages<L>;\n\tread(language: L): Promise<CatalogueReply>;\n\tretryMs: number;\n\tfirstReadWaitMs: number;\n\tlog: Pick<Console, 'error'>;\n}\n\n/**\n * Waits for the read, until `firstReadWaitMs` after it started (not after\n * this request came: a hung API holds a request at most that long in\n * all); the read goes on either way.\n */\nasync function boundedWait(\n\tpending: { read: Promise<void>; started: number },\n\tfirstReadWaitMs: number,\n) {\n\tconst left = firstReadWaitMs - (performance.now() - pending.started);\n\tif (left <= 0) return;\n\tlet timer: ReturnType<typeof setTimeout> | undefined;\n\tconst limit = new Promise<void>((resolve) => {\n\t\ttimer = setTimeout(resolve, left);\n\t});\n\tawait Promise.race([pending.read, limit]);\n\tclearTimeout(timer);\n}\n\n/**\n * The reading half of the catalogue: the first read of each language (one in\n * flight, a bounded wait, a retry delay after a failure) and the version\n * each one holds. `createErrorCatalogue` adds the TTL check on top.\n */\nexport function createCatalogueReader<L extends string>({\n\tmessages,\n\tread,\n\tretryMs,\n\tfirstReadWaitMs,\n\tlog,\n}: CatalogueReaderOptions<L>) {\n\tconst held = new Map<L, Held>();\n\tconst loading = new Map<L, { read: Promise<void>; started: number }>();\n\tconst failedAt = new Map<L, number>();\n\n\t/** Reads one language's messages and holds them. */\n\tasync function load(language: L, now: number) {\n\t\tconst reply = await read(language);\n\t\tconst entries: Record<string, CatalogueMessage> = Object.create(null);\n\t\tfor (const { code, message, params } of reply.messages) {\n\t\t\tentries[code] = { message, params };\n\t\t}\n\t\tmessages.set(language, entries);\n\t\theld.set(language, { version: reply.version, checkedAt: now });\n\t}\n\n\t/** The first read of a language, once however many pages ask at the same time. */\n\tfunction loadOnce(language: L, now: number) {\n\t\tlet pending = loading.get(language);\n\t\tif (!pending) {\n\t\t\tconst started = performance.now();\n\t\t\tconst reading = load(language, now)\n\t\t\t\t.then(() => {\n\t\t\t\t\tfailedAt.delete(language);\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\t// When it failed, not when it started: a read that hung for\n\t\t\t\t\t// the wait is not retried at once by the next request.\n\t\t\t\t\tfailedAt.set(language, now + (performance.now() - started));\n\t\t\t\t\tlog.error(\n\t\t\t\t\t\t`alxia-react-router: the error catalogue (${language}) was not read`,\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t})\n\t\t\t\t.finally(() => {\n\t\t\t\t\tloading.delete(language);\n\t\t\t\t});\n\t\t\tpending = { read: reading, started };\n\t\t\tloading.set(language, pending);\n\t\t}\n\t\treturn pending;\n\t}\n\n\treturn {\n\t\theld,\n\t\tload,\n\t\t/** Reads a language that is not held yet, unless a failure is still fresh. */\n\t\tasync first(language: L, now: number) {\n\t\t\tconst failed = failedAt.get(language);\n\t\t\tif (failed === undefined || now - failed >= retryMs) {\n\t\t\t\tawait boundedWait(loadOnce(language, now), firstReadWaitMs);\n\t\t\t}\n\t\t},\n\t\treset() {\n\t\t\theld.clear();\n\t\t\tloading.clear();\n\t\t\tfailedAt.clear();\n\t\t},\n\t};\n}\n",
|
|
17
17
|
"import { checkVersions, safeTtl } from './catalogue-check';\nimport { type CatalogueReply, createCatalogueReader } from './catalogue-read';\nimport { quietLog } from './log';\nimport type { ApiMessages, CatalogueMessages } from './messages';\n\nexport type { CatalogueReply } from './catalogue-read';\n\nexport interface ErrorCatalogueOptions<L extends string> {\n\t/** The store the page words refusals from (`createApiMessages`). */\n\tmessages: ApiMessages<L>;\n\t/** The languages to hold, each read once and kept fresh. */\n\tlanguages: readonly L[];\n\t/** Reads one language's catalogue from the API. */\n\tread(language: L): Promise<CatalogueReply>;\n\t/** Asks the API for the version of every language, in one call. */\n\tversions(): Promise<Partial<Record<L, string>>>;\n\t/** How long a held catalogue is served before its version is checked. */\n\tttlMs: number | (() => number);\n\t/** How soon a check or a first read that failed is tried again. Default 5000. */\n\tretryMs?: number;\n\t/**\n\t * How long a request waits for a language's first read; past it the\n\t * request goes on and the read carries on in the background. Default 1500.\n\t */\n\tfirstReadWaitMs?: number;\n\t/** The codes the browser words itself (`clientMessages`). */\n\tclientCodes: readonly string[];\n\t/** Where failures are reported. Default `console`. */\n\tlog?: Pick<Console, 'error'>;\n}\n\n/** The API's error catalogue, kept fresh for the server. */\nexport interface ErrorCatalogue<L extends string> {\n\t/**\n\t * The catalogue of `language`, ready to word a refusal. Only a language\n\t * with no catalogue yet is awaited, for at most `firstReadWaitMs`. A held\n\t * one is served as it is, and once older than the TTL its version is\n\t * checked in the background, one check at a time.\n\t */\n\tfresh(language: L, now?: number): Promise<void>;\n\t/** Every language, fresh: what the root middleware awaits. */\n\tfreshAll(now?: number): Promise<void>;\n\t/** At startup: reads every language without holding the boot back. */\n\twarm(): void;\n\t/** The messages the browser words itself, by language, for the root's loader. */\n\tclientMessages(): Record<L, CatalogueMessages>;\n\t/**\n\t * Forgets everything held and in flight. For use between tests, with\n\t * nothing in flight: a read or check still running when it is called\n\t * finishes and holds its result again.\n\t */\n\treset(): void;\n\t/** The version held for a language, if any. */\n\theldVersion(language: L): string | undefined;\n\t/** Waits for the check in flight, if any (tests). */\n\tsettled(): Promise<void>;\n}\n\n/** The messages the browser words itself, by language. */\nfunction clientMessages<L extends string>(\n\tmessages: ApiMessages<L>,\n\tlanguages: readonly L[],\n\tclientCodes: readonly string[],\n) {\n\tconst byLanguage = {} as Record<L, CatalogueMessages>;\n\tfor (const language of languages) {\n\t\tconst entries: Record<string, CatalogueMessages[string]> =\n\t\t\tObject.create(null);\n\t\tfor (const code of clientCodes) {\n\t\t\tconst entry = messages.messageOf(language, code);\n\t\t\tif (entry) entries[code] = entry;\n\t\t}\n\t\tbyLanguage[language] = entries;\n\t}\n\treturn byLanguage;\n}\n\n/**\n * Keeps the API's error catalogue in `messages`: read on first use, checked\n * against the API's versions once per TTL, and re-read only for the\n * languages whose version moved. It is an instance, not module state.\n */\nexport function createErrorCatalogue<L extends string>({\n\tmessages,\n\tlanguages,\n\tread,\n\tversions,\n\tttlMs,\n\tretryMs = 5_000,\n\tfirstReadWaitMs = 1_500,\n\tclientCodes,\n\tlog: appLog = console,\n}: ErrorCatalogueOptions<L>): ErrorCatalogue<L> {\n\tif (languages.length === 0) {\n\t\tthrow new TypeError('createErrorCatalogue(): needs at least one language.');\n\t}\n\tconst log = quietLog(appLog, ['error']);\n\tconst ttl = safeTtl(ttlMs, retryMs, log);\n\tconst reader = createCatalogueReader({\n\t\tmessages,\n\t\tread,\n\t\tretryMs,\n\t\tfirstReadWaitMs,\n\t\tlog,\n\t});\n\tconst context = { reader, versions, ttl, retryMs, log };\n\tlet checking: Promise<void> | undefined;\n\n\tasync function fresh(language: L, now: number = Date.now()) {\n\t\tconst entry = reader.held.get(language);\n\t\tif (!entry) return reader.first(language, now);\n\t\tif (now - entry.checkedAt >= ttl() && !checking) {\n\t\t\tchecking = checkVersions(context, now)\n\t\t\t\t.finally(() => {\n\t\t\t\t\tchecking = undefined;\n\t\t\t\t})\n\t\t\t\t.catch(() => {});\n\t\t}\n\t}\n\n\tconst freshAll = async (now: number = Date.now()) => {\n\t\tawait Promise.all(languages.map((language) => fresh(language, now)));\n\t};\n\n\treturn {\n\t\tfresh,\n\t\tfreshAll,\n\t\twarm() {\n\t\t\tfreshAll().catch((error) => {\n\t\t\t\tlog.error(\n\t\t\t\t\t'alxia-react-router: the error catalogue was not warmed',\n\t\t\t\t\terror,\n\t\t\t\t);\n\t\t\t});\n\t\t},\n\t\tclientMessages: () => clientMessages(messages, languages, clientCodes),\n\t\treset() {\n\t\t\treader.reset();\n\t\t\tchecking = undefined;\n\t\t\tmessages.clear();\n\t\t},\n\t\theldVersion: (language) => reader.held.get(language)?.version,\n\t\tsettled: () => checking ?? Promise.resolve(),\n\t};\n}\n",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"import type { ReactNode } from 'react';\nimport type { ApiMessages, CatalogueMessages } from './messages';\n\nexport interface ApiMessagesProviderProps<L extends string> {\n\t/** The store `apiCodeResolver` reads. */\n\tmessages: ApiMessages<L>;\n\t/** The messages the root's data carries, by language. */\n\tvalue: Readonly<Record<L, CatalogueMessages>> | undefined;\n\tchildren: ReactNode;\n}\n\n/**\n * Fills the browser's catalogue with the messages the root's data carries\n * (the few its forms word), before the children render: `apiCodeResolver`\n * reads them synchronously. A server render writes nothing: the server's\n * store holds the whole, fresher catalogue, and a render's data may be older\n * than it. It is a plain function (no JSX, no React runtime): use it as\n * `ApiMessagesProvider({ messages, value, children })` from a component, or\n * as an element's type.\n */\nexport function ApiMessagesProvider<L extends string>({\n\tmessages,\n\tvalue,\n\tchildren,\n}: ApiMessagesProviderProps<L>): ReactNode {\n\tconst inBrowser =\n\t\ttypeof (globalThis as { document?: unknown }).document !== 'undefined';\n\tif (value && inBrowser) {\n\t\tfor (const [language, held] of Object.entries<CatalogueMessages>(value)) {\n\t\t\tmessages.add(language as L, held);\n\t\t}\n\t}\n\treturn children;\n}\n",
|
|
22
22
|
"import { type FetcherWithComponents, useFetcher } from 'react-router';\n\n/** What a fetcher can post as JSON. */\nexport type JsonBody = Parameters<FetcherWithComponents<unknown>['submit']>[0];\n\n/**\n * A fetcher posting JSON to its page's action (which reads it with\n * `readJson`, and answers `fetcherResult` or the like): `post` sends a\n * body, `busy` while it is in flight. `key` shares the fetcher between the\n * form that posts and the component that reads the answer; `action` posts to\n * another route's action instead (a resource route's, such as a\n * `notifications/poll`). `post` takes the target of one call as its second\n * argument (a list's rows each post to their own record's action).\n */\nexport function useJsonFetcher<Action, Body extends JsonBody = JsonBody>(\n\tkey?: string,\n\taction?: string,\n): {\n\tfetcher: ReturnType<typeof useFetcher<Action>>;\n\tpost(body: Body, to?: string): Promise<void>;\n\tbusy: boolean;\n} {\n\tconst fetcher = useFetcher<Action>(key ? { key } : undefined);\n\tconst post = (body: Body, to = action) =>\n\t\tfetcher.submit(body, {\n\t\t\tmethod: 'post',\n\t\t\tencType: 'application/json',\n\t\t\t...(to ? { action: to } : {}),\n\t\t});\n\treturn { fetcher, post, busy: fetcher.state !== 'idle' };\n}\n"
|
|
23
23
|
],
|
|
24
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAgBO,IAAM,WAAW;AA8BxB,SAAS,UAAU,CAAC,OAAsB;AAAA,EACzC,MAAM,OAAQ,MAAM,QAA2C;AAAA,EAC/D,OAAO,OAAO,SAAS,WAAW,OAAO;AAAA;AAYnC,SAAS,eAAiC,CAChD,UACA,SACqB;AAAA,EACrB,MAAM,YAAY,CAAC,QAClB,QAAQ,YAAY,QAAQ,UAAU,GAAG,IAAI,SAAS,KAAK,GAAG;AAAA,EAC/D,OAAO;AAAA,IACN,SAAS,CAAC,KAAK,SAAS,iBAAiB;AAAA,MACxC,IAAI,CAAC,UAAU,GAAG;AAAA,QACjB,OAAO,QAAQ,UAAU,KAAK,SAAS,eAAe;AAAA,MACvD,MAAM,WACL,OAAO,oBAAoB,aACxB,gBAAgB,IACf,mBAAmB,QAAQ,SAAS;AAAA,MACzC,OAAO,SAAS,WAAW,KAAK,SAAS,QAAQ,KAAK;AAAA;AAAA,IAEvD,MAAM,CAAC,OAAO;AAAA,MACb,OAAO,QAAQ,SAAS,Q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,CAAC,MAAM,QAAQ,UAAU;AAAA,MAClC,MAAM,QAAQ,UAAU,UAAU,IAAI;AAAA,MACtC,OAAO,QAAQ,YAAY,OAAO,QAAQ,QAAQ,IAAI;AAAA;AAAA,EAExD;AAAA;;AC3GM,SAAS,mBAAqC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,GAC0C;AAAA,EAC1C,MAAM,YACL,OAAQ,WAAsC,aAAa;AAAA,EAC5D,IAAI,SAAS,WAAW;AAAA,IACvB,YAAY,UAAU,SAAS,OAAO,QAA2B,KAAK,GAAG;AAAA,MACxE,SAAS,IAAI,UAAe,IAAI;AAAA,IACjC;AAAA,EACD;AAAA,EACA,OAAO;AAAA;;AChCR;AAcO,SAAS,cAAwD,CACvE,KACA,QAKC;AAAA,EACD,MAAM,UAAU,WAAmB,MAAM,EAAE,IAAI,IAAI,SAAS;AAAA,EAC5D,MAAM,OAAO,CAAC,MAAY,KAAK,WAC9B,QAAQ,OAAO,MAAM;AAAA,IACpB,QAAQ;AAAA,IACR,SAAS;AAAA,OACL,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;AAAA,EAC5B,CAAC;AAAA,EACF,OAAO,EAAE,SAAS,MAAM,MAAM,QAAQ,UAAU,OAAO;AAAA;",
|
|
25
|
+
"debugId": "9CF68A4852A1305F64756E2164756E21",
|
|
26
26
|
"names": []
|
|
27
27
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** A reply of a REST/OpenAPI client, as far as `problemError` reads it: `{ status, data }`. */
|
|
2
|
+
export interface ProblemReply {
|
|
3
|
+
readonly status: number;
|
|
4
|
+
/** The parsed body; a problem document (RFC 9457) when the API refused. */
|
|
5
|
+
readonly data?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface ProblemErrorOptions {
|
|
8
|
+
/** The `x-request-id` the API answered (`requestIdOf(response)`). */
|
|
9
|
+
requestId?: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
/** A refusal read from a REST API's RFC 9457 problem reply. */
|
|
12
|
+
export interface ProblemErrorLike extends Error {
|
|
13
|
+
/** The HTTP status of the reply. */
|
|
14
|
+
readonly status: number;
|
|
15
|
+
/** The problem's `title`, else `Error <status>`. */
|
|
16
|
+
readonly title: string;
|
|
17
|
+
/** The problem's `detail`, when it has one. */
|
|
18
|
+
readonly detail?: string | undefined;
|
|
19
|
+
/** The problem's `type` URI, when it has one. */
|
|
20
|
+
readonly type?: string | undefined;
|
|
21
|
+
/** The problem's `instance` URI, when it has one. */
|
|
22
|
+
readonly instance?: string | undefined;
|
|
23
|
+
/** The id the API logged the request under, when the caller kept it. */
|
|
24
|
+
requestId?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The error of an RFC 9457 problem reply. Its `message` is the problem's
|
|
28
|
+
* `detail`, else its `title`, else `Error <status>`.
|
|
29
|
+
*/
|
|
30
|
+
export declare class ProblemError extends Error implements ProblemErrorLike {
|
|
31
|
+
readonly name = "ProblemError";
|
|
32
|
+
readonly status: number;
|
|
33
|
+
readonly title: string;
|
|
34
|
+
readonly detail: string | undefined;
|
|
35
|
+
readonly type: string | undefined;
|
|
36
|
+
readonly instance: string | undefined;
|
|
37
|
+
requestId: string | undefined;
|
|
38
|
+
constructor(reply: ProblemReply, { requestId }?: ProblemErrorOptions);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Turns a REST/OpenAPI client's `{ status, data }` reply into a
|
|
42
|
+
* `ProblemError`; a body that is not a problem document gives `Error <status>`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function problemError(reply: ProblemReply, options?: ProblemErrorOptions): ProblemError;
|
|
45
|
+
/**
|
|
46
|
+
* Whether `error` is a `ProblemError`, told by its name and a numeric
|
|
47
|
+
* `status`, never `instanceof`, so it holds across two copies of the package.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isProblemErrorLike(error: unknown): error is ProblemErrorLike;
|
|
50
|
+
//# sourceMappingURL=problem-error.d.ts.map
|
|
@@ -0,0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AAE,SAAS,EAAE,GAAE,mBAAwB;CAoBxE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC3B,KAAK,EAAE,YAAY,EACnB,OAAO,CAAC,EAAE,mBAAmB,GAC3B,YAAY,CAEd;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAK5E"}
|
|
@@ -19,7 +19,9 @@ export interface RouteErrorOptions {
|
|
|
19
19
|
* call's request id when the API gave one. A thrown routed `Response` that
|
|
20
20
|
* carries a request id becomes one too (a bare `Response` hands the browser
|
|
21
21
|
* its body only). Any other `ApiError` that has a request id becomes a 500
|
|
22
|
-
* with just that id, so the generic error page can show it.
|
|
22
|
+
* with just that id, so the generic error page can show it. A `ProblemError`
|
|
23
|
+
* (`problemError`, a REST API's RFC 9457 reply) is treated alike, its message
|
|
24
|
+
* being the problem's detail or title. Anything else
|
|
23
25
|
* is returned as it is.
|
|
24
26
|
*/
|
|
25
27
|
export declare function routeError(error: unknown, { statuses }?: RouteErrorOptions): unknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-error.d.ts","sourceRoot":"","sources":["../../src/errors/route-error.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"route-error.d.ts","sourceRoot":"","sources":["../../src/errors/route-error.ts"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,MAAM,WAAW,iBAAiB;IACjC,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACzB,KAAK,EAAE,OAAO,EACd,EAAE,QAAiB,EAAE,GAAE,iBAAsB,GAC3C,OAAO,CAgCT;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAMjE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SameSite } from './serialize';
|
|
1
2
|
/** What every `sessionCookies` call takes, with or without a second factor. */
|
|
2
3
|
export interface SessionCookiesBaseOptions {
|
|
3
4
|
/**
|
|
@@ -11,6 +12,12 @@ export interface SessionCookiesBaseOptions {
|
|
|
11
12
|
* prefixes (Safari drops a `Secure` cookie over `http://localhost`).
|
|
12
13
|
*/
|
|
13
14
|
readonly secure: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The `SameSite` attribute of every cookie written. `'lax'` by default;
|
|
17
|
+
* `'strict'` for an app no other site links into signed in; `'none'`
|
|
18
|
+
* needs `secure`.
|
|
19
|
+
*/
|
|
20
|
+
readonly sameSite?: SameSite | undefined;
|
|
14
21
|
}
|
|
15
22
|
/** The options of an app with no second factor: no challenge cookie. */
|
|
16
23
|
export interface SessionCookiesWithoutChallengeOptions extends SessionCookiesBaseOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../src/session/cookies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../src/session/cookies.ts"],"names":[],"mappings":"AAAA,OAAO,EAMN,KAAK,QAAQ,EAGb,MAAM,aAAa,CAAC;AAErB,+EAA+E;AAC/E,MAAM,WAAW,yBAAyB;IACzC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;CACzC;AAED,wEAAwE;AACxE,MAAM,WAAW,q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SAAS,CAAC;CAC/C,GACC,cAAc,CAAC,OAAO,CAAC,CAAC;AA8G3B,sFAAsF;AACtF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,MAAM,EAAE,CAE3E"}
|
package/dist/session/index.d.ts
CHANGED
|
@@ -10,8 +10,9 @@ export type { SecondFactorSteps, SignInAnswer, SignInCodes, SignInFlow, SignInFl
|
|
|
10
10
|
export { TOKEN_PAGE_HEADERS } from './link-token';
|
|
11
11
|
export type { AuthLinks, AuthLinksCodes, AuthLinksOptions, LinkStayed, RequestLinkAnswer, SpendOptions, Spent, } from './link-types';
|
|
12
12
|
export { authLinks } from './links';
|
|
13
|
-
export { readCookie, type SerializeOptions, secondsUntil, serializeCookie, } from './serialize';
|
|
13
|
+
export { readCookie, type SameSite, type SerializeOptions, secondsUntil, serializeCookie, } from './serialize';
|
|
14
14
|
export { signInFlow } from './sign-in';
|
|
15
|
+
export { type SignedSession, type SignedSessionOptions, signedSession, } from './signed';
|
|
15
16
|
export { stepUpSteps } from './step-up';
|
|
16
17
|
export { STEP_UP_OVER, STEP_UP_REQUIRED } from './step-up-codes';
|
|
17
18
|
export type { StepUpCall, StepUpCodes, StepUpRun, StepUpSignIn, StepUpStayed, StepUpSteps, StepUpStepsOptions, } from './step-up-types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACN,cAAc,EACd,YAAY,EACZ,cAAc,EACd,eAAe,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,qCAAqC,EAC1C,cAAc,GACd,MAAM,WAAW,CAAC;AACnB,YAAY,EACX,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,oCAAoC,EACpC,eAAe,EACf,YAAY,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EACX,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,KAAK,GACL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EACN,UAAU,EACV,KAAK,gBAAgB,EACrB,YAAY,EACZ,eAAe,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACjE,YAAY,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,kBAAkB,GAClB,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACN,cAAc,EACd,YAAY,EACZ,cAAc,EACd,eAAe,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,qCAAqC,EAC1C,cAAc,GACd,MAAM,WAAW,CAAC;AACnB,YAAY,EACX,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,oCAAoC,EACpC,eAAe,EACf,YAAY,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EACX,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,KAAK,GACL,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EACN,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,YAAY,EACZ,eAAe,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EACN,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,aAAa,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACjE,YAAY,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,kBAAkB,GAClB,MAAM,iBAAiB,CAAC"}
|