@rexezuge/web 1.9.2 → 1.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api.d.ts CHANGED
@@ -77,6 +77,14 @@ interface ApiRequestInit {
77
77
  body?: unknown;
78
78
  headers?: HeadersInit;
79
79
  signal?: AbortSignal | null;
80
+ /**
81
+ Passed through to `fetch`; omitted leaves the browser default.
82
+
83
+ It is a standard `RequestInit` field, so a caller that needs `'no-store'`
84
+ (an auth probe that must never read a cached page) or `'reload'` does not have
85
+ to reach around the client to set it.
86
+ */
87
+ cache?: RequestCache;
80
88
  }
81
89
  interface CreateApiClientOptions {
82
90
  /**
package/dist/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,YAAY,EAIb,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AAEH;;EAEE;AACF,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAExE;;EAEE;AACF,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAE/D,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,UAAU,EAAE,CAAC,CAAC;AAEtE,UAAU,cAAc;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;MAEE;IACF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CAC7B;AAED,UAAU,sBAAsB;IAC9B;;MAEE;IACF,OAAO,CAAC,EAAE,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,WAAW,EAAE,UAAU,EAAE,CAAC"}
package/dist/api.js CHANGED
@@ -1 +1 @@
1
- var A=Object.defineProperty;var s=(e,r)=>A(e,"name",{value:r,configurable:!0});import{BadGatewayError as C,BadRequestError as O,ConflictError as H,ForbiddenError as P,InternalServerError as M,MethodNotAllowedError as N,NotFoundError as U,NotImplementedError as x,PayloadTooLargeError as j,PreconditionFailedError as L,RateLimitedError as _,ServiceError as g,ServiceUnavailableError as F,UnauthorizedError as J,UnsupportedMediaTypeError as q}from"@rexezuge/errors";const T=500,b={400:O,401:J,403:P,404:U,405:N,409:H,412:L,413:j,415:q,429:_,500:M,501:x,502:C,503:F};class h extends g{static{s(this,"HttpStatusError")}constructor(r,c,t){super(r,t??`HttpStatus${r}`,c)}}function l(e){return typeof e=="string"&&e.trim()!==""?e:null}s(l,"readString");function p(e,r){return e.length>r?`${e.slice(0,r)}\u2026`:e}s(p,"truncate");const B=/[\u0000-\u001F\u007F]/;function G(e,r){return e.length===0||e.length>r||e.includes("<")?!1:!B.test(e)}s(G,"isProbablyProse");function v(e,r,c){if(typeof e=="string"){const n=e.trim();return{message:n===""?null:p(n,c),type:null}}if(typeof e!="object"||e===null)return{message:null,type:null};const t=e,u=typeof t.error=="object"&&t.error!==null?t.error:null,a=l(t.Exception?.Type)??(typeof t.error=="string"?l(t.error):null)??l(u?.code)??l(t.code)??null,y=l(t.Exception?.Message)??l(t.message)??(typeof t.error=="string"?l(t.error):null)??l(u?.message)??null;return y!==null?{message:p(y,c),type:a}:a!==null?{message:`${a} (HTTP ${r})`,type:a}:{message:null,type:null}}s(v,"decodeJsonError");function I(e,r,c){const t=e.trim();if(t==="")return{message:null,type:null};try{return v(JSON.parse(t),r,c)}catch{return{message:G(t,c)?p(t,c):null,type:null}}}s(I,"decodeErrorBody");function Q(e,r){const c=new Headers(e);if(r===void 0)return c;for(const[t,u]of new Headers(r))c.set(t,u);return c}s(Q,"mergeHeaders");function k(e){return Array.isArray(e)}s(k,"isQueryList");function w(e){const r=new URLSearchParams;for(const[t,u]of Object.entries(e))if(!(u==null||u==="")){if(k(u)){for(const a of u)a!=null&&a!==""&&r.append(t,String(a));continue}r.set(t,String(u))}const c=r.toString();return c===""?"":`?${c}`}s(w,"buildQuery");function z(e,r={}){const c=r.baseUrl??"",t=r.maxErrorMessageLength??T;async function u(n,o={}){const i=(o.method??"GET").toUpperCase(),d=`${c}${n}`,S=o.body!==void 0,f=Q(r.headers,o.headers);f.has("Accept")||f.set("Accept","application/json"),S&&!f.has("Content-Type")&&f.set("Content-Type","application/json");const E={method:i,headers:f};r.credentials!==void 0&&(E.credentials=r.credentials),S&&(E.body=JSON.stringify(o.body)),o.signal!==void 0&&o.signal!==null&&(E.signal=o.signal);const R=`${i} ${d}`;let m;try{m=await e(d,E)}catch($){throw g.from($)}if(!m.ok)throw await a(m);return y(m,R)}s(u,"request");async function a(n){let o="";try{o=await n.text()}catch{}const i=I(o,n.status,t);if(Object.hasOwn(b,n.status)){const d=b[n.status];return new d(i.message??void 0)}return new h(n.status,i.message??`Request failed with status ${n.status}.`,i.type)}s(a,"toServiceError");async function y(n,o){if(n.status===204)return;let i;try{i=await n.text()}catch(d){throw g.from(d)}if(i.trim()!=="")try{return JSON.parse(i)}catch{throw new h(n.status,`Malformed response body: ${o}`,null)}}return s(y,"readJson"),{request:u,get:s(async(n,o)=>u(`${n}${o===void 0?"":w(o)}`),"get"),post:s(async(n,o)=>u(n,{method:"POST",body:o}),"post"),put:s(async(n,o)=>u(n,{method:"PUT",body:o}),"put"),patch:s(async(n,o)=>u(n,{method:"PATCH",body:o}),"patch"),delete:s(async(n,o)=>u(n,{method:"DELETE",body:o}),"delete")}}s(z,"createApiClient");export{h as HttpStatusError,T as MAX_ERROR_MESSAGE_LENGTH,w as buildQuery,z as createApiClient};
1
+ var A=Object.defineProperty;var s=(e,r)=>A(e,"name",{value:r,configurable:!0});import{BadGatewayError as C,BadRequestError as O,ConflictError as H,ForbiddenError as P,InternalServerError as M,MethodNotAllowedError as N,NotFoundError as U,NotImplementedError as x,PayloadTooLargeError as j,PreconditionFailedError as L,RateLimitedError as _,ServiceError as g,ServiceUnavailableError as F,UnauthorizedError as J,UnsupportedMediaTypeError as q}from"@rexezuge/errors";const T=500,b={400:O,401:J,403:P,404:U,405:N,409:H,412:L,413:j,415:q,429:_,500:M,501:x,502:C,503:F};class h extends g{static{s(this,"HttpStatusError")}constructor(r,u,t){super(r,t??`HttpStatus${r}`,u)}}function l(e){return typeof e=="string"&&e.trim()!==""?e:null}s(l,"readString");function p(e,r){return e.length>r?`${e.slice(0,r)}\u2026`:e}s(p,"truncate");const B=/[\u0000-\u001F\u007F]/;function G(e,r){return e.length===0||e.length>r||e.includes("<")?!1:!B.test(e)}s(G,"isProbablyProse");function v(e,r,u){if(typeof e=="string"){const n=e.trim();return{message:n===""?null:p(n,u),type:null}}if(typeof e!="object"||e===null)return{message:null,type:null};const t=e,c=typeof t.error=="object"&&t.error!==null?t.error:null,a=l(t.Exception?.Type)??(typeof t.error=="string"?l(t.error):null)??l(c?.code)??l(t.code)??null,E=l(t.Exception?.Message)??l(t.message)??(typeof t.error=="string"?l(t.error):null)??l(c?.message)??null;return E!==null?{message:p(E,u),type:a}:a!==null?{message:`${a} (HTTP ${r})`,type:a}:{message:null,type:null}}s(v,"decodeJsonError");function I(e,r,u){const t=e.trim();if(t==="")return{message:null,type:null};try{return v(JSON.parse(t),r,u)}catch{return{message:G(t,u)?p(t,u):null,type:null}}}s(I,"decodeErrorBody");function Q(e,r){const u=new Headers(e);if(r===void 0)return u;for(const[t,c]of new Headers(r))u.set(t,c);return u}s(Q,"mergeHeaders");function k(e){return Array.isArray(e)}s(k,"isQueryList");function w(e){const r=new URLSearchParams;for(const[t,c]of Object.entries(e))if(!(c==null||c==="")){if(k(c)){for(const a of c)a!=null&&a!==""&&r.append(t,String(a));continue}r.set(t,String(c))}const u=r.toString();return u===""?"":`?${u}`}s(w,"buildQuery");function z(e,r={}){const u=r.baseUrl??"",t=r.maxErrorMessageLength??T;async function c(n,o={}){const i=(o.method??"GET").toUpperCase(),d=`${u}${n}`,S=o.body!==void 0,f=Q(r.headers,o.headers);f.has("Accept")||f.set("Accept","application/json"),S&&!f.has("Content-Type")&&f.set("Content-Type","application/json");const y={method:i,headers:f};r.credentials!==void 0&&(y.credentials=r.credentials),S&&(y.body=JSON.stringify(o.body)),o.signal!==void 0&&o.signal!==null&&(y.signal=o.signal),o.cache!==void 0&&(y.cache=o.cache);const R=`${i} ${d}`;let m;try{m=await e(d,y)}catch($){throw g.from($)}if(!m.ok)throw await a(m);return E(m,R)}s(c,"request");async function a(n){let o="";try{o=await n.text()}catch{}const i=I(o,n.status,t);if(Object.hasOwn(b,n.status)){const d=b[n.status];return new d(i.message??void 0)}return new h(n.status,i.message??`Request failed with status ${n.status}.`,i.type)}s(a,"toServiceError");async function E(n,o){if(n.status===204)return;let i;try{i=await n.text()}catch(d){throw g.from(d)}if(i.trim()!=="")try{return JSON.parse(i)}catch{throw new h(n.status,`Malformed response body: ${o}`,null)}}return s(E,"readJson"),{request:c,get:s(async(n,o)=>c(`${n}${o===void 0?"":w(o)}`),"get"),post:s(async(n,o)=>c(n,{method:"POST",body:o}),"post"),put:s(async(n,o)=>c(n,{method:"PUT",body:o}),"put"),patch:s(async(n,o)=>c(n,{method:"PATCH",body:o}),"patch"),delete:s(async(n,o)=>c(n,{method:"DELETE",body:o}),"delete")}}s(z,"createApiClient");export{h as HttpStatusError,T as MAX_ERROR_MESSAGE_LENGTH,w as buildQuery,z as createApiClient};
package/dist/api.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/api.ts"],
4
- "sourcesContent": ["import {\n BadGatewayError,\n BadRequestError,\n ConflictError,\n ForbiddenError,\n InternalServerError,\n MethodNotAllowedError,\n NotFoundError,\n NotImplementedError,\n PayloadTooLargeError,\n PreconditionFailedError,\n RateLimitedError,\n ServiceError,\n ServiceUnavailableError,\n UnauthorizedError,\n UnsupportedMediaTypeError,\n} from '@rexezuge/errors';\n\n/**\n * The SPA's request path.\n *\n * ## Provenance\n *\n * `lib/api.ts` in **CalDAV-Bridge**, **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git**, **Edge-Sonic**, **Mail-Otter** and **AWS-AccessBridge** — seven\n * copies that all drift on the same three decisions, settled here as follows.\n *\n * **1. Error model.** Six of the seven define a private `BackendError`\n * (`{ message, errorType, status }`) and hand-roll the status→branch mapping at\n * every call site; AWS defines `ApiError` (`{ status, message }`) plus an\n * `ApiResult{ok,status,data,error}` shape that its own guide records as\n * abandoned — every admin tab bypassed it, which is how nine of its seventeen\n * functions ended up with no caller. The kit replaces both with the family\n * taxonomy: every rejection is a `ServiceError`, so `error.status`,\n * `error.type`, `error.retryable` and `instanceof ServiceError` are available\n * without a per-repo error class, and `ServiceError.from` covers the\n * transport-level failures the private classes swallowed.\n *\n * **2. Error body decoding.** Converged from the three variants that exist:\n *\n * - The **AWS envelope** `{ Exception: { Type, Message } }`, read first in all\n * copies.\n * - The **legacy** `{ error, message }` shape, where Durable-DAV also reads a\n * string `error` as the *type* — otherwise a legacy body produced a correct\n * message and a `null` type, which sent it through the generic fallback and\n * lost the specific wording.\n * - **Edge-Sonic's prose test** for a non-JSON body: an Access login page or a\n * proxy's HTML error page is not a message an operator can act on, so markup\n * is reported as absent rather than quoted into a notice bar. Short,\n * single-line, tag-free text *is* surfaced, truncated.\n * - **Truncation** at 500 characters, from every copy that has one: an\n * unbounded error string from a proxy page is a rendering hazard.\n * - **`text()` then `JSON.parse`, never `json()` with a `text()` fallback** —\n * Edge-Sonic's comment records why the old shape cannot work: `json()`\n * consumes the body stream before it fails to parse, so the second read\n * returned `''` and the \"not JSON\" branch was unreachable.\n *\n * **3. Empty bodies.** Durable-DAV's fix is the one kept: a `204`, and an empty\n * body from an edge error page, resolve to `undefined` rather than throwing a\n * `SyntaxError` — which used to report a generic failure for an operation that\n * had actually succeeded (credential revoke). AWS-AccessBridge resolved the same\n * case to `{}`; `undefined` is the honest answer for \"there is no body\".\n *\n * ## What is deliberately not here\n *\n * - **The D1 session bookmark** (`x-d1-bookmark`, CalDAV-Bridge and\n * Mail-Otter). It is module state threading a D1 replica pin through every\n * `/user/*` request; the kit has no D1 client, so the header policy stays\n * with the repos that own the binding.\n * - **`apiAuthedFirst`** (Edge-Git) — a public-fallback policy with\n * fail-closed 401/403/404 handling, specific to that app's two-surface API.\n * - **WebDAV `readDav`** (Durable-DAV, Durable-DAV-Router) — it accepts `207\n * Multi-Status` as success, which is a WebDAV rule, not an HTTP rule. A\n * consumer needing XML calls `client.request` and reads `response.text()`\n * itself.\n * - **The `/user` base path.** Edge-Sonic bakes it in; the others pass full\n * paths. `baseUrl` is an option here, defaulting to empty, so the caller\n * decides.\n */\n\n/**\nThe `fetch` shape a client is built on: same-origin by default, no token in JavaScript.\n*/\ntype FetchFn = (input: string, init?: RequestInit) => Promise<Response>;\n\n/**\nA query-string value. `null`/`undefined`/`''` are omitted, as in every copy.\n*/\ntype QueryValue = string | number | boolean | null | undefined;\n\ntype QueryParams = Record<string, QueryValue | readonly QueryValue[]>;\n\ninterface ApiRequestInit {\n method?: string;\n /**\n Serialized as JSON with a matching `Content-Type`.\n */\n body?: unknown;\n headers?: HeadersInit;\n signal?: AbortSignal | null;\n}\n\ninterface CreateApiClientOptions {\n /**\n Prepended to every path; `''` (the default) sends the path as given.\n */\n baseUrl?: string;\n /**\n Headers merged into every request; a per-request header wins over these.\n */\n headers?: HeadersInit;\n /**\n Passed through to `fetch`; omitted leaves the browser default.\n */\n credentials?: RequestCredentials;\n /**\n Truncation limit for a server-provided error message. Defaults to 500.\n */\n maxErrorMessageLength?: number;\n}\n\ninterface ApiClient {\n /**\n One request. Throws a `ServiceError`; resolves to the parsed JSON body.\n */\n request<T>(path: string, init?: ApiRequestInit): Promise<T>;\n get<T>(path: string, params?: QueryParams): Promise<T>;\n post<T>(path: string, body?: unknown): Promise<T>;\n put<T>(path: string, body?: unknown): Promise<T>;\n patch<T>(path: string, body?: unknown): Promise<T>;\n delete<T>(path: string, body?: unknown): Promise<T>;\n}\n\n/**\nDefault truncation for a server-provided message.\n*/\nconst MAX_ERROR_MESSAGE_LENGTH = 500;\n\n/**\n * Statuses the family taxonomy has a class for, mapped to it.\n *\n * The map is keyed by status rather than by the server's `Exception.Type`\n * because the status is the fact that survives a rolling deploy: a body from an\n * older Worker build still carries today's status, while a `Type` may be\n * spelled either way.\n */\nconst HTTP_ERROR_CLASSES: Readonly<Record<number, new (message?: string) => ServiceError>> = {\n 400: BadRequestError,\n 401: UnauthorizedError,\n 403: ForbiddenError,\n 404: NotFoundError,\n 405: MethodNotAllowedError,\n 409: ConflictError,\n 412: PreconditionFailedError,\n 413: PayloadTooLargeError,\n 415: UnsupportedMediaTypeError,\n 429: RateLimitedError,\n 500: InternalServerError,\n 501: NotImplementedError,\n 502: BadGatewayError,\n 503: ServiceUnavailableError,\n};\n\n/**\n * A failure whose only fact is its HTTP status: a status the catalog has no\n * class for (451, 418, a proxy's own 5xx), or a 2xx body that is not JSON.\n *\n * It exists so the thrown value is *always* a `ServiceError` — a caller\n * branching on `instanceof ServiceError` does not have to know which statuses\n * the catalog happens to cover.\n */\nclass HttpStatusError extends ServiceError {\n constructor(status: number, message: string, type: string | null) {\n super(status, type ?? `HttpStatus${status}`, message);\n }\n}\n\ninterface DecodedErrorBody {\n /**\n What the server said, or `null` when it said nothing usable.\n */\n message: string | null;\n /**\n The server's machine-readable code, when it sent one.\n */\n type: string | null;\n}\n\nfunction readString(value: unknown): string | null {\n return typeof value === 'string' && value.trim() !== '' ? value : null;\n}\n\nfunction truncate(value: string, maxLength: number): string {\n return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;\n}\n\n/**\nRejects control characters: that is what separates text from a binary or a document.\n*/\n// eslint-disable-next-line no-control-regex -- rejecting control characters IS the test\nconst CONTROL_CHARACTER = /[\\u0000-\\u001F\\u007F]/;\n\n/**\n * Whether a non-JSON error body is text worth showing rather than markup or a\n * blob. Deliberately conservative: the cost of wrongly refusing is the generic\n * status sentence, and the cost of wrongly accepting is an HTML page in a\n * notice bar.\n */\nfunction isProbablyProse(raw: string, maxLength: number): boolean {\n if (raw.length === 0 || raw.length > maxLength || raw.includes('<')) {\n return false;\n }\n return !CONTROL_CHARACTER.test(raw);\n}\n\nfunction decodeJsonError(payload: unknown, status: number, maxLength: number): DecodedErrorBody {\n if (typeof payload === 'string') {\n const message = payload.trim();\n return { message: message === '' ? null : truncate(message, maxLength), type: null };\n }\n if (typeof payload !== 'object' || payload === null) {\n return { message: null, type: null };\n }\n // Three dialects, newest first: the AWS envelope, the unified `{error:\n // {code,message}}` object, and the legacy flat `{error, message}`.\n const envelope = payload as {\n Exception?: { Type?: unknown; Message?: unknown };\n error?: unknown;\n message?: unknown;\n code?: unknown;\n };\n const nestedError =\n typeof envelope.error === 'object' && envelope.error !== null ? (envelope.error as { message?: unknown; code?: unknown }) : null;\n const type =\n readString(envelope.Exception?.Type) ??\n (typeof envelope.error === 'string' ? readString(envelope.error) : null) ??\n readString(nestedError?.code) ??\n readString(envelope.code) ??\n null;\n const message =\n readString(envelope.Exception?.Message) ??\n readString(envelope.message) ??\n (typeof envelope.error === 'string' ? readString(envelope.error) : null) ??\n readString(nestedError?.message) ??\n null;\n if (message !== null) {\n return { message: truncate(message, maxLength), type };\n }\n if (type !== null) {\n // The server named the failure but gave no sentence for it.\n return { message: `${type} (HTTP ${status})`, type };\n }\n return { message: null, type: null };\n}\n\nfunction decodeErrorBody(text: string, status: number, maxLength: number): DecodedErrorBody {\n const trimmed = text.trim();\n if (trimmed === '') {\n return { message: null, type: null };\n }\n try {\n return decodeJsonError(JSON.parse(trimmed) as unknown, status, maxLength);\n } catch {\n return { message: isProbablyProse(trimmed, maxLength) ? truncate(trimmed, maxLength) : null, type: null };\n }\n}\n\nfunction mergeHeaders(base: HeadersInit | undefined, overrides?: HeadersInit): Headers {\n const headers = new Headers(base);\n if (overrides === undefined) {\n return headers;\n }\n for (const [name, value] of new Headers(overrides)) {\n headers.set(name, value);\n }\n return headers;\n}\n\nfunction isQueryList(value: QueryValue | readonly QueryValue[]): value is readonly QueryValue[] {\n return Array.isArray(value);\n}\n\n/**\n * Builds a query string, with the leading `?` and without it when empty.\n *\n * `null`, `undefined` and `''` are dropped rather than sent as empty\n * parameters, and an array value repeats the key — both as in the copies this\n * replaces.\n */\nfunction buildQuery(params: QueryParams): string {\n const search = new URLSearchParams();\n for (const [name, value] of Object.entries(params)) {\n if (value === undefined || value === null || value === '') {\n continue;\n }\n if (isQueryList(value)) {\n for (const entry of value) {\n if (entry !== undefined && entry !== null && entry !== '') {\n search.append(name, String(entry));\n }\n }\n continue;\n }\n search.set(name, String(value));\n }\n const encoded = search.toString();\n return encoded === '' ? '' : `?${encoded}`;\n}\n\n/**\n * Builds a client over a `fetch` implementation.\n *\n * ```ts\n * const api = createApiClient(fetch, { baseUrl: '/user' });\n * const me = await api.get<CurrentUser>('/me');\n * ```\n *\n * The `fetchFn` parameter is what makes this testable without a network and\n * swappable for an instrumented wrapper; in a browser it is the global `fetch`.\n * Memoize the client (a module constant, or `useMemo`) — `useCurrentUser`\n * deliberately does not re-fetch when a new client instance appears, but a new\n * instance per render still churns.\n */\nfunction createApiClient(fetchFn: FetchFn, options: CreateApiClientOptions = {}): ApiClient {\n const baseUrl = options.baseUrl ?? '';\n const maxErrorMessageLength = options.maxErrorMessageLength ?? MAX_ERROR_MESSAGE_LENGTH;\n\n async function request<T>(path: string, init: ApiRequestInit = {}): Promise<T> {\n const method = (init.method ?? 'GET').toUpperCase();\n const url = `${baseUrl}${path}`;\n const hasBody = init.body !== undefined;\n const headers = mergeHeaders(options.headers, init.headers);\n // Same-origin only, and no token in JavaScript: the Cloudflare Access\n // session cookie rides along under the default credentials, and there is no\n // place for a token to leak to. Both defaults yield to an explicit header\n // — a consumer that wants XML passes its own `Accept`.\n if (!headers.has('Accept')) {\n headers.set('Accept', 'application/json');\n }\n if (hasBody && !headers.has('Content-Type')) {\n headers.set('Content-Type', 'application/json');\n }\n const requestInit: RequestInit = { method, headers };\n if (options.credentials !== undefined) {\n requestInit.credentials = options.credentials;\n }\n if (hasBody) {\n requestInit.body = JSON.stringify(init.body);\n }\n if (init.signal !== undefined && init.signal !== null) {\n requestInit.signal = init.signal;\n }\n\n const context = `${method} ${url}`;\n let response: Response;\n try {\n response = await fetchFn(url, requestInit);\n } catch (cause) {\n // The transport never answered — offline, DNS, CORS, an aborted signal.\n // There is no status to report, so the failure normalizes through\n // `ServiceError.from` like any other unknown throw. A caller that cancels\n // its own request therefore sees a 500-shaped error too; the taxonomy has\n // no \"aborted\" class, and swallowing it here would hide real transport\n // failures. A caller that cancels should not surface the rejection.\n throw ServiceError.from(cause);\n }\n if (!response.ok) {\n throw await toServiceError(response);\n }\n return readJson<T>(response, context);\n }\n\n async function toServiceError(response: Response): Promise<ServiceError> {\n let text = '';\n try {\n text = await response.text();\n } catch {\n // The body could not be read at all — a reset after the headers. The\n // status is still the one true thing about the request, and the catalog\n // default message says more than anything this could invent.\n }\n const decoded = decodeErrorBody(text, response.status, maxErrorMessageLength);\n if (Object.hasOwn(HTTP_ERROR_CLASSES, response.status)) {\n const ErrorClass = HTTP_ERROR_CLASSES[response.status];\n // A `null` message leaves the catalog's default in place, which is a\n // better sentence than anything the client could invent.\n return new ErrorClass(decoded.message ?? undefined);\n }\n return new HttpStatusError(response.status, decoded.message ?? `Request failed with status ${response.status}.`, decoded.type);\n }\n\n async function readJson<T>(response: Response, context: string): Promise<T> {\n if (response.status === 204) {\n return undefined as T;\n }\n let text: string;\n try {\n text = await response.text();\n } catch (cause) {\n throw ServiceError.from(cause);\n }\n if (text.trim() === '') {\n return undefined as T;\n }\n try {\n return JSON.parse(text) as T;\n } catch {\n // A 2xx body that is not JSON is an HTML error page from a proxy. It must\n // surface as a ServiceError, not a SyntaxError, so the caller's error\n // handling has one shape to recognize.\n throw new HttpStatusError(response.status, `Malformed response body: ${context}`, null);\n }\n }\n\n return {\n request,\n get: async <T>(path: string, params?: QueryParams): Promise<T> =>\n request<T>(`${path}${params === undefined ? '' : buildQuery(params)}`),\n post: async <T>(path: string, body?: unknown): Promise<T> => request<T>(path, { method: 'POST', body }),\n put: async <T>(path: string, body?: unknown): Promise<T> => request<T>(path, { method: 'PUT', body }),\n patch: async <T>(path: string, body?: unknown): Promise<T> => request<T>(path, { method: 'PATCH', body }),\n delete: async <T>(path: string, body?: unknown): Promise<T> => request<T>(path, { method: 'DELETE', body }),\n };\n}\n\nexport { buildQuery, createApiClient, HttpStatusError, MAX_ERROR_MESSAGE_LENGTH };\nexport type { ApiClient, ApiRequestInit, CreateApiClientOptions, FetchFn, QueryParams, QueryValue };\n"],
5
- "mappings": "+EAAA,OACE,mBAAAA,EACA,mBAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,uBAAAC,EACA,yBAAAC,EACA,iBAAAC,EACA,uBAAAC,EACA,wBAAAC,EACA,2BAAAC,EACA,oBAAAC,EACA,gBAAAC,EACA,2BAAAC,EACA,qBAAAC,EACA,6BAAAC,MACK,mBAwHP,MAAMC,EAA2B,IAU3BC,EAAuF,CAC3F,IAAKf,EACL,IAAKY,EACL,IAAKV,EACL,IAAKG,EACL,IAAKD,EACL,IAAKH,EACL,IAAKO,EACL,IAAKD,EACL,IAAKM,EACL,IAAKJ,EACL,IAAKN,EACL,IAAKG,EACL,IAAKP,EACL,IAAKY,GAWP,MAAMK,UAAwBN,CAAY,CA3K1C,MA2K0C,CAAAO,EAAA,wBACxC,YAAYC,EAAgBC,EAAiBC,EAAmB,CAC9D,MAAMF,EAAQE,GAAQ,aAAaF,CAAM,GAAIC,CAAO,CACtD,EAcF,SAASE,EAAWC,EAAc,CAChC,OAAO,OAAOA,GAAU,UAAYA,EAAM,KAAI,IAAO,GAAKA,EAAQ,IACpE,CAFSL,EAAAI,EAAA,cAIT,SAASE,EAASD,EAAeE,EAAiB,CAChD,OAAOF,EAAM,OAASE,EAAY,GAAGF,EAAM,MAAM,EAAGE,CAAS,CAAC,SAAMF,CACtE,C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C,EAAA,kBAmBf,eAAeC,EAAYH,EAAoBD,EAAe,CAC5D,GAAIC,EAAS,SAAW,IACtB,OAEF,IAAI1B,EACJ,GAAI,CACFA,EAAO,MAAM0B,EAAS,KAAI,CAC5B,OAASC,EAAO,CACd,MAAMlD,EAAa,KAAKkD,CAAK,CAC/B,CACA,GAAI3B,EAAK,KAAI,IAAO,GAGpB,GAAI,CACF,OAAO,KAAK,MAAMA,CAAI,CACxB,MAAQ,CAIN,MAAM,IAAIjB,EAAgB2C,EAAS,OAAQ,4BAA4BD,CAAO,GAAI,IAAI,CACxF,CACF,CArBe,OAAAzC,EAAA6C,EAAA,YAuBR,CACL,QAAAX,EACA,IAAKlC,EAAA,MAAUmC,EAAcV,IAC3BS,EAAW,GAAGC,CAAI,GAAGV,IAAW,OAAY,GAAKD,EAAWC,CAAM,CAAC,EAAE,EADlE,OAEL,KAAMzB,EAAA,MAAUmC,EAAca,IAA+Bd,EAAWC,EAAM,CAAE,OAAQ,OAAQ,KAAAa,CAAI,CAAE,EAAhG,QACN,IAAKhD,EAAA,MAAUmC,EAAca,IAA+Bd,EAAWC,EAAM,CAAE,OAAQ,MAAO,KAAAa,CAAI,CAAE,EAA/F,OACL,MAAOhD,EAAA,MAAUmC,EAAca,IAA+Bd,EAAWC,EAAM,CAAE,OAAQ,QAAS,KAAAa,CAAI,CAAE,EAAjG,SACP,OAAQhD,EAAA,MAAUmC,EAAca,IAA+Bd,EAAWC,EAAM,CAAE,OAAQ,SAAU,KAAAa,CAAI,CAAE,EAAlG,UAEZ,CApGShD,EAAA6B,EAAA",
4
+ "sourcesContent": ["import {\n BadGatewayError,\n BadRequestError,\n ConflictError,\n ForbiddenError,\n InternalServerError,\n MethodNotAllowedError,\n NotFoundError,\n NotImplementedError,\n PayloadTooLargeError,\n PreconditionFailedError,\n RateLimitedError,\n ServiceError,\n ServiceUnavailableError,\n UnauthorizedError,\n UnsupportedMediaTypeError,\n} from '@rexezuge/errors';\n\n/**\n * The SPA's request path.\n *\n * ## Provenance\n *\n * `lib/api.ts` in **CalDAV-Bridge**, **Durable-DAV**, **Durable-DAV-Router**,\n * **Edge-Git**, **Edge-Sonic**, **Mail-Otter** and **AWS-AccessBridge** — seven\n * copies that all drift on the same three decisions, settled here as follows.\n *\n * **1. Error model.** Six of the seven define a private `BackendError`\n * (`{ message, errorType, status }`) and hand-roll the status→branch mapping at\n * every call site; AWS defines `ApiError` (`{ status, message }`) plus an\n * `ApiResult{ok,status,data,error}` shape that its own guide records as\n * abandoned — every admin tab bypassed it, which is how nine of its seventeen\n * functions ended up with no caller. The kit replaces both with the family\n * taxonomy: every rejection is a `ServiceError`, so `error.status`,\n * `error.type`, `error.retryable` and `instanceof ServiceError` are available\n * without a per-repo error class, and `ServiceError.from` covers the\n * transport-level failures the private classes swallowed.\n *\n * **2. Error body decoding.** Converged from the three variants that exist:\n *\n * - The **AWS envelope** `{ Exception: { Type, Message } }`, read first in all\n * copies.\n * - The **legacy** `{ error, message }` shape, where Durable-DAV also reads a\n * string `error` as the *type* — otherwise a legacy body produced a correct\n * message and a `null` type, which sent it through the generic fallback and\n * lost the specific wording.\n * - **Edge-Sonic's prose test** for a non-JSON body: an Access login page or a\n * proxy's HTML error page is not a message an operator can act on, so markup\n * is reported as absent rather than quoted into a notice bar. Short,\n * single-line, tag-free text *is* surfaced, truncated.\n * - **Truncation** at 500 characters, from every copy that has one: an\n * unbounded error string from a proxy page is a rendering hazard.\n * - **`text()` then `JSON.parse`, never `json()` with a `text()` fallback** —\n * Edge-Sonic's comment records why the old shape cannot work: `json()`\n * consumes the body stream before it fails to parse, so the second read\n * returned `''` and the \"not JSON\" branch was unreachable.\n *\n * **3. Empty bodies.** Durable-DAV's fix is the one kept: a `204`, and an empty\n * body from an edge error page, resolve to `undefined` rather than throwing a\n * `SyntaxError` — which used to report a generic failure for an operation that\n * had actually succeeded (credential revoke). AWS-AccessBridge resolved the same\n * case to `{}`; `undefined` is the honest answer for \"there is no body\".\n *\n * ## What is deliberately not here\n *\n * - **The D1 session bookmark** (`x-d1-bookmark`, CalDAV-Bridge and\n * Mail-Otter). It is module state threading a D1 replica pin through every\n * `/user/*` request; the kit has no D1 client, so the header policy stays\n * with the repos that own the binding.\n * - **`apiAuthedFirst`** (Edge-Git) — a public-fallback policy with\n * fail-closed 401/403/404 handling, specific to that app's two-surface API.\n * - **WebDAV `readDav`** (Durable-DAV, Durable-DAV-Router) — it accepts `207\n * Multi-Status` as success, which is a WebDAV rule, not an HTTP rule. A\n * consumer needing XML calls `client.request` and reads `response.text()`\n * itself.\n * - **The `/user` base path.** Edge-Sonic bakes it in; the others pass full\n * paths. `baseUrl` is an option here, defaulting to empty, so the caller\n * decides.\n */\n\n/**\nThe `fetch` shape a client is built on: same-origin by default, no token in JavaScript.\n*/\ntype FetchFn = (input: string, init?: RequestInit) => Promise<Response>;\n\n/**\nA query-string value. `null`/`undefined`/`''` are omitted, as in every copy.\n*/\ntype QueryValue = string | number | boolean | null | undefined;\n\ntype QueryParams = Record<string, QueryValue | readonly QueryValue[]>;\n\ninterface ApiRequestInit {\n method?: string;\n /**\n Serialized as JSON with a matching `Content-Type`.\n */\n body?: unknown;\n headers?: HeadersInit;\n signal?: AbortSignal | null;\n /**\n Passed through to `fetch`; omitted leaves the browser default.\n\n It is a standard `RequestInit` field, so a caller that needs `'no-store'`\n (an auth probe that must never read a cached page) or `'reload'` does not have\n to reach around the client to set it.\n */\n cache?: RequestCache;\n}\n\ninterface CreateApiClientOptions {\n /**\n Prepended to every path; `''` (the default) sends the path as given.\n */\n baseUrl?: string;\n /**\n Headers merged into every request; a per-request header wins over these.\n */\n headers?: HeadersInit;\n /**\n Passed through to `fetch`; omitted leaves the browser default.\n */\n credentials?: RequestCredentials;\n /**\n Truncation limit for a server-provided error message. Defaults to 500.\n */\n maxErrorMessageLength?: number;\n}\n\ninterface ApiClient {\n /**\n One request. Throws a `ServiceError`; resolves to the parsed JSON body.\n */\n request<T>(path: string, init?: ApiRequestInit): Promise<T>;\n get<T>(path: string, params?: QueryParams): Promise<T>;\n post<T>(path: string, body?: unknown): Promise<T>;\n put<T>(path: string, body?: unknown): Promise<T>;\n patch<T>(path: string, body?: unknown): Promise<T>;\n delete<T>(path: string, body?: unknown): Promise<T>;\n}\n\n/**\nDefault truncation for a server-provided message.\n*/\nconst MAX_ERROR_MESSAGE_LENGTH = 500;\n\n/**\n * Statuses the family taxonomy has a class for, mapped to it.\n *\n * The map is keyed by status rather than by the server's `Exception.Type`\n * because the status is the fact that survives a rolling deploy: a body from an\n * older Worker build still carries today's status, while a `Type` may be\n * spelled either way.\n */\nconst HTTP_ERROR_CLASSES: Readonly<Record<number, new (message?: string) => ServiceError>> = {\n 400: BadRequestError,\n 401: UnauthorizedError,\n 403: ForbiddenError,\n 404: NotFoundError,\n 405: MethodNotAllowedError,\n 409: ConflictError,\n 412: PreconditionFailedError,\n 413: PayloadTooLargeError,\n 415: UnsupportedMediaTypeError,\n 429: RateLimitedError,\n 500: InternalServerError,\n 501: NotImplementedError,\n 502: BadGatewayError,\n 503: ServiceUnavailableError,\n};\n\n/**\n * A failure whose only fact is its HTTP status: a status the catalog has no\n * class for (451, 418, a proxy's own 5xx), or a 2xx body that is not JSON.\n *\n * It exists so the thrown value is *always* a `ServiceError` — a caller\n * branching on `instanceof ServiceError` does not have to know which statuses\n * the catalog happens to cover.\n */\nclass HttpStatusError extends ServiceError {\n constructor(status: number, message: string, type: string | null) {\n super(status, type ?? `HttpStatus${status}`, message);\n }\n}\n\ninterface DecodedErrorBody {\n /**\n What the server said, or `null` when it said nothing usable.\n */\n message: string | null;\n /**\n The server's machine-readable code, when it sent one.\n */\n type: string | null;\n}\n\nfunction readString(value: unknown): string | null {\n return typeof value === 'string' && value.trim() !== '' ? value : null;\n}\n\nfunction truncate(value: string, maxLength: number): string {\n return value.length > maxLength ? `${value.slice(0, maxLength)}…` : value;\n}\n\n/**\nRejects control characters: that is what separates text from a binary or a document.\n*/\n// eslint-disable-next-line no-control-regex -- rejecting control characters IS the test\nconst CONTROL_CHARACTER = /[\\u0000-\\u001F\\u007F]/;\n\n/**\n * Whether a non-JSON error body is text worth showing rather than markup or a\n * blob. Deliberately conservative: the cost of wrongly refusing is the generic\n * status sentence, and the cost of wrongly accepting is an HTML page in a\n * notice bar.\n */\nfunction isProbablyProse(raw: string, maxLength: number): boolean {\n if (raw.length === 0 || raw.length > maxLength || raw.includes('<')) {\n return false;\n }\n return !CONTROL_CHARACTER.test(raw);\n}\n\nfunction decodeJsonError(payload: unknown, status: number, maxLength: number): DecodedErrorBody {\n if (typeof payload === 'string') {\n const message = payload.trim();\n return { message: message === '' ? null : truncate(message, maxLength), type: null };\n }\n if (typeof payload !== 'object' || payload === null) {\n return { message: null, type: null };\n }\n // Three dialects, newest first: the AWS envelope, the unified `{error:\n // {code,message}}` object, and the legacy flat `{error, message}`.\n const envelope = payload as {\n Exception?: { Type?: unknown; Message?: unknown };\n error?: unknown;\n message?: unknown;\n code?: unknown;\n };\n const nestedError =\n typeof envelope.error === 'object' && envelope.error !== null ? (envelope.error as { message?: unknown; code?: unknown }) : null;\n const type =\n readString(envelope.Exception?.Type) ??\n (typeof envelope.error === 'string' ? readString(envelope.error) : null) ??\n readString(nestedError?.code) ??\n readString(envelope.code) ??\n null;\n const message =\n readString(envelope.Exception?.Message) ??\n readString(envelope.message) ??\n (typeof envelope.error === 'string' ? readString(envelope.error) : null) ??\n readString(nestedError?.message) ??\n null;\n if (message !== null) {\n return { message: truncate(message, maxLength), type };\n }\n if (type !== null) {\n // The server named the failure but gave no sentence for it.\n return { message: `${type} (HTTP ${status})`, type };\n }\n return { message: null, type: null };\n}\n\nfunction decodeErrorBody(text: string, status: number, maxLength: number): DecodedErrorBody {\n const trimmed = text.trim();\n if (trimmed === '') {\n return { message: null, type: null };\n }\n try {\n return decodeJsonError(JSON.parse(trimmed) as unknown, status, maxLength);\n } catch {\n return { message: isProbablyProse(trimmed, maxLength) ? truncate(trimmed, maxLength) : null, type: null };\n }\n}\n\nfunction mergeHeaders(base: HeadersInit | undefined, overrides?: HeadersInit): Headers {\n const headers = new Headers(base);\n if (overrides === undefined) {\n return headers;\n }\n for (const [name, value] of new Headers(overrides)) {\n headers.set(name, value);\n }\n return headers;\n}\n\nfunction isQueryList(value: QueryValue | readonly QueryValue[]): value is readonly QueryValue[] {\n return Array.isArray(value);\n}\n\n/**\n * Builds a query string, with the leading `?` and without it when empty.\n *\n * `null`, `undefined` and `''` are dropped rather than sent as empty\n * parameters, and an array value repeats the key — both as in the copies this\n * replaces.\n */\nfunction buildQuery(params: QueryParams): string {\n const search = new URLSearchParams();\n for (const [name, value] of Object.entries(params)) {\n if (value === undefined || value === null || value === '') {\n continue;\n }\n if (isQueryList(value)) {\n for (const entry of value) {\n if (entry !== undefined && entry !== null && entry !== '') {\n search.append(name, String(entry));\n }\n }\n continue;\n }\n search.set(name, String(value));\n }\n const encoded = search.toString();\n return encoded === '' ? '' : `?${encoded}`;\n}\n\n/**\n * Builds a client over a `fetch` implementation.\n *\n * ```ts\n * const api = createApiClient(fetch, { baseUrl: '/user' });\n * const me = await api.get<CurrentUser>('/me');\n * ```\n *\n * The `fetchFn` parameter is what makes this testable without a network and\n * swappable for an instrumented wrapper; in a browser it is the global `fetch`.\n * Memoize the client (a module constant, or `useMemo`) — `useCurrentUser`\n * deliberately does not re-fetch when a new client instance appears, but a new\n * instance per render still churns.\n */\nfunction createApiClient(fetchFn: FetchFn, options: CreateApiClientOptions = {}): ApiClient {\n const baseUrl = options.baseUrl ?? '';\n const maxErrorMessageLength = options.maxErrorMessageLength ?? MAX_ERROR_MESSAGE_LENGTH;\n\n async function request<T>(path: string, init: ApiRequestInit = {}): Promise<T> {\n const method = (init.method ?? 'GET').toUpperCase();\n const url = `${baseUrl}${path}`;\n const hasBody = init.body !== undefined;\n const headers = mergeHeaders(options.headers, init.headers);\n // Same-origin only, and no token in JavaScript: the Cloudflare Access\n // session cookie rides along under the default credentials, and there is no\n // place for a token to leak to. Both defaults yield to an explicit header\n // — a consumer that wants XML passes its own `Accept`.\n if (!headers.has('Accept')) {\n headers.set('Accept', 'application/json');\n }\n if (hasBody && !headers.has('Content-Type')) {\n headers.set('Content-Type', 'application/json');\n }\n const requestInit: RequestInit = { method, headers };\n if (options.credentials !== undefined) {\n requestInit.credentials = options.credentials;\n }\n if (hasBody) {\n requestInit.body = JSON.stringify(init.body);\n }\n if (init.signal !== undefined && init.signal !== null) {\n requestInit.signal = init.signal;\n }\n if (init.cache !== undefined) {\n requestInit.cache = init.cache;\n }\n\n const context = `${method} ${url}`;\n let response: Response;\n try {\n response = await fetchFn(url, requestInit);\n } catch (cause) {\n // The transport never answered — offline, DNS, CORS, an aborted signal.\n // There is no status to report, so the failure normalizes through\n // `ServiceError.from` like any other unknown throw. A caller that cancels\n // its own request therefore sees a 500-shaped error too; the taxonomy has\n // no \"aborted\" class, and swallowing it here would hide real transport\n // failures. A caller that cancels should not surface the rejection.\n throw ServiceError.from(cause);\n }\n if (!response.ok) {\n throw await toServiceError(response);\n }\n return readJson<T>(response, context);\n }\n\n async function toServiceError(response: Response): Promise<ServiceError> {\n let text = '';\n try {\n text = await response.text();\n } catch {\n // The body could not be read at all — a reset after the headers. The\n // status is still the one true thing about the request, and the catalog\n // default message says more than anything this could invent.\n }\n const decoded = decodeErrorBody(text, response.status, maxErrorMessageLength);\n if (Object.hasOwn(HTTP_ERROR_CLASSES, response.status)) {\n const ErrorClass = HTTP_ERROR_CLASSES[response.status];\n // A `null` message leaves the catalog's default in place, which is a\n // better sentence than anything the client could invent.\n return new ErrorClass(decoded.message ?? undefined);\n }\n return new HttpStatusError(response.status, decoded.message ?? `Request failed with status ${response.status}.`, decoded.type);\n }\n\n async function readJson<T>(response: Response, context: string): Promise<T> {\n if (response.status === 204) {\n return undefined as T;\n }\n let text: string;\n try {\n text = await response.text();\n } catch (cause) {\n throw ServiceError.from(cause);\n }\n if (text.trim() === '') {\n return undefined as T;\n }\n try {\n return JSON.parse(text) as T;\n } catch {\n // A 2xx body that is not JSON is an HTML error page from a proxy. It must\n // surface as a ServiceError, not a SyntaxError, so the caller's error\n // handling has one shape to recognize.\n throw new HttpStatusError(response.status, `Malformed response body: ${context}`, null);\n }\n }\n\n return {\n request,\n get: async <T>(path: string, params?: QueryParams): Promise<T> =>\n request<T>(`${path}${params === undefined ? '' : buildQuery(params)}`),\n post: async <T>(path: string, body?: unknown): Promise<T> => request<T>(path, { method: 'POST', body }),\n put: async <T>(path: string, body?: unknown): Promise<T> => request<T>(path, { method: 'PUT', body }),\n patch: async <T>(path: string, body?: unknown): Promise<T> => request<T>(path, { method: 'PATCH', body }),\n delete: async <T>(path: string, body?: unknown): Promise<T> => request<T>(path, { method: 'DELETE', body }),\n };\n}\n\nexport { buildQuery, createApiClient, HttpStatusError, MAX_ERROR_MESSAGE_LENGTH };\nexport type { ApiClient, ApiRequestInit, CreateApiClientOptions, FetchFn, QueryParams, QueryValue };\n"],
5
+ "mappings": "+EAAA,OACE,mBAAAA,EACA,mBAAAC,EACA,iBAAAC,EACA,kBAAAC,EACA,uBAAAC,EACA,yBAAAC,EACA,iBAAAC,EACA,uBAAAC,EACA,wBAAAC,EACA,2BAAAC,EACA,oBAAAC,EACA,gBAAAC,EACA,2BAAAC,EACA,qBAAAC,EACA,6BAAAC,MACK,mBAgIP,MAAMC,EAA2B,IAU3BC,EAAuF,CAC3F,IAAKf,EACL,IAAKY,EACL,IAAKV,EACL,IAAKG,EACL,IAAKD,EACL,IAAKH,EACL,IAAKO,EACL,IAAKD,EACL,IAAKM,EACL,IAAKJ,EACL,IAAKN,EACL,IAAKG,EACL,IAAKP,EACL,IAAKY,GAWP,MAAMK,UAAwBN,CAAY,CAnL1C,MAmL0C,CAAAO,EAAA,wBACxC,YAAYC,EAAgBC,EAAiBC,EAAmB,CAC9D,MAAMF,EAAQE,GAAQ,aAAaF,CAAM,GAAIC,CAAO,CACtD,EAcF,SAASE,EAAWC,EAAc,CAChC,OAAO,OAAOA,GAAU,UAAYA,EAAM,KAAI,IAAO,GAAKA,EAAQ,IACpE,CA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", "NotFoundError", "NotImplementedError", "PayloadTooLargeError", "PreconditionFailedError", "RateLimitedError", "ServiceError", "ServiceUnavailableError", "UnauthorizedError", "UnsupportedMediaTypeError", "MAX_ERROR_MESSAGE_LENGTH", "HTTP_ERROR_CLASSES", "HttpStatusError", "__name", "status", "message", "type", "readString", "value", "truncate", "maxLength", "CONTROL_CHARACTER", "isProbablyProse", "raw", "decodeJsonError", "payload", "envelope", "nestedError", "decodeErrorBody", "text", "trimmed", "mergeHeaders", "base", "overrides", "headers", "name", "isQueryList", "buildQuery", "params", "search", "entry", "encoded", "createApiClient", "fetchFn", "options", "baseUrl", "maxErrorMessageLength", "request", "path", "init", "method", "url", "hasBody", "requestInit", "context", "response", "cause", "toServiceError", "readJson", "decoded", "ErrorClass", "body"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rexezuge/web",
3
- "version": "1.9.2",
3
+ "version": "1.9.4",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -25,14 +25,25 @@
25
25
  "dist"
26
26
  ],
27
27
  "dependencies": {
28
- "@rexezuge/errors": "1.9.2",
29
- "@rexezuge/shared": "1.9.2"
28
+ "@rexezuge/errors": "1.9.4",
29
+ "@rexezuge/shared": "1.9.4"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "lucide-react": "^1.49.0",
33
33
  "react": "^19.3.0",
34
34
  "react-dom": "^19.3.0"
35
35
  },
36
+ "peerDependenciesMeta": {
37
+ "lucide-react": {
38
+ "optional": true
39
+ },
40
+ "react": {
41
+ "optional": true
42
+ },
43
+ "react-dom": {
44
+ "optional": true
45
+ }
46
+ },
36
47
  "devDependencies": {
37
48
  "@testing-library/jest-dom": "7.0.1",
38
49
  "@testing-library/react": "16.3.3",