Commit Graph
40 Commits
Author SHA1 Message Date
anthonyandClaude Sonnet 5 598781f417 feat: register ICO/HEIC/HEIF converters in the worker and pass iconSize through
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 10:16:25 +02:00
anthonyandClaude Sonnet 5 67bdfbf3de feat: wire ICO/HEIC/HEIF converters and iconSize validation into the API
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 10:15:14 +02:00
anthonyandClaude Sonnet 5 be43eac13a feat: thread iconSize through jobRepository
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 10:13:15 +02:00
anthonyandClaude Sonnet 5 8795f65055 feat: add source-only HEIC/HEIF image converter
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 10:10:41 +02:00
anthonyandClaude Sonnet 5 05ef7dfca1 feat: add bidirectional ICO image converter
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 10:09:56 +02:00
anthonyandClaude Sonnet 5 39b296f5d3 feat: add ico MIME type and heif->heic extension alias
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 10:08:46 +02:00
anthony fc217d8aae Add HEIC/HEIF test fixtures for upcoming heic-convert-based decoding
Reuses libheif's own LGPL/MIT-licensed with-alpha-512x512.heic sample
under both a .heic and .heif filename, verified to decode correctly
via heic-convert (the library the image format work will use). No
suitably-licensed HEVC/mif1-branded .heif-distinct sample exists that
is compatible with the pinned libheif-js version, and file-type detects
both extensions identically regardless of container brand, so the
duplicate content is sufficient to exercise the heif source-format
code path.
2026-07-31 09:48:11 +02:00
anthony b40a7d340f Add support for csv + xlsx 2026-07-31 09:17:08 +02:00
anthonyandClaude Sonnet 5 756e875fd9 feat: add md<->txt passthrough document converters
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 08:34:51 +02:00
anthonyandClaude Sonnet 5 70c0c5ce6b feat: add md<->docx document converters
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 08:33:31 +02:00
anthonyandClaude Sonnet 5 82533ca436 feat: add md<->pdf document converters
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 08:31:53 +02:00
anthonyandClaude Sonnet 5 1595c5e0af feat: add md<->html document converters
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 08:31:00 +02:00
anthonyandClaude Sonnet 5 28b6edac82 feat: add MIME plumbing for markdown (.md) format
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 08:29:55 +02:00
anthonyandClaude Sonnet 5 c42fe68b36 fix: isolate per-job cleanup errors and guard markDone against undefined
runCleanup previously had no try/catch around each expired job, so one
job's markCleaned/delete failure would abort the whole pass, leaving
later expired jobs' files undeleted for that run. Each iteration is now
wrapped in a try/catch that logs and continues; the returned count only
reflects jobs that actually completed the delete+markCleaned sequence.

markDone now guards outputPath/outputMimeType/outputSizeBytes/
conversionDurationSeconds with `?? null`, matching the guard createJob
already has on `quality` — Prisma treats `undefined` in a data object as
"leave the column alone" rather than binding NULL like the old raw SQL
did. Currently unreachable in practice since the worker always passes
real values, but keeps the repository defensive and consistent.

