@nxgt/httpyz 0.3.0 → 0.3.1
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/chunks/index-52w12dh5.js +1051 -0
- package/dist/chunks/index-52w12dh5.js.map +25 -0
- package/dist/index.js +21 -1056
- package/dist/index.js.map +3 -19
- package/dist/integration/index.js +17 -1054
- package/dist/integration/index.js.map +3 -19
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cancel/abort.ts", "../src/errors/errors.ts", "../src/schema/standard-schema.ts", "../src/request/encode.ts", "../src/cancel/latest.ts", "../src/middleware/auth.ts", "../src/middleware/compose.ts", "../src/middleware/retry.ts", "../src/reply/media-type.ts", "../src/reply/read-reply.ts", "../src/stream/connection.ts", "../src/stream/sse-parser.ts", "../src/stream/event-stream.ts", "../src/stream/line-parser.ts", "../src/stream/line-stream.ts", "../src/client/create-http-client.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Aborts, as the client makes and recognizes them. A call aborted through its\n * `signal`, by a later call with the same `latest`, or by its group's\n * `cancel()` rejects with the abort's reason, unwrapped: an `AbortError`\n * unless the caller gave a reason of its own.\n */\n\n/**\n * Whether `error` ended a call because it was aborted, rather than failed:\n * a signal aborted without a reason of its own, or by `AbortSignal.timeout()`,\n * a later call with the same `latest`, or a group's `cancel()`. The client's\n * own `TimeoutError`, past `timeout`, is a failure, not an abort.\n *\n * A `boolean`, not a type guard: as `error is Error`, the branch where it is\n * false would drop `Error` from the error's type, though a failure is an\n * `Error` too, and an `Error`-typed catch would be `never` there.\n */\nexport function isAbortError(error: unknown): boolean {\n\tif (typeof DOMException !== 'undefined' && error instanceof DOMException) {\n\t\treturn error.name === 'AbortError' || error.name === 'TimeoutError';\n\t}\n\treturn error instanceof Error && error.name === 'AbortError';\n}\n\n/** What the client aborts a call with: an `AbortError`, which `isAbortError` knows. */\nexport const cancelled = (message: string): DOMException =>\n\tnew DOMException(message, 'AbortError');\n\n/** `promise`, or the signal's reason as soon as it aborts; the promise itself runs on. */\nexport function abortable<T>(\n\tpromise: Promise<T>,\n\tsignal: AbortSignal | undefined,\n): Promise<T> {\n\tif (!signal) return promise;\n\tif (signal.aborted) return Promise.reject(signal.reason);\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst stop = () => reject(signal.reason);\n\t\tsignal.addEventListener('abort', stop, { once: true });\n\t\tpromise\n\t\t\t.then(resolve, reject)\n\t\t\t.finally(() => signal.removeEventListener('abort', stop));\n\t});\n}\n\n/** One signal that aborts with the first of them; `undefined` when there are none. */\nexport function joinSignals(\n\t...signals: (AbortSignal | null | undefined)[]\n): AbortSignal | undefined {\n\tconst present = signals.filter(\n\t\t(signal): signal is AbortSignal => signal != null,\n\t);\n\treturn present.length > 1 ? AbortSignal.any(present) : present[0];\n}\n",
|
|
6
|
+
"/** Which call failed: every error a call throws carries it. */\nexport interface CallContext {\n\treadonly method: string;\n\t/** As the caller wrote it: `/employees/{id}`. */\n\treadonly path: string;\n\t/** The call's name, when it was given one: an OpenAPI `operationId`. */\n\treadonly operationId?: string;\n}\n\n/** Where a value was found wrong, as `@nxgt/openapi-hono` reports it. */\nexport interface ValidationIssue {\n\ttarget: 'param' | 'query' | 'header' | 'json' | 'form' | 'body' | 'response';\n\t/** Inside the target: `['items', 0, 'name']`, or `[]` for the whole of it. */\n\tpath: (string | number)[];\n\tcode: string;\n\tmessage: string;\n}\n\n/** The same shape as the server's: one failure, every issue in it. */\nexport interface ValidationFailure {\n\tkind: 'request' | 'response';\n\toperationId?: string;\n\tmethod: string;\n\tpath: string;\n\tstatus?: number;\n\tissues: ValidationIssue[];\n}\n\n/**\n * Every error a call throws, but an abort the caller asked for, which comes\n * through as the `AbortError` its signal gave.\n */\nexport class ClientError extends Error {\n\toverride name = 'ClientError';\n\treadonly operationId: string | undefined;\n\treadonly method: string;\n\treadonly path: string;\n\n\tconstructor(context: CallContext, message: string, options?: ErrorOptions) {\n\t\tconst route = `${context.method.toUpperCase()} ${context.path}`;\n\t\tconst call =\n\t\t\tcontext.operationId === undefined\n\t\t\t\t? route\n\t\t\t\t: `${context.operationId} (${route})`;\n\t\tsuper(`${call}: ${message}`, options);\n\t\tthis.operationId = context.operationId;\n\t\tthis.method = context.method;\n\t\tthis.path = context.path;\n\t}\n}\n\n/** fetch failed: no connection, a refused one, a CORS refusal. The cause is fetch's error. */\nexport class NetworkError extends ClientError {\n\toverride name = 'NetworkError';\n\n\tconstructor(context: CallContext, options?: ErrorOptions) {\n\t\tsuper(context, 'no reply came back', options);\n\t}\n}\n\nexport class TimeoutError extends ClientError {\n\toverride name = 'TimeoutError';\n\treadonly timeout: number;\n\n\tconstructor(context: CallContext, timeout: number, options?: ErrorOptions) {\n\t\tsuper(context, `no reply within ${timeout} ms`, options);\n\t\tthis.timeout = timeout;\n\t}\n}\n\n/** A status the call's `responses` do not declare. */\nexport class UndeclaredStatusError extends ClientError {\n\toverride name = 'UndeclaredStatusError';\n\treadonly status: number;\n\t/** Unread: its body is still there to read. */\n\treadonly response: Response;\n\n\tconstructor(context: CallContext, response: Response) {\n\t\tsuper(context, `no ${response.status} reply is declared`);\n\t\tthis.status = response.status;\n\t\tthis.response = response;\n\t}\n}\n\n/**\n * A reply its declaration does not describe: an undeclared media type, JSON\n * that does not parse, a value its schema refuses; or a request refused\n * before it was sent.\n */\nexport class ValidationError extends ClientError {\n\toverride name = 'ValidationError';\n\treadonly failure: ValidationFailure;\n\n\tconstructor(context: CallContext, failure: ValidationFailure) {\n\t\tsuper(context, failure.issues.map((issue) => issue.message).join('; '));\n\t\tthis.failure = failure;\n\t}\n}\n\n/**\n * From `unwrap()` or `ok()`: a declared reply, but not one of the statuses\n * asked for. No status asked for means any 2xx.\n */\nexport class ReplyStatusError extends Error {\n\toverride name = 'ReplyStatusError';\n\treadonly status: number;\n\treadonly data: unknown;\n\treadonly response: Response | undefined;\n\n\tconstructor(\n\t\treply: { status: number; data: unknown; response?: Response },\n\t\texpected: readonly number[],\n\t) {\n\t\tconst wanted = expected.length > 0 ? expected.join(' or ') : '2xx';\n\t\tsuper(`Expected a ${wanted} reply, got ${reply.status}`);\n\t\tthis.status = reply.status;\n\t\tthis.data = reply.data;\n\t\tthis.response = reply.response;\n\t}\n}\n",
|
|
7
|
+
"/**\n * [Standard Schema](https://standardschema.dev), the part the client calls.\n * Zod 4, Valibot and ArkType schemas all carry it, so the client imports\n * none of them: it reads their `~standard`.\n */\nimport type { ValidationIssue } from '../errors/errors';\n\nexport interface StandardSchemaV1<Input = unknown, Output = Input> {\n\treadonly '~standard': {\n\t\treadonly version: 1;\n\t\treadonly vendor: string;\n\t\treadonly validate: (\n\t\t\tvalue: unknown,\n\t\t) => StandardResult<Output> | Promise<StandardResult<Output>>;\n\t\treadonly types?:\n\t\t\t| { readonly input: Input; readonly output: Output }\n\t\t\t| undefined;\n\t};\n}\n\nexport type StandardResult<Output> =\n\t| { readonly value: Output; readonly issues?: undefined }\n\t| { readonly issues: readonly StandardIssue[] };\n\nexport interface StandardIssue {\n\treadonly message: string;\n\treadonly path?:\n\t\t| readonly (PropertyKey | { readonly key: PropertyKey })[]\n\t\t| undefined;\n}\n\n/** What a schema accepts. */\nexport type InferInput<Schema extends StandardSchemaV1> = NonNullable<\n\tSchema['~standard']['types']\n>['input'];\n\n/** What a schema gives back. */\nexport type InferOutput<Schema extends StandardSchemaV1> = NonNullable<\n\tSchema['~standard']['types']\n>['output'];\n\nexport type Checked =\n\t| { readonly ok: true; readonly value: unknown }\n\t| { readonly ok: false; readonly issues: ValidationIssue[] };\n\n/**\n * `value` through `schema`: its output, or its issues as `/hono` reports\n * them. Zod's `code` is kept; a vendor without one reads as `custom`.\n */\nexport async function check(\n\tschema: StandardSchemaV1,\n\tvalue: unknown,\n\ttarget: ValidationIssue['target'],\n): Promise<Checked> {\n\tconst result = await schema['~standard'].validate(value);\n\tif (result.issues === undefined) return { ok: true, value: result.value };\n\treturn {\n\t\tok: false,\n\t\tissues: result.issues.map((issue) => {\n\t\t\tconst { code } = issue as { code?: unknown };\n\t\t\treturn {\n\t\t\t\ttarget,\n\t\t\t\tpath: (issue.path ?? [])\n\t\t\t\t\t.map((key) => (typeof key === 'object' ? key.key : key))\n\t\t\t\t\t.filter((key): key is string | number => typeof key !== 'symbol'),\n\t\t\t\tcode: typeof code === 'string' ? code : 'custom',\n\t\t\t\tmessage: issue.message,\n\t\t\t};\n\t\t}),\n\t};\n}\n",
|
|
8
|
+
"/**\n * A call's input written onto its request: the path's `{name}`s filled in,\n * the query, and the body, whose kind sets its `Content-Type` unless the call\n * set one of its own.\n */\nimport type { CallContext } from '../errors/errors';\nimport type { BodyInput, FormFields, QueryInput } from './types';\n\n/** A value as text: a `Date` as its ISO string. */\nexport const text = (value: unknown): string =>\n\tvalue instanceof Date ? value.toISOString() : String(value);\n\nexport const absent = (value: unknown): value is undefined | null =>\n\tvalue === undefined || value === null;\n\nexport function fillPath(\n\tcontext: CallContext,\n\tparam: Readonly<Record<string, unknown>> | undefined,\n): string {\n\treturn context.path.replace(/\\{([^}]+)\\}/g, (_, name: string) => {\n\t\tconst value = param?.[name];\n\t\tif (absent(value)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`${context.method.toUpperCase()} ${context.path}: the path parameter ${name} is missing`,\n\t\t\t);\n\t\t}\n\t\treturn encodeURIComponent(text(value));\n\t});\n}\n\n/** A list as a repeated key; `null` and `undefined` left out. */\nexport function writeQuery(query: QueryInput | undefined): string {\n\tif (query === undefined) return '';\n\tif (query instanceof URLSearchParams) return query.toString();\n\tconst search = new URLSearchParams();\n\tfor (const [name, value] of Object.entries(query)) {\n\t\tfor (const item of Array.isArray(value) ? value : [value]) {\n\t\t\tif (!absent(item)) search.append(name, text(item));\n\t\t}\n\t}\n\treturn search.toString();\n}\n\nexport function joinUrl(\n\tbaseUrl: string | URL | undefined,\n\tpath: string,\n\tquery: string,\n): string {\n\tconst root = baseUrl === undefined ? '' : String(baseUrl).replace(/\\/+$/, '');\n\treturn `${root}${path}${query === '' ? '' : `?${query}`}`;\n}\n\n/**\n * The body, with its `Content-Type` on `headers`: `own`, the one the call\n * set, or the one its kind needs, over any the client sends with every call.\n */\nexport function writeBody(\n\tinput: BodyInput,\n\theaders: Headers,\n\town: string | null,\n): BodyInit | undefined {\n\tconst type = (fallback: string) =>\n\t\theaders.set('content-type', own ?? fallback);\n\tif (input.json !== undefined) {\n\t\ttype('application/json');\n\t\treturn JSON.stringify(input.json);\n\t}\n\tif (input.form !== undefined) {\n\t\t// fetch writes the type: a multipart one carries its boundary.\n\t\theaders.delete('content-type');\n\t\tconst { form } = input;\n\t\tif (form instanceof FormData || form instanceof URLSearchParams) {\n\t\t\treturn form;\n\t\t}\n\t\treturn [...fields(form)].some(([, value]) => value instanceof Blob)\n\t\t\t? toFormData(form)\n\t\t\t: toSearchParams(form);\n\t}\n\tif (input.text !== undefined) {\n\t\ttype('text/plain');\n\t\treturn input.text;\n\t}\n\tif (input.body !== undefined) {\n\t\tconst { body } = input;\n\t\ttype(\n\t\t\tbody instanceof Blob && body.type !== ''\n\t\t\t\t? body.type\n\t\t\t\t: 'application/octet-stream',\n\t\t);\n\t\treturn body as BodyInit;\n\t}\n\treturn undefined;\n}\n\n/** A form's fields: every item of a list, an object as JSON, a file as it is. */\nexport function* fields(form: FormFields): Generator<[string, string | Blob]> {\n\tfor (const [name, value] of Object.entries(form)) {\n\t\tfor (const item of Array.isArray(value) ? value : [value]) {\n\t\t\tif (absent(item)) continue;\n\t\t\tif (item instanceof Blob) yield [name, item];\n\t\t\telse if (typeof item === 'object' && !(item instanceof Date)) {\n\t\t\t\tyield [name, JSON.stringify(item)];\n\t\t\t} else yield [name, text(item)];\n\t\t}\n\t}\n}\n\nexport function toFormData(form: FormFields): FormData {\n\tconst data = new FormData();\n\tfor (const [name, value] of fields(form)) data.append(name, value);\n\treturn data;\n}\n\nexport function toSearchParams(form: FormFields): URLSearchParams {\n\tconst data = new URLSearchParams();\n\tfor (const [name, value] of fields(form)) {\n\t\tif (value instanceof Blob) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`${name} is a file: an application/x-www-form-urlencoded body cannot carry one`,\n\t\t\t);\n\t\t}\n\t\tdata.append(name, value);\n\t}\n\treturn data;\n}\n",
|
|
9
|
+
"/**\n * `latest`: one call running per key. A call with a key aborts the one before\n * it with the same key, if that one still runs: a search typed ahead keeps\n * only its last query in flight.\n */\nimport { cancelled } from './abort';\n\n/** A client's keys: `claim(key)` aborts the key's previous call, and returns the new call's signal. */\nexport function createLatest(): (key: string) => AbortSignal {\n\t// A finished call's controller stays until its key is used again: aborting it then does nothing.\n\tconst running = new Map<string, AbortController>();\n\treturn (key) => {\n\t\trunning\n\t\t\t.get(key)\n\t\t\t?.abort(\n\t\t\t\tcancelled(`A later call with latest: '${key}' replaced this one`),\n\t\t\t);\n\t\tconst controller = new AbortController();\n\t\trunning.set(key, controller);\n\t\treturn controller.signal;\n\t};\n}\n",
|
|
10
|
+
"/**\n * A token on every request, and one refresh when a reply is 401: calls\n * refused together wait on the same refresh, then are sent again once, with\n * the new token.\n */\nimport { abortable } from '../cancel/abort';\nimport type { Middleware } from './compose';\n\ntype Token = string | null | undefined;\n\nexport interface AuthOptions {\n\t/** The current token, read before each request. None sends no header. */\n\ttoken: () => Token | Promise<Token>;\n\t/**\n\t * Gets a new token after a 401, for `token` to return. When it throws, or\n\t * `token` still returns the refused one, the 401 is the reply, for the app\n\t * to sign out on.\n\t */\n\trefresh?: () => unknown;\n\t/** Default: `Bearer`. */\n\tscheme?: string;\n}\n\n/** The client's `auth`: one per client, so its calls share a refresh. */\nexport function auth({\n\ttoken,\n\trefresh,\n\tscheme = 'Bearer',\n}: AuthOptions): Middleware {\n\tlet refreshing: Promise<unknown> | undefined;\n\tconst sign = (request: Request, value: Token): Request => {\n\t\tif (value) request.headers.set('authorization', `${scheme} ${value}`);\n\t\treturn request;\n\t};\n\treturn async (request, next) => {\n\t\tconst used = await token();\n\t\t// Sent again after a refresh: its body can only be read once.\n\t\tconst replay = refresh ? request.clone() : undefined;\n\t\tconst response = await next(sign(request, used));\n\t\tif (response.status !== 401 || !replay || !refresh) return response;\n\t\ttry {\n\t\t\t// A call refused with a token already replaced has nothing to refresh.\n\t\t\tif ((await token()) === used) {\n\t\t\t\trefreshing ??= Promise.resolve()\n\t\t\t\t\t.then(refresh)\n\t\t\t\t\t.finally(() => {\n\t\t\t\t\t\trefreshing = undefined;\n\t\t\t\t\t});\n\t\t\t\t// An aborted call stops waiting; the refresh runs on for the others.\n\t\t\t\tawait abortable(refreshing, request.signal);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tif (request.signal.aborted) {\n\t\t\t\tawait response.body?.cancel();\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn response;\n\t\t}\n\t\tconst fresh = await token();\n\t\tif (!fresh || fresh === used) return response;\n\t\tawait response.body?.cancel();\n\t\treturn next(sign(replay, fresh));\n\t};\n}\n",
|
|
11
|
+
"/**\n * Middleware: a function around each request the client sends. It may change\n * the request, the response, or both, and calls `next` to go on; or answer\n * itself, and `fetch` is never called.\n *\n * ```ts\n * const timing: Middleware = async (request, next, call) => {\n * \tconst start = performance.now();\n * \ttry {\n * \t\treturn await next(request);\n * \t} finally {\n * \t\tmetrics.record(call.path, performance.now() - start);\n * \t}\n * };\n * ```\n */\nimport type { CallContext } from '../errors/errors';\n\nexport type Next = (request: Request) => Promise<Response>;\n\nexport type Middleware = (\n\trequest: Request,\n\tnext: Next,\n\tcall: CallContext,\n) => Promise<Response>;\n\n/** `middlewares` around `send`, the first outermost. */\nexport const compose = (\n\tmiddlewares: readonly Middleware[],\n\tsend: Next,\n\tcall: CallContext,\n): Next =>\n\tmiddlewares.reduceRight<Next>(\n\t\t(next, middleware) => (request) => middleware(request, next, call),\n\t\tsend,\n\t);\n",
|
|
12
|
+
"/**\n * A request sent again after a failure that may pass: no reply at all, or a\n * 408, 429, 502, 503 or 504. Only for methods that may be repeated, since a\n * POST that got no reply may still have been carried out.\n */\nimport type { Method } from '../client/types';\nimport { NetworkError } from '../errors/errors';\nimport type { Middleware } from './compose';\n\nexport interface RetryOptions {\n\t/** Tries after the first. Default: 2. */\n\tattempts?: number;\n\t/** Default: those that may be repeated: every method but POST and PATCH. */\n\tmethods?: readonly Method[];\n\t/** Default: 408, 429, 502, 503, 504. */\n\tstatuses?: readonly number[];\n\t/**\n\t * Milliseconds before retry `attempt`, from 1. Default: a random wait up to\n\t * 300 ms, doubled at each retry. A reply's `Retry-After` wins over it.\n\t */\n\tdelay?: (attempt: number) => number;\n\t/**\n\t * The longest wait. A reply whose `Retry-After` asks for longer is the\n\t * reply. Default: 10 000.\n\t */\n\tmaxDelay?: number;\n}\n\nexport type RetrySettings = Required<RetryOptions>;\n\nconst REPEATABLE: readonly Method[] = [\n\t'get',\n\t'head',\n\t'options',\n\t'put',\n\t'delete',\n\t'trace',\n\t'query',\n];\nconst TRANSIENT: readonly number[] = [408, 429, 502, 503, 504];\n\n/** Full jitter: a random wait up to 300 ms × 2^(attempt − 1). */\nconst backoff = (attempt: number): number =>\n\tMath.random() * 300 * 2 ** (attempt - 1);\n\n/** `retry` as the client or a call gives it; `undefined` never retries. */\nexport function retrySettings(\n\tretry: number | RetryOptions | false | undefined,\n): RetrySettings | undefined {\n\tif (retry === undefined || retry === false) return undefined;\n\tconst options = typeof retry === 'number' ? { attempts: retry } : retry;\n\tconst attempts = options.attempts ?? 2;\n\tif (attempts <= 0) return undefined;\n\treturn {\n\t\tattempts,\n\t\tmethods: options.methods ?? REPEATABLE,\n\t\tstatuses: options.statuses ?? TRANSIENT,\n\t\tdelay: options.delay ?? backoff,\n\t\tmaxDelay: options.maxDelay ?? 10_000,\n\t};\n}\n\n/**\n * Milliseconds before retry `attempt`: the reply's `Retry-After`, in seconds\n * or as a date, else `delay`. `undefined` when `Retry-After` is past\n * `maxDelay`.\n */\nexport function retryDelay(\n\tresponse: Response | undefined,\n\tattempt: number,\n\tsettings: RetrySettings,\n): number | undefined {\n\tconst header = response?.headers.get('retry-after')?.trim();\n\tif (header) {\n\t\tconst wait = /^\\d+(?:\\.\\d+)?$/.test(header)\n\t\t\t? Number(header) * 1000\n\t\t\t: Date.parse(header) - Date.now();\n\t\tif (!Number.isNaN(wait)) {\n\t\t\treturn wait > settings.maxDelay ? undefined : Math.max(0, wait);\n\t\t}\n\t}\n\treturn Math.min(Math.max(0, settings.delay(attempt)), settings.maxDelay);\n}\n\n/** Waits `ms`, or rejects with the signal's reason once it aborts. */\nconst sleep = (ms: number, signal: AbortSignal): Promise<void> =>\n\tnew Promise((resolve, reject) => {\n\t\tif (signal.aborted) return reject(signal.reason);\n\t\tconst stop = () => {\n\t\t\tclearTimeout(timer);\n\t\t\treject(signal.reason);\n\t\t};\n\t\tconst timer = setTimeout(() => {\n\t\t\tsignal.removeEventListener('abort', stop);\n\t\t\tresolve();\n\t\t}, ms);\n\t\tsignal.addEventListener('abort', stop, { once: true });\n\t});\n\nexport function retrying(settings: RetrySettings): Middleware {\n\treturn async (request, next) => {\n\t\tconst method = request.method.toLowerCase() as Method;\n\t\tif (!settings.methods.includes(method)) return next(request);\n\t\tfor (let attempt = 1; ; attempt++) {\n\t\t\tconst last = attempt > settings.attempts;\n\t\t\t// Each try sends a copy; the last sends the request itself.\n\t\t\tconst sent = last ? request : request.clone();\n\t\t\tlet wait: number | undefined;\n\t\t\ttry {\n\t\t\t\tconst response = await next(sent);\n\t\t\t\tif (last || !settings.statuses.includes(response.status)) {\n\t\t\t\t\treturn response;\n\t\t\t\t}\n\t\t\t\twait = retryDelay(response, attempt, settings);\n\t\t\t\tif (wait === undefined) return response;\n\t\t\t\tawait response.body?.cancel();\n\t\t\t} catch (error) {\n\t\t\t\tif (last || !(error instanceof NetworkError)) throw error;\n\t\t\t\twait = retryDelay(undefined, attempt, settings) ?? 0;\n\t\t\t}\n\t\t\tawait sleep(wait, request.signal);\n\t\t}\n\t};\n}\n",
|
|
13
|
+
"/** Media types: what a reply is read as, and which declared one it stands for. */\n\nexport type MediaKind = 'json' | 'form' | 'text' | 'binary';\n\n/** `application/json` from `application/json; charset=utf-8`. */\nexport const mediaType = (header: string): string =>\n\t(header.split(';')[0] ?? '').trim().toLowerCase();\n\n/** How a media type is read, as `@nxgt/openapi-codegen` classifies it. */\nexport function mediaKind(type: string): MediaKind {\n\tif (\n\t\ttype === 'application/json' ||\n\t\t/^application\\/[\\w.-]+\\+json$/.test(type)\n\t) {\n\t\treturn 'json';\n\t}\n\tif (\n\t\ttype === 'application/x-www-form-urlencoded' ||\n\t\ttype === 'multipart/form-data'\n\t) {\n\t\treturn 'form';\n\t}\n\treturn type.startsWith('text/') ? 'text' : 'binary';\n}\n\n/**\n * The declared media type a reply of `type` stands for: itself, then\n * `type/*`, then `*\\/*`, then the first JSON or text one of its own kind,\n * since what `c.json()` sends, `application/json`, stands for a declared\n * `application/problem+json`.\n */\nexport function declaredType(\n\tcontent: { readonly [mediaType: string]: { readonly kind: MediaKind } },\n\ttype: string,\n): string | undefined {\n\tconst types = Object.keys(content);\n\tconst exact = types.find((key) => key.toLowerCase() === type);\n\tif (exact !== undefined) return exact;\n\tconst range = `${type.split('/')[0]}/*`;\n\tif (content[range]) return range;\n\tif (content['*/*']) return '*/*';\n\tconst kind = mediaKind(type);\n\tif (kind !== 'json' && kind !== 'text') return undefined;\n\treturn types.find((key) => content[key]?.kind === kind);\n}\n",
|
|
14
|
+
"/** A response read into a reply: one the call declares, checked by its schema. */\nimport {\n\ttype CallContext,\n\tUndeclaredStatusError,\n\tValidationError,\n\ttype ValidationIssue,\n} from '../errors/errors';\nimport { check, type StandardSchemaV1 } from '../schema/standard-schema';\nimport {\n\tdeclaredType,\n\ttype MediaKind,\n\tmediaKind,\n\tmediaType,\n} from './media-type';\nimport type { Responses } from './types';\n\nexport interface ReplySettings {\n\t/** Checks a JSON or text reply with its schema. */\n\treadonly validate: boolean;\n\t/** Returns what the schema outputs, not what it was given. */\n\treadonly decode: boolean;\n}\n\ninterface MediaSpec {\n\treadonly kind: MediaKind;\n\treadonly schema?: StandardSchemaV1;\n}\n\n/** `Responses` as the reader takes them: each status's media types, and how each is read. */\nexport type ReplySpec = {\n\treadonly [status: number]: { readonly [mediaType: string]: MediaSpec };\n};\n\nconst isSchema = (value: unknown): value is StandardSchemaV1 =>\n\ttypeof value === 'object' && value !== null && '~standard' in value;\n\nexport function toSpec(responses: Responses): ReplySpec {\n\tconst spec: Record<number, Record<string, MediaSpec>> = {};\n\tfor (const [status, declared] of Object.entries(responses)) {\n\t\tconst content: Record<string, MediaSpec> = {};\n\t\tif (isSchema(declared)) {\n\t\t\tcontent['application/json'] = { kind: 'json', schema: declared };\n\t\t} else if (declared !== null) {\n\t\t\tfor (const [type, schema] of Object.entries(declared)) {\n\t\t\t\tcontent[type] = {\n\t\t\t\t\tkind: mediaKind(type.toLowerCase()),\n\t\t\t\t\t...(schema === null ? {} : { schema }),\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tspec[Number(status)] = content;\n\t}\n\treturn spec;\n}\n\nexport async function readReply(\n\tcontext: CallContext,\n\tspec: ReplySpec | undefined,\n\tresponse: Response,\n\tsettings: ReplySettings,\n): Promise<unknown> {\n\tconst { status } = response;\n\tconst header = response.headers.get('content-type');\n\tconst refused = (issues: ValidationIssue[]): ValidationError =>\n\t\tnew ValidationError(context, {\n\t\t\tkind: 'response',\n\t\t\t...context,\n\t\t\tstatus,\n\t\t\tissues,\n\t\t});\n\tconst failure = (code: string, message: string): ValidationError =>\n\t\trefused([{ target: 'response', path: [], code, message }]);\n\tconst parse = (text: string): unknown => {\n\t\ttry {\n\t\t\treturn JSON.parse(text);\n\t\t} catch {\n\t\t\tthrow failure('invalid_json', `the ${status} reply is not valid JSON`);\n\t\t}\n\t};\n\n\tif (!spec) {\n\t\tconst type = header === null ? undefined : mediaType(header);\n\t\tconst reply = (data: unknown) => ({ status, type, data, response });\n\t\tif (response.body === null) return reply(undefined);\n\t\tswitch (type === undefined ? undefined : mediaKind(type)) {\n\t\t\tcase 'json': {\n\t\t\t\tconst text = await response.text();\n\t\t\t\treturn reply(text === '' ? undefined : parse(text));\n\t\t\t}\n\t\t\tcase 'form':\n\t\t\t\treturn reply(await response.formData());\n\t\t\tcase 'binary':\n\t\t\t\treturn reply(await response.blob());\n\t\t\tdefault: {\n\t\t\t\tconst text = await response.text();\n\t\t\t\treturn reply(type === undefined && text === '' ? undefined : text);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst declared = spec[status];\n\tif (!declared) throw new UndeclaredStatusError(context, response);\n\tconst types = Object.keys(declared);\n\tif (types.length === 0) {\n\t\treturn { status, type: undefined, data: undefined, response };\n\t}\n\t// Untyped, it can only be the one type the status declares.\n\tconst type =\n\t\theader === null\n\t\t\t? types.length === 1\n\t\t\t\t? types[0]\n\t\t\t\t: undefined\n\t\t\t: declaredType(declared, mediaType(header));\n\tconst media = type === undefined ? undefined : declared[type];\n\tif (type === undefined || media === undefined) {\n\t\tthrow failure(\n\t\t\t'invalid_content_type',\n\t\t\t`a ${status} reply is ${types.join(' or ')}, not ${header ?? 'untyped'}`,\n\t\t);\n\t}\n\tconst reply = (data: unknown) => ({ status, type, data, response });\n\t/** As `/hono` checks a reply with `validateResponses`: JSON and text only. */\n\tconst settle = async (data: unknown) => {\n\t\tif (!settings.validate || !media.schema) return reply(data);\n\t\tconst result = await check(media.schema, data, 'response');\n\t\tif (!result.ok) throw refused(result.issues);\n\t\treturn reply(settings.decode ? result.value : data);\n\t};\n\tswitch (media.kind) {\n\t\tcase 'json': {\n\t\t\tconst text = await response.text();\n\t\t\t// Empty is no JSON: a checked reply says so, as the server does.\n\t\t\tif (text === '' && !(settings.validate && media.schema)) {\n\t\t\t\treturn reply(undefined);\n\t\t\t}\n\t\t\treturn settle(parse(text));\n\t\t}\n\t\tcase 'text':\n\t\t\treturn settle(await response.text());\n\t\tcase 'form':\n\t\t\treturn reply(await response.formData());\n\t\tdefault:\n\t\t\treturn reply(await response.blob());\n\t}\n}\n",
|
|
15
|
+
"/** What the two streams share: how a connection opens, and how its items are checked. */\nimport {\n\ttype CallContext,\n\tUndeclaredStatusError,\n\tValidationError,\n\ttype ValidationIssue,\n} from '../errors/errors';\nimport { mediaType } from '../reply/media-type';\nimport { check, type StandardSchemaV1 } from '../schema/standard-schema';\n\n/**\n * Opens one connection through the client's `retry`, `auth` and `use`, and\n * resolves once the reply's headers have arrived. `lastEventId` is sent as\n * `Last-Event-ID`.\n */\nexport type Open = (\n\tsignal: AbortSignal,\n\tlastEventId: string | undefined,\n) => Promise<Response>;\n\nexport interface StreamSettings {\n\treadonly context: CallContext;\n\treadonly open: Open;\n\t/** The caller's own signal: its abort comes through as it is. */\n\treadonly signal: AbortSignal | undefined;\n\treadonly validate: boolean;\n\treadonly decode: boolean;\n}\n\nconst failure = (\n\tcontext: CallContext,\n\tstatus: number,\n\tissues: ValidationIssue[],\n): ValidationError =>\n\tnew ValidationError(context, {\n\t\tkind: 'response',\n\t\t...context,\n\t\tstatus,\n\t\tissues,\n\t});\n\n/**\n * Whether the reply opened a stream: `false` for a 204, which ends it. Any\n * other status but a 2xx throws, with its body unread, and a reply of\n * another media type is refused.\n */\nexport async function opened(\n\tsettings: StreamSettings,\n\tresponse: Response,\n\ttypes: readonly string[],\n): Promise<boolean> {\n\tconst { status } = response;\n\tif (status === 204) {\n\t\tawait response.body?.cancel();\n\t\treturn false;\n\t}\n\tif (!response.ok) throw new UndeclaredStatusError(settings.context, response);\n\tconst header = response.headers.get('content-type');\n\tif (header === null || !types.includes(mediaType(header)) || !response.body) {\n\t\tawait response.body?.cancel();\n\t\tthrow failure(settings.context, status, [\n\t\t\t{\n\t\t\t\ttarget: 'response',\n\t\t\t\tpath: [],\n\t\t\t\tcode: 'invalid_content_type',\n\t\t\t\tmessage: `a ${status} reply is ${types.join(' or ')}, not ${header ?? 'untyped'}`,\n\t\t\t},\n\t\t]);\n\t}\n\treturn true;\n}\n\n/** A JSON text, through its schema as a reply is checked. */\nexport async function settle(\n\tsettings: StreamSettings,\n\tstatus: number,\n\ttext: string,\n\tschema: StandardSchemaV1 | undefined,\n\twhat: string,\n): Promise<unknown> {\n\tlet value: unknown;\n\ttry {\n\t\tvalue = JSON.parse(text);\n\t} catch {\n\t\tthrow failure(settings.context, status, [\n\t\t\t{\n\t\t\t\ttarget: 'response',\n\t\t\t\tpath: [],\n\t\t\t\tcode: 'invalid_json',\n\t\t\t\tmessage: `${what} is not valid JSON`,\n\t\t\t},\n\t\t]);\n\t}\n\tif (!schema || !settings.validate) return value;\n\tconst result = await check(schema, value, 'response');\n\tif (!result.ok) throw failure(settings.context, status, result.issues);\n\treturn settings.decode ? result.value : value;\n}\n\n/** Waits `ms`, or less, when a signal aborts. */\nexport function pause(\n\tms: number,\n\t...signals: (AbortSignal | undefined)[]\n): Promise<void> {\n\tconst live = signals.filter((each): each is AbortSignal => !!each);\n\treturn new Promise((resolve) => {\n\t\tconst done = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tfor (const each of live) each.removeEventListener('abort', done);\n\t\t\tresolve();\n\t\t};\n\t\tconst timer = setTimeout(done, ms);\n\t\tfor (const each of live) {\n\t\t\tif (each.aborted) return done();\n\t\t\teach.addEventListener('abort', done, { once: true });\n\t\t}\n\t});\n}\n\n/**\n * The reader of the connection a stream is on, and how it stops: `close()`\n * or the caller's abort cancels the read in progress, since an aborted\n * request does not always end its body.\n */\nexport class Reading {\n\treadonly closer = new AbortController();\n\t#reader: ReadableStreamDefaultReader<string> | undefined;\n\treadonly #signal: AbortSignal | undefined;\n\treadonly #halt = () => {\n\t\tthis.#reader?.cancel().catch(() => {});\n\t};\n\n\tconstructor(signal: AbortSignal | undefined) {\n\t\tthis.#signal = signal;\n\t\tthis.closer.signal.addEventListener('abort', this.#halt);\n\t\tsignal?.addEventListener('abort', this.#halt);\n\t}\n\n\t/** Reads `response`'s body as text. */\n\tread(response: Response): ReadableStreamDefaultReader<string> {\n\t\tconst body = response.body as ReadableStream<BufferSource>;\n\t\tthis.#reader = body.pipeThrough(new TextDecoderStream()).getReader();\n\t\treturn this.#reader;\n\t}\n\n\t/** Whether the stream was closed; the caller's abort throws its reason. */\n\tstopped(): boolean {\n\t\tthis.#signal?.throwIfAborted();\n\t\treturn this.closer.signal.aborted;\n\t}\n\n\t/** Lets the reader go, and stops listening to the caller's signal. */\n\trelease(): void {\n\t\tthis.#reader?.cancel().catch(() => {});\n\t\tthis.#reader = undefined;\n\t\tthis.#signal?.removeEventListener('abort', this.#halt);\n\t}\n\n\tclose(): void {\n\t\tthis.closer.abort();\n\t}\n}\n",
|
|
16
|
+
"/**\n * The event stream format, parsed as `EventSource` parses it: text in,\n * events out. It follows WHATWG's \"interpreting an event stream\":\n * https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation\n */\n\n/** An event, as the stream sent it: its `data` is text. */\nexport interface ServerEvent {\n\t/** Its `event:` field, or `message` when the stream names none. */\n\treadonly event: string;\n\t/** Its `data:` lines, joined with a line feed. */\n\treadonly data: string;\n\t/** The last `id:` the stream set, carried over to every later event. */\n\treadonly id: string | undefined;\n}\n\nexport interface SseParser {\n\t/** Reads a chunk of text, and returns the events it completed. */\n\tpush(chunk: string): ServerEvent[];\n\t/** The last `retry:` the stream set, in milliseconds. */\n\treadonly retry: number | undefined;\n\t/** The last event ID an event was dispatched with: what `Last-Event-ID` sends. */\n\treadonly lastEventId: string | undefined;\n}\n\nconst LINE_END = /\\r\\n|\\r|\\n/g;\n\n/** A parser for one connection; `lastEventId` carries over from the last one. */\nexport function createSseParser(lastEventId?: string): SseParser {\n\tlet buffer = '';\n\tlet started = false;\n\t/** A chunk ended on a CR, so a LF opening the next one ends nothing. */\n\tlet afterCr = false;\n\tlet data = '';\n\tlet type = '';\n\tlet id = lastEventId ?? '';\n\tlet dispatchedId = lastEventId;\n\tlet retry: number | undefined;\n\n\tconst dispatch = (events: ServerEvent[]) => {\n\t\tdispatchedId = id === '' ? undefined : id;\n\t\tif (data === '') {\n\t\t\ttype = '';\n\t\t\treturn;\n\t\t}\n\t\tevents.push({\n\t\t\tevent: type === '' ? 'message' : type,\n\t\t\tdata: data.endsWith('\\n') ? data.slice(0, -1) : data,\n\t\t\tid: dispatchedId,\n\t\t});\n\t\tdata = '';\n\t\ttype = '';\n\t};\n\n\tconst line = (text: string, events: ServerEvent[]) => {\n\t\tif (text === '') return dispatch(events);\n\t\tif (text.startsWith(':')) return;\n\t\tconst colon = text.indexOf(':');\n\t\tconst field = colon === -1 ? text : text.slice(0, colon);\n\t\tlet value = colon === -1 ? '' : text.slice(colon + 1);\n\t\tif (value.startsWith(' ')) value = value.slice(1);\n\t\tswitch (field) {\n\t\t\tcase 'event':\n\t\t\t\ttype = value;\n\t\t\t\tbreak;\n\t\t\tcase 'data':\n\t\t\t\tdata += `${value}\\n`;\n\t\t\t\tbreak;\n\t\t\tcase 'id':\n\t\t\t\tif (!value.includes('\\0')) id = value;\n\t\t\t\tbreak;\n\t\t\tcase 'retry':\n\t\t\t\tif (/^\\d+$/.test(value)) retry = Number(value);\n\t\t\t\tbreak;\n\t\t}\n\t};\n\n\treturn {\n\t\tpush(chunk) {\n\t\t\tlet text = chunk;\n\t\t\tif (!started && text !== '') {\n\t\t\t\tstarted = true;\n\t\t\t\tif (text.startsWith('\\uFEFF')) text = text.slice(1);\n\t\t\t}\n\t\t\tif (afterCr && text !== '') {\n\t\t\t\tafterCr = false;\n\t\t\t\tif (text.startsWith('\\n')) text = text.slice(1);\n\t\t\t}\n\t\t\tbuffer += text;\n\t\t\tconst events: ServerEvent[] = [];\n\t\t\tlet start = 0;\n\t\t\tLINE_END.lastIndex = 0;\n\t\t\tfor (\n\t\t\t\tlet end = LINE_END.exec(buffer);\n\t\t\t\tend !== null;\n\t\t\t\tend = LINE_END.exec(buffer)\n\t\t\t) {\n\t\t\t\t// A CR last in the buffer may be half of a CRLF: the next chunk says.\n\t\t\t\tif (end[0] === '\\r' && end.index === buffer.length - 1) {\n\t\t\t\t\tafterCr = true;\n\t\t\t\t}\n\t\t\t\tline(buffer.slice(start, end.index), events);\n\t\t\t\tstart = end.index + end[0].length;\n\t\t\t}\n\t\t\tbuffer = buffer.slice(start);\n\t\t\treturn events;\n\t\t},\n\t\tget retry() {\n\t\t\treturn retry;\n\t\t},\n\t\tget lastEventId() {\n\t\t\treturn dispatchedId;\n\t\t},\n\t};\n}\n",
|
|
17
|
+
"/**\n * `http.events()`: server-sent events over `fetch`. It reconnects as\n * `EventSource` does, but through the client, so each connection has its\n * `auth` and middleware, and its events are checked by their schemas.\n */\nimport { NetworkError } from '../errors/errors';\nimport {\n\topened,\n\tpause,\n\tReading,\n\ttype StreamSettings,\n\tsettle,\n} from './connection';\nimport { createSseParser, type ServerEvent } from './sse-parser';\nimport type { EventSchemas, EventStream } from './types';\n\nexport interface EventSettings extends StreamSettings {\n\treadonly events: EventSchemas | undefined;\n\treadonly onUnknownEvent: ((event: ServerEvent) => void) | undefined;\n\t/** `false`, or how to reconnect. */\n\treadonly reconnect:\n\t\t| { readonly attempts: number; readonly delay: number }\n\t\t| false;\n\treadonly lastEventId: string | undefined;\n}\n\nexport function eventStream(settings: EventSettings): EventStream<unknown> {\n\tconst reading = new Reading(settings.signal);\n\tlet lastEventId = settings.lastEventId;\n\tlet delay = settings.reconnect ? settings.reconnect.delay : 0;\n\tlet started = false;\n\n\t/** A declared event with its data checked, or `undefined` for one it does not declare. */\n\tconst declared = async (raw: ServerEvent, status: number) => {\n\t\tconst { events } = settings;\n\t\tif (!events) return raw;\n\t\tif (!Object.hasOwn(events, raw.event)) {\n\t\t\tsettings.onUnknownEvent?.(raw);\n\t\t\treturn undefined;\n\t\t}\n\t\tconst schema = events[raw.event];\n\t\tif (!schema) return raw;\n\t\tconst what = `the ${raw.event} event's data`;\n\t\tconst data = await settle(settings, status, raw.data, schema, what);\n\t\treturn { event: raw.event, data, id: raw.id };\n\t};\n\n\t/** Whether to connect again after `failures` in a row, having waited for it. */\n\tconst again = async (failures: number): Promise<boolean> => {\n\t\tconst { reconnect } = settings;\n\t\tif (!reconnect || failures >= reconnect.attempts) return false;\n\t\tawait pause(delay, reading.closer.signal, settings.signal);\n\t\treturn !reading.stopped();\n\t};\n\n\tasync function* run(): AsyncGenerator<unknown, void, undefined> {\n\t\tlet failures = 0;\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tlet response: Response;\n\t\t\t\ttry {\n\t\t\t\t\tresponse = await settings.open(reading.closer.signal, lastEventId);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (reading.closer.signal.aborted) return;\n\t\t\t\t\t// Only a connection that failed may pass: not a timeout, an abort or a refusal.\n\t\t\t\t\tif (error instanceof NetworkError && (await again(failures++))) {\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t\tif (!(await opened(settings, response, ['text/event-stream']))) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst parser = createSseParser(lastEventId);\n\t\t\t\tconst reader = reading.read(response);\n\t\t\t\tlet dropped: unknown;\n\t\t\t\tfor (;;) {\n\t\t\t\t\tlet chunk: Awaited<ReturnType<typeof reader.read>>;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tchunk = await reader.read();\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tif (reading.stopped()) return;\n\t\t\t\t\t\tdropped = error;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif (reading.stopped()) return;\n\t\t\t\t\tif (chunk.done) break;\n\t\t\t\t\tconst events = parser.push(chunk.value);\n\t\t\t\t\tlastEventId = parser.lastEventId;\n\t\t\t\t\tdelay = parser.retry ?? delay;\n\t\t\t\t\tfor (const raw of events) {\n\t\t\t\t\t\tfailures = 0;\n\t\t\t\t\t\tconst event = await declared(raw, response.status);\n\t\t\t\t\t\tif (event !== undefined) yield event;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!(await again(failures++))) {\n\t\t\t\t\tif (dropped === undefined) return;\n\t\t\t\t\tthrow new NetworkError(settings.context, { cause: dropped });\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\treading.release();\n\t\t}\n\t}\n\n\treturn {\n\t\t[Symbol.asyncIterator]() {\n\t\t\tif (started) throw new TypeError('A stream is read once');\n\t\t\tstarted = true;\n\t\t\treturn run();\n\t\t},\n\t\tclose: () => reading.close(),\n\t\tget lastEventId() {\n\t\t\treturn lastEventId;\n\t\t},\n\t};\n}\n",
|
|
18
|
+
"/**\n * JSON Lines, NDJSON and JSON text sequences, split into their records: one\n * JSON text a line, or after each record separator (`\\x1E`). Blank lines\n * separate nothing, and a last record needs no line end.\n */\n\nexport interface LineParser {\n\t/** Reads a chunk of text, and returns the records it completed. */\n\tpush(chunk: string): string[];\n\t/** The record left when the stream ends, if any. */\n\tend(): string[];\n}\n\n/** A JSON text sequence's record separator, which ends a record as a line end does. */\nconst RS = String.fromCharCode(0x1e);\n\nexport function createLineParser(): LineParser {\n\tlet buffer = '';\n\tconst records = (texts: string[]) =>\n\t\ttexts.map((text) => text.trim()).filter((text) => text !== '');\n\treturn {\n\t\tpush(chunk) {\n\t\t\tconst parts = (buffer + chunk).replaceAll(RS, '\\n').split(/\\r?\\n/);\n\t\t\tbuffer = parts.pop() ?? '';\n\t\t\treturn records(parts);\n\t\t},\n\t\tend() {\n\t\t\tconst rest = buffer;\n\t\t\tbuffer = '';\n\t\t\treturn records([rest]);\n\t\t},\n\t};\n}\n",
|
|
19
|
+
"/** `http.lines()`: JSON Lines, NDJSON or JSON text sequences, a record at a time. */\nimport { NetworkError } from '../errors/errors';\nimport type { StandardSchemaV1 } from '../schema/standard-schema';\nimport { opened, Reading, type StreamSettings, settle } from './connection';\nimport { createLineParser } from './line-parser';\nimport type { Stream } from './types';\n\n/** The media types a stream of lines is served as. */\nexport const LINE_TYPES = [\n\t'application/jsonl',\n\t'application/x-ndjson',\n\t'application/ndjson',\n\t'application/jsonlines',\n\t'application/x-jsonlines',\n\t'application/json-seq',\n] as const;\n\nexport interface LineSettings extends StreamSettings {\n\treadonly item: StandardSchemaV1 | undefined;\n}\n\nexport function lineStream(settings: LineSettings): Stream<unknown> {\n\tconst reading = new Reading(settings.signal);\n\tlet started = false;\n\n\tasync function* run(): AsyncGenerator<unknown, void, undefined> {\n\t\ttry {\n\t\t\tlet response: Response;\n\t\t\ttry {\n\t\t\t\tresponse = await settings.open(reading.closer.signal, undefined);\n\t\t\t} catch (error) {\n\t\t\t\tif (reading.closer.signal.aborted) return;\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tif (!(await opened(settings, response, LINE_TYPES))) return;\n\t\t\tconst parser = createLineParser();\n\t\t\tconst reader = reading.read(response);\n\t\t\tfor (;;) {\n\t\t\t\tlet chunk: Awaited<ReturnType<typeof reader.read>>;\n\t\t\t\ttry {\n\t\t\t\t\tchunk = await reader.read();\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (reading.stopped()) return;\n\t\t\t\t\tthrow new NetworkError(settings.context, { cause: error });\n\t\t\t\t}\n\t\t\t\tif (reading.stopped()) return;\n\t\t\t\tconst texts = chunk.done ? parser.end() : parser.push(chunk.value);\n\t\t\t\tfor (const text of texts) {\n\t\t\t\t\tyield await settle(\n\t\t\t\t\t\tsettings,\n\t\t\t\t\t\tresponse.status,\n\t\t\t\t\t\ttext,\n\t\t\t\t\t\tsettings.item,\n\t\t\t\t\t\t'a line',\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tif (chunk.done) return;\n\t\t\t}\n\t\t} finally {\n\t\t\treading.release();\n\t\t}\n\t}\n\n\treturn {\n\t\t[Symbol.asyncIterator]() {\n\t\t\tif (started) throw new TypeError('A stream is read once');\n\t\t\tstarted = true;\n\t\t\treturn run();\n\t\t},\n\t\tclose: () => reading.close(),\n\t};\n}\n",
|
|
20
|
+
"/**\n * `createHttpClient`: calls over the standard `fetch`, each typed by its path\n * and by the replies it declares, through `retry`, `auth` and middleware.\n */\nimport { cancelled, joinSignals } from '../cancel/abort';\nimport { createLatest } from '../cancel/latest';\nimport { type CallContext, NetworkError, TimeoutError } from '../errors/errors';\nimport { auth } from '../middleware/auth';\nimport { compose, type Middleware, type Next } from '../middleware/compose';\nimport {\n\ttype RetryOptions,\n\tretrying,\n\tretrySettings,\n} from '../middleware/retry';\nimport { readReply, toSpec } from '../reply/read-reply';\nimport type { Responses } from '../reply/types';\nimport { fillPath, joinUrl, writeBody, writeQuery } from '../request/encode';\nimport type { BodyInput, QueryInput } from '../request/types';\nimport type { StandardSchemaV1 } from '../schema/standard-schema';\nimport type { Open } from '../stream/connection';\nimport { eventStream } from '../stream/event-stream';\nimport { LINE_TYPES, lineStream } from '../stream/line-stream';\nimport type { ServerEvent } from '../stream/sse-parser';\nimport type { EventSchemas, ReconnectOptions } from '../stream/types';\nimport type {\n\tCallOptions,\n\tHttpClient,\n\tHttpClientOptions,\n\tHttpGroup,\n\tMethod,\n\tSendOptions,\n} from './types';\n\nexport const METHODS: readonly Method[] = [\n\t'get',\n\t'put',\n\t'post',\n\t'delete',\n\t'options',\n\t'head',\n\t'patch',\n\t'trace',\n\t'query',\n];\n\n/** What a request is built from, as the client reads a call's options. */\ntype Given = BodyInput &\n\tCallOptions & {\n\t\treadonly param?: Readonly<Record<string, unknown>>;\n\t\treadonly query?: QueryInput;\n\t};\n\ntype ReplyGiven = Given & {\n\treadonly responses?: Responses;\n\treadonly validate?: boolean;\n\treadonly decode?: boolean;\n};\n\ntype StreamGiven = Given & {\n\treadonly method?: Method;\n\treadonly validate?: boolean;\n\treadonly decode?: boolean;\n};\n\ntype EventsGiven = StreamGiven & {\n\treadonly events?: EventSchemas;\n\treadonly onUnknownEvent?: (event: ServerEvent) => void;\n\treadonly reconnect?: boolean | ReconnectOptions;\n\treadonly lastEventId?: string;\n};\n\ntype LinesGiven = StreamGiven & { readonly item?: StandardSchemaV1 };\n\n/** A stream reconnects by default, but for the methods a retry would not repeat. */\nconst RECONNECT_DELAY = 3000;\n\nconst contextOf = (\n\tmethod: string,\n\tpath: string,\n\toperationId: string | undefined,\n): CallContext =>\n\toperationId === undefined ? { method, path } : { method, path, operationId };\n\n/**\n * ```ts\n * const http = createHttpClient({ baseUrl: 'https://api.example.com', retry: 2 });\n * const reply = await http.get('/employees/{id}', {\n * \tparam: { id },\n * \tresponses: { 200: Employee, 404: Problem },\n * });\n * if (reply.status === 200) reply.data.name;\n * ```\n */\nexport function createHttpClient(options: HttpClientOptions = {}): HttpClient {\n\tconst signer = options.auth ? auth(options.auth) : undefined;\n\tconst claim = createLatest();\n\t/**\n\t * A `latest` key's signal. Claimed before anything is awaited, so calls\n\t * with the same key replace each other in the order they were made.\n\t */\n\tconst latestSignal = (key: string | undefined) =>\n\t\tkey === undefined ? undefined : claim(key);\n\tconst sharedHeaders = async (): Promise<Headers> =>\n\t\tnew Headers(\n\t\t\ttypeof options.headers === 'function'\n\t\t\t\t? await options.headers()\n\t\t\t\t: options.headers,\n\t\t);\n\n\t/** The request's own signal, with `timeout`'s deadline added. */\n\tconst withDeadline = (\n\t\ttimeout: number | undefined,\n\t\tsignal: AbortSignal | null | undefined,\n\t) => {\n\t\tconst deadline =\n\t\t\ttimeout === undefined ? undefined : AbortSignal.timeout(timeout);\n\t\tconst signals = [signal, deadline].filter(\n\t\t\t(each): each is AbortSignal => each != null,\n\t\t);\n\t\treturn {\n\t\t\tdeadline,\n\t\t\tsignal: signals.length > 1 ? AbortSignal.any(signals) : signals[0],\n\t\t};\n\t};\n\n\t/**\n\t * Through `retry`, `auth`, `use` and then `added`, what `use()` added, to\n\t * `fetch`: fetch's failure and the deadline made errors.\n\t */\n\tconst dispatch = async (\n\t\trequest: Request,\n\t\tcontext: CallContext,\n\t\ttimeout: number | undefined,\n\t\tdeadline: AbortSignal | undefined,\n\t\tretry: number | RetryOptions | false | undefined,\n\t\tadded: readonly Middleware[],\n\t): Promise<Response> => {\n\t\tconst fetch = options.fetch ?? ((sent: Request) => globalThis.fetch(sent));\n\t\t// fetch's own failure is a NetworkError, which `retry` retries; an abort is not one.\n\t\tconst send: Next = async (sent) => {\n\t\t\ttry {\n\t\t\t\t// As fetch does: a signal aborted before the call never sends.\n\t\t\t\tsent.signal.throwIfAborted();\n\t\t\t\treturn await fetch(sent);\n\t\t\t} catch (error) {\n\t\t\t\tif (request.signal.aborted) throw error;\n\t\t\t\tthrow new NetworkError(context, { cause: error });\n\t\t\t}\n\t\t};\n\t\tconst again = retrySettings(retry);\n\t\tconst layers = [\n\t\t\t...(again ? [retrying(again)] : []),\n\t\t\t...(signer ? [signer] : []),\n\t\t\t...(options.use ?? []),\n\t\t\t...added,\n\t\t];\n\t\ttry {\n\t\t\treturn await compose(layers, send, context)(request);\n\t\t} catch (error) {\n\t\t\tif (deadline?.aborted && timeout !== undefined) {\n\t\t\t\tthrow new TimeoutError(context, timeout, { cause: error });\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t};\n\n\t/**\n\t * A request's parts, from a call's options: its URL, and its init but for\n\t * the signal. `adjust` has the last word on the headers.\n\t */\n\tconst build = async (\n\t\tmethod: Method,\n\t\tpath: string,\n\t\tgiven: Given,\n\t\tadjust?: (headers: Headers) => void,\n\t) => {\n\t\tconst {\n\t\t\tparam,\n\t\t\tquery,\n\t\t\tjson,\n\t\t\tform,\n\t\t\ttext,\n\t\t\tbody,\n\t\t\toperationId,\n\t\t\ttimeout = options.timeout,\n\t\t\tretry = options.retry,\n\t\t\theaders: own,\n\t\t\tsignal,\n\t\t\t...rest\n\t\t} = given;\n\t\tconst context = contextOf(method, path, operationId);\n\t\tconst headers = await sharedHeaders();\n\t\tconst callHeaders = new Headers(own);\n\t\tcallHeaders.forEach((value, name) => {\n\t\t\theaders.set(name, value);\n\t\t});\n\t\tadjust?.(headers);\n\t\tconst url = joinUrl(\n\t\t\toptions.baseUrl,\n\t\t\tfillPath(context, param),\n\t\t\twriteQuery(query),\n\t\t);\n\t\tconst payload = writeBody(\n\t\t\t{ json, form, text, body } as BodyInput,\n\t\t\theaders,\n\t\t\tcallHeaders.get('content-type'),\n\t\t);\n\t\tconst init = {\n\t\t\t...options.init,\n\t\t\t...rest,\n\t\t\tmethod: method.toUpperCase(),\n\t\t\theaders,\n\t\t\tbody: payload,\n\t\t\t// A stream is sent as it is read, which fetch has to be told.\n\t\t\t...(payload instanceof ReadableStream ? { duplex: 'half' } : {}),\n\t\t} as RequestInit;\n\t\treturn { context, url, init, timeout, retry, signal: signal ?? undefined };\n\t};\n\n\tconst request = async (\n\t\tmethod: Method,\n\t\tpath: string,\n\t\tgiven: ReplyGiven,\n\t\tadded: readonly Middleware[],\n\t): Promise<unknown> => {\n\t\tconst {\n\t\t\tresponses,\n\t\t\tvalidate = true,\n\t\t\tdecode = true,\n\t\t\tlatest,\n\t\t\t...call\n\t\t} = given;\n\t\tconst replaced = latestSignal(latest);\n\t\tconst built = await build(method, path, call);\n\t\tconst { deadline, signal } = withDeadline(\n\t\t\tbuilt.timeout,\n\t\t\tjoinSignals(built.signal, replaced),\n\t\t);\n\t\tconst response = await dispatch(\n\t\t\tnew Request(built.url, { ...built.init, signal }),\n\t\t\tbuilt.context,\n\t\t\tbuilt.timeout,\n\t\t\tdeadline,\n\t\t\tbuilt.retry,\n\t\t\tadded,\n\t\t);\n\t\treturn readReply(\n\t\t\tbuilt.context,\n\t\t\tresponses === undefined ? undefined : toSpec(responses),\n\t\t\tresponse,\n\t\t\t{ validate, decode },\n\t\t);\n\t};\n\n\t/**\n\t * A stream's connections, each built afresh: its headers are run again and\n\t * `Last-Event-ID` is added. `timeout` bounds one until its headers arrive,\n\t * and no longer, since a stream has no end to wait for.\n\t */\n\tconst opener =\n\t\t(\n\t\t\tmethod: Method,\n\t\t\tpath: string,\n\t\t\tcall: Given,\n\t\t\taccept: string,\n\t\t\tadded: readonly Middleware[],\n\t\t): Open =>\n\t\tasync (stream, lastEventId) => {\n\t\t\tconst built = await build(method, path, call, (headers) => {\n\t\t\t\tif (!headers.has('accept')) headers.set('accept', accept);\n\t\t\t\tif (lastEventId !== undefined) {\n\t\t\t\t\theaders.set('last-event-id', lastEventId);\n\t\t\t\t}\n\t\t\t});\n\t\t\tconst deadline = new AbortController();\n\t\t\tconst clock =\n\t\t\t\tbuilt.timeout === undefined\n\t\t\t\t\t? undefined\n\t\t\t\t\t: setTimeout(\n\t\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\t\tdeadline.abort(\n\t\t\t\t\t\t\t\t\tnew DOMException('The stream did not open', 'TimeoutError'),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tbuilt.timeout,\n\t\t\t\t\t\t);\n\t\t\tconst signals = [stream, deadline.signal];\n\t\t\tif (built.signal) signals.push(built.signal);\n\t\t\ttry {\n\t\t\t\treturn await dispatch(\n\t\t\t\t\tnew Request(built.url, {\n\t\t\t\t\t\t...built.init,\n\t\t\t\t\t\tsignal: AbortSignal.any(signals),\n\t\t\t\t\t}),\n\t\t\t\t\tbuilt.context,\n\t\t\t\t\tbuilt.timeout,\n\t\t\t\t\tdeadline.signal,\n\t\t\t\t\tbuilt.retry,\n\t\t\t\t\tadded,\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\tclearTimeout(clock);\n\t\t\t}\n\t\t};\n\n\tconst events = (\n\t\tpath: string,\n\t\tgiven: EventsGiven,\n\t\tadded: readonly Middleware[],\n\t) => {\n\t\tconst {\n\t\t\tevents,\n\t\t\tonUnknownEvent,\n\t\t\treconnect,\n\t\t\tlastEventId,\n\t\t\tvalidate = true,\n\t\t\tdecode = true,\n\t\t\tmethod = 'get',\n\t\t\tlatest,\n\t\t\t...own\n\t\t} = given;\n\t\tconst call = {\n\t\t\t...own,\n\t\t\tsignal: joinSignals(own.signal, latestSignal(latest)),\n\t\t};\n\t\tconst reconnects =\n\t\t\treconnect === undefined\n\t\t\t\t? method !== 'post' && method !== 'patch'\n\t\t\t\t: reconnect !== false;\n\t\tconst settings = typeof reconnect === 'object' ? reconnect : {};\n\t\treturn eventStream({\n\t\t\tcontext: contextOf(method, path, call.operationId),\n\t\t\topen: opener(method, path, call, 'text/event-stream', added),\n\t\t\tsignal: call.signal ?? undefined,\n\t\t\tvalidate,\n\t\t\tdecode,\n\t\t\tevents,\n\t\t\tonUnknownEvent,\n\t\t\treconnect: reconnects && {\n\t\t\t\tattempts: settings.attempts ?? Number.POSITIVE_INFINITY,\n\t\t\t\tdelay: settings.delay ?? RECONNECT_DELAY,\n\t\t\t},\n\t\t\tlastEventId,\n\t\t});\n\t};\n\n\tconst lines = (\n\t\tpath: string,\n\t\tgiven: LinesGiven,\n\t\tadded: readonly Middleware[],\n\t) => {\n\t\tconst {\n\t\t\titem,\n\t\t\tvalidate = true,\n\t\t\tdecode = true,\n\t\t\tmethod = 'get',\n\t\t\tlatest,\n\t\t\t...own\n\t\t} = given;\n\t\tconst call = {\n\t\t\t...own,\n\t\t\tsignal: joinSignals(own.signal, latestSignal(latest)),\n\t\t};\n\t\treturn lineStream({\n\t\t\tcontext: contextOf(method, path, call.operationId),\n\t\t\topen: opener(\n\t\t\t\tmethod,\n\t\t\t\tpath,\n\t\t\t\tcall,\n\t\t\t\tLINE_TYPES.slice(0, 2).join(', '),\n\t\t\t\tadded,\n\t\t\t),\n\t\t\tsignal: call.signal ?? undefined,\n\t\t\tvalidate,\n\t\t\tdecode,\n\t\t\titem,\n\t\t});\n\t};\n\n\tconst send = async (\n\t\trequest: Request,\n\t\t{\n\t\t\ttimeout = options.timeout,\n\t\t\tretry = options.retry,\n\t\t\toperationId,\n\t\t\tlatest,\n\t\t}: SendOptions,\n\t\tadded: readonly Middleware[],\n\t): Promise<Response> => {\n\t\tconst replaced = latestSignal(latest);\n\t\tconst method = request.method.toLowerCase();\n\t\tconst context = contextOf(\n\t\t\tmethod,\n\t\t\tnew URL(request.url).pathname,\n\t\t\toperationId,\n\t\t);\n\t\tconst headers = await sharedHeaders();\n\t\trequest.headers.forEach((value, name) => {\n\t\t\theaders.set(name, value);\n\t\t});\n\t\tconst { deadline, signal } = withDeadline(\n\t\t\ttimeout,\n\t\t\tjoinSignals(request.signal, replaced),\n\t\t);\n\t\tconst sent = new Request(request, { headers, signal });\n\t\treturn dispatch(sent, context, timeout, deadline, retry, added);\n\t};\n\n\t/**\n\t * The client's calls, each with `scope()`'s signal added to its own, and\n\t * the middleware of `use()`: `inherited()`, a parent's, read as each call\n\t * is made, then its own. A group's `use()` is the group's alone.\n\t */\n\tconst surface = (\n\t\tscope: () => AbortSignal | undefined,\n\t\tinherited: () => readonly Middleware[],\n\t): HttpClient => {\n\t\tconst own: Middleware[] = [];\n\t\tconst layers = () => [...inherited(), ...own];\n\t\tconst scoped = <T extends { readonly signal?: AbortSignal | null }>(\n\t\t\tgiven: T | undefined,\n\t\t): T => {\n\t\t\tconst extra = scope();\n\t\t\tconst own = given ?? ({} as T);\n\t\t\treturn extra\n\t\t\t\t? ({ ...own, signal: joinSignals(own.signal, extra) } as T)\n\t\t\t\t: own;\n\t\t};\n\t\tconst client: Record<string, unknown> = {\n\t\t\trequest: (method: Method, path: string, given?: ReplyGiven) =>\n\t\t\t\trequest(method, path, scoped(given), layers()),\n\t\t\tsend: (sent: Request, given?: SendOptions) => {\n\t\t\t\tconst extra = scope();\n\t\t\t\treturn send(\n\t\t\t\t\textra\n\t\t\t\t\t\t? new Request(sent, { signal: joinSignals(sent.signal, extra) })\n\t\t\t\t\t\t: sent,\n\t\t\t\t\tgiven ?? {},\n\t\t\t\t\tlayers(),\n\t\t\t\t);\n\t\t\t},\n\t\t\tevents: (path: string, given?: EventsGiven) =>\n\t\t\t\tevents(path, scoped(given), layers()),\n\t\t\tlines: (path: string, given?: LinesGiven) =>\n\t\t\t\tlines(path, scoped(given), layers()),\n\t\t\tuse: (...middlewares: Middleware[]) => {\n\t\t\t\town.push(...middlewares);\n\t\t\t\treturn client;\n\t\t\t},\n\t\t\tgroup: (): HttpGroup => {\n\t\t\t\tlet controller = new AbortController();\n\t\t\t\tconst group = surface(\n\t\t\t\t\t() => joinSignals(scope(), controller.signal),\n\t\t\t\t\tlayers,\n\t\t\t\t) as HttpClient & Record<string, unknown>;\n\t\t\t\tgroup.cancel = (reason?: unknown) => {\n\t\t\t\t\tcontroller.abort(reason ?? cancelled('The group was cancelled'));\n\t\t\t\t\tcontroller = new AbortController();\n\t\t\t\t};\n\t\t\t\tObject.defineProperty(group, 'signal', {\n\t\t\t\t\tenumerable: true,\n\t\t\t\t\tget: () => controller.signal,\n\t\t\t\t});\n\t\t\t\treturn group as unknown as HttpGroup;\n\t\t\t},\n\t\t};\n\t\tfor (const method of METHODS) {\n\t\t\tclient[method] = (path: string, given?: ReplyGiven) =>\n\t\t\t\trequest(method, path, scoped(given), layers());\n\t\t}\n\t\treturn client as unknown as HttpClient;\n\t};\n\treturn surface(\n\t\t() => undefined,\n\t\t() => [],\n\t);\n}\n"
|
|
21
|
+
],
|
|
22
|
+
"mappings": ";AAiBO,SAAS,aAAY,CAAC,OAAyB;AAAA,EACrD,IAAI,OAAO,iBAAiB,eAAe,iBAAiB,cAAc;AAAA,IACzE,OAAO,MAAM,SAAS,gBAAgB,MAAM,SAAS;AAAA,EACtD;AAAA,EACA,OAAO,iBAAiB,SAAS,MAAM,SAAS;AAAA;AAI1C,IAAM,YAAY,CAAC,YACzB,IAAI,aAAa,SAAS,YAAY;AAGhC,SAAS,SAAY,CAC3B,SACA,QACa;AAAA,EACb,IAAI,CAAC;AAAA,IAAQ,OAAO;AAAA,EACpB,IAAI,OAAO;AAAA,IAAS,OAAO,QAAQ,OAAO,OAAO,MAAM;AAAA,EACvD,OAAO,IAAI,QAAW,CAAC,SAAS,WAAW;AAAA,IAC1C,MAAM,OAAO,MAAM,OAAO,OAAO,MAAM;AAAA,IACvC,OAAO,iBAAiB,SAAS,MAAM,EAAE,MAAM,KAAK,CAAC;AAAA,IACrD,QACE,KAAK,SAAS,MAAM,EACpB,QAAQ,MAAM,OAAO,oBAAoB,SAAS,IAAI,CAAC;AAAA,GACzD;AAAA;AAIK,SAAS,WAAW,IACvB,SACuB;AAAA,EAC1B,MAAM,UAAU,QAAQ,OACvB,CAAC,WAAkC,UAAU,IAC9C;AAAA,EACA,OAAO,QAAQ,SAAS,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