64a2cec788
Task 20: services/worker package (@photo/worker, commonjs) with jest unit/e2e configs mirroring api conventions (root .env via test/load-env.ts, moduleNameMapper to @photo/contracts/db-cn/storage TS sources, maxWorkers 1, test/reset.ts = MySQL TRUNCATE + MinIO photo-live/dev prefix wipe) and the sharp processing pipeline runPipeline(): metadata whitelist gate (jpeg/png/webp/avif/heif/tiff, else PipelineError UNSUPPORTED_TYPE), decode failures mapped to PipelineError DECODE_FAILED, no-arg .rotate() auto-orientation (EXIF 5-8 swaps stored width/height), thumb <=480w q75 and browse <=1920 q82 JPEG variants with withoutEnlargement, and no withMetadata so outputs carry no EXIF/GPS at all. sharp 0.35 prebuilt loads script-free under pnpm 10; its win32 libvips lacks a HEVC encoder, so the HEVC-HEIF unit case self-skips with a console note (G2 verifies with real iPhone samples) while the AV1-HEIF case covers the same libheif decode path / 'heif' format bucket. Co-Authored-By: Claude Code <noreply@anthropic.com>
33 lines
899 B
JSON
33 lines
899 B
JSON
{
|
|
"name": "@photo/worker",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"description": "CN photo worker (sharp 变体流水线、发布事务 + outbox、补偿扫描;Task 20/21)",
|
|
"scripts": {
|
|
"build": "tsc -p tsconfig.build.json",
|
|
"start": "tsc -p tsconfig.build.json && node dist/main.js",
|
|
"typecheck": "tsc --noEmit",
|
|
"lint": "eslint .",
|
|
"test": "jest",
|
|
"test:e2e": "jest --config jest.e2e.config.cjs"
|
|
},
|
|
"dependencies": {
|
|
"@photo/contracts": "workspace:*",
|
|
"@photo/db-cn": "workspace:*",
|
|
"@photo/storage": "workspace:^",
|
|
"bullmq": "^6.3.6",
|
|
"ioredis": "^6.0.0",
|
|
"pino": "^10.0.0",
|
|
"sharp": "^0.35.0"
|
|
},
|
|
"devDependencies": {
|
|
"@aws-sdk/client-s3": "^3.700.0",
|
|
"@types/jest": "^29.5.13",
|
|
"@types/node": "^22.10.0",
|
|
"dotenv": "^16.4.5",
|
|
"jest": "^29.7.0",
|
|
"ts-jest": "^29.2.5",
|
|
"typescript": "^5.6.0"
|
|
}
|
|
}
|