mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 22:50:51 +00:00
Merge remote-tracking branch 'origin/main' into fix/v1397-tz
This commit is contained in:
commit
ada490c7e9
57 files changed
+1485
-99
No files matched your search
@@ -90,6 +90,9 @@ describe("rasterizePdf", () => {
|
||||
expect(result.ok).toBe(true);
|
||||
if (!result.ok) return;
|
||||
expect(result.images).toHaveLength(RASTER_MAX_PAGES);
|
||||
// The page count travels with the result, so a caller can say the
|
||||
// reading stopped short.
|
||||
expect(result.pageCount).toBe(RASTER_MAX_PAGES + 4);
|
||||
});
|
||||
|
||||
it("honours a caller maxPages bound (thumbnail path renders page 1 only)", async () => {
|
||||
|
||||
@@ -74,7 +74,16 @@ export interface RasterImage {
|
||||
* would not render" (`render-failed` — malformed / encrypted / zero pages).
|
||||
*/
|
||||
export type RasterResult =
|
||||
| { ok: true; images: RasterImage[] }
|
||||
| {
|
||||
ok: true;
|
||||
images: RasterImage[];
|
||||
/**
|
||||
* Pages in the PDF. Above `images.length` when the page cap cut the
|
||||
* render short, which a caller showing the result has to say: the
|
||||
* reading covers the first pages only.
|
||||
*/
|
||||
pageCount: number;
|
||||
}
|
||||
| { ok: false; reason: "unsupported" | "render-failed" };
|
||||
|
||||
// Minimal structural types for the slice of the pdfjs API this module uses. A
|
||||
@@ -212,7 +221,7 @@ export async function rasterizePdf(
|
||||
action: { name: "documents.rasterize.ok" },
|
||||
meta: { pages: images.length, cappedFrom: doc.numPages },
|
||||
});
|
||||
return { ok: true, images };
|
||||
return { ok: true, images, pageCount: doc.numPages };
|
||||
} catch (err) {
|
||||
annotate({
|
||||
action: { name: "documents.rasterize.failed" },
|
||||
|
||||
Reference in new issue
Block a user