From 1e39ef7bed70701bd7de5f2dca7a380805ef9df4 Mon Sep 17 00:00:00 2001 From: Gerard Date: Mon, 1 Jun 2026 15:08:34 +0200 Subject: [PATCH] docs: fix http.md File Operations drift + index.md TS version claim MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `docs/packages/http.md` File Operations documented the pre-0.3.0 DOM-bound `downloadRequest`/`previewRequest` (3-arg, browser save dialog, blobUrl-string return) that no longer exists. The actual 0.3.0+ surface is transport-pure: `(endpoint, options?) → Promise>`, no DOM, no save dialog (verified against `packages/http/src/types.ts:50,58` + `http.ts:120,123`). Rewrote the prose examples to the consumer-owned download dance (`triggerDownload` from fs-helpers / `URL.createObjectURL`), aligning the prose with the already-current API-reference table. `docs/index.md` hero feature claimed "TypeScript 5.9+"; actual is `^6.0`. Fixed to "TypeScript 6.0+". Docs-only — no `src/`, no publish trigger (publish fires on `packages/*/package.json`). VitePress build clean. Co-Authored-By: Claude Opus 4.8 (1M context) --- docs/index.md | 2 +- docs/packages/http.md | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/index.md b/docs/index.md index f8b314f..0597e4c 100644 --- a/docs/index.md +++ b/docs/index.md @@ -27,7 +27,7 @@ features: - title: Component Agnostic details: Toast and dialog services manage lifecycle and state — you bring your own Vue components. No opinionated UI. Your design system, our plumbing. - title: Type Safe - details: Built with TypeScript 5.9+ in strict mode. Router navigation is type-checked against your route definitions. Translation keys are validated at compile time. No stringly-typed APIs. + details: Built with TypeScript 6.0+ in strict mode. Router navigation is type-checked against your route definitions. Translation keys are validated at compile time. No stringly-typed APIs. --- ## The Packages diff --git a/docs/packages/http.md b/docs/packages/http.md index c39b824..a69a04b 100644 --- a/docs/packages/http.md +++ b/docs/packages/http.md @@ -174,21 +174,30 @@ Other packages hook into these middleware points. `fs-loading` registers request ## File Operations +`downloadRequest` and `previewRequest` are **transport-only** — they GET an endpoint as a `Blob` and return the full `AxiosResponse`. Neither touches the DOM. There is no browser save dialog and no object-URL management inside fs-http; the consumer owns that orchestration (fs-packages issue #59). The two names share identical transport (`responseType: 'blob'`); the separate name communicates intent (download = save-to-disk, preview = inline-display). + ### Download -Downloads a file and triggers a browser save dialog: +GET a file as a `Blob`, then hand the blob to a download utility such as [`triggerDownload`](/packages/helpers) from `@script-development/fs-helpers`: ```typescript -await http.downloadRequest('/reports/annual', 'annual-report', 'application/pdf'); +import {triggerDownload} from '@script-development/fs-helpers'; + +const response = await http.downloadRequest('/reports/annual'); +triggerDownload(response.data, 'annual-report.pdf'); ``` +The response is the full `AxiosResponse`, so headers (e.g. `content-type`) are available before the hand-off if you need to derive a filename or extension. + ### Preview -Creates a blob URL for inline preview (images, PDFs): +GET a file as a `Blob` for inline display (images, PDFs). The consumer manages the object-URL lifecycle: ```typescript -const blobUrl = await http.previewRequest('/documents/123/preview'); -// Use in an or