Added a cleanup.test.js case that monkey-patches
prisma.conversionJob.update to reject for one job's cleanedAt update,
asserting a later expired job in the same batch still gets cleaned.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 01:54:14 +02:00
anthonyandClaude Sonnet 5 4c9fe8f616 Wire the app, worker, and cleanup entry points onto Prisma Client
Task 4 rewrote src/db.js and src/jobs/jobRepository.js to use Prisma
instead of the hand-rolled mariadb pool. This updates every remaining
call site (app.js, server.js, worker.js, cleanup.js) and the 5 test
files that still referenced getPool/closePool/pool.query, so the app
and full test suite compile and run against Prisma Client.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 01:32:54 +02:00
anthony 3a04da3180 Rewrite the data access layer onto Prisma Client 2026-07-31 01:27:18 +02:00
anthonyandClaude Sonnet 5 5e0b832fce Add buildDatabaseUrl and a CLI helper to print it
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-31 01:11:35 +02:00
anthonyandClaude Sonnet 5 4cb9d76176 feat: validate and persist per-file quality in POST /api/jobs
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 23:30:23 +02:00
anthonyandClaude Sonnet 5 d827f55e46 feat: pass job quality through to converters in the worker
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 23:30:16 +02:00
anthonyandClaude Sonnet 5 fd99453e38 feat: opt-in JPEG-embed quality for image-to-PDF conversion
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 23:30:08 +02:00
anthonyandClaude Sonnet 5 57d7dac2b5 feat: support quality/compressionLevel options in image converters
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 23:03:39 +02:00
anthonyandClaude Sonnet 5 8caab530e7 feat: add quality column to conversion_jobs
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 23:02:48 +02:00
anthonyandClaude Sonnet 5 ff5a257a0e feat: add auto-increment id, size/duration tracking, and soft cleanup to conversion_jobs
Rename the old CHAR(36) id to uuid (still used for public URLs and file
naming) and add a real auto-increment id as the primary key. Track
input/output file size and conversion duration per job. Cleanup no
longer deletes rows; it marks cleaned_at and skips already-cleaned
expired jobs on later runs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 22:06:32 +02:00
anthony 24f7ab2625 Add Posthog tracking + fix extension download + doc 2026-07-30 21:26:52 +02:00
anthonyandClaude Sonnet 5 1e28f9837a test: add end-to-end upload-convert-download coverage for image and document families
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:55:31 +02:00
anthonyandClaude Sonnet 5 0761f1b76d feat: add cleanup script and o2switch deployment docs
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:22:48 +02:00
anthonyandClaude Sonnet 5 360e0ee7a6 feat: add worker process with bounded concurrency and per-job timeout
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:21:42 +02:00
anthonyandClaude Sonnet 5 ba5756e122 feat: add job status and download endpoints
Also adds vitest.config.js with fileParallelism: false. Every DB-backed
test file wipes and reseeds the shared conversion_jobs table in
beforeEach; running test files in parallel (Vitest's default) let one
file's DELETE race another file's just-inserted row against the same
live MariaDB instance, causing intermittent cross-file failures.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:17:55 +02:00
anthonyandClaude Sonnet 5 280b249b05 feat: add POST /api/jobs and GET /api/formats endpoints
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:15:13 +02:00
anthonyandClaude Sonnet 5 5cf2ae4d59 feat: validate declared source format against sniffed magic bytes
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:14:16 +02:00
anthonyandClaude Sonnet 5 05ff96b8b3 feat: add best-effort PDF source converters (txt, html, docx)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:12:43 +02:00
anthonyandClaude Sonnet 5 16b4f28b42 feat: add DOCX/TXT/HTML document converters
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:10:34 +02:00
anthonyandClaude Sonnet 5 a049be2fc8 feat: add image to PDF converter
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:08:51 +02:00
anthonyandClaude Sonnet 5 5a990106b0 feat: add image converter family (sharp)
Regenerates the sample.png test fixture via sharp itself: the
hand-encoded base64 PNG from the plan had valid magic bytes (enough to
fool file-type's signature check) but was malformed past the header,
which libpng rejected as soon as sharp actually tried to decode it.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:07:26 +02:00
anthonyandClaude Sonnet 5 aeebc47379 feat: add converter registry
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:06:12 +02:00
anthonyandClaude Sonnet 5 4b7ad9ef4e feat: add conversion_jobs repository
Also configures the MariaDB pool with timezone: 'auto', since the
default 'local' mode sends dates without timezone conversion and
silently broke expires_at comparisons whenever the app host and DB
server clocks differ (caught by the findExpiredJobs test).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:03:04 +02:00
anthonyandClaude Sonnet 5 f7c7e547d2 feat: add MIME sniffing and output MIME lookup
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-30 09:00:45 +02:00
anthonyandClaude Sonnet 5 d0faa162dc feat: add storage path helpers
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-29 14:12:13 +02:00
anthonyandClaude Sonnet 5 a5ab05303f feat: add MariaDB schema and connection pool
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-29 14:09:46 +02:00
anthonyandClaude Sonnet 5 378ca762a2 feat: project scaffolding and env config loader
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-29 14:06:56 +02:00