SrGooglo f62e885c65 Refactor file upload system with new transformations pipeline
The commit refactors the chunked upload system to support a transformation pipeline. Key changes include:

- Replace SSE field names for consistency (sseChannelId, sseUrl)
- Fix progress reporting structure with state and percent fields
- Add transformation handlers (a-dash, mq-hls, img-compress, video-compress)
- Create new Upload class with clear separation of concerns
- Improve file processing workflow with better directory structure
- Fix typo in UploadButton component (progess → progress)
- Remove deprecated file processing services
2025-04-24 06:06:21 +00:00

28 lines
667 B
TypeScript

const Handlers = {
"a-dash": require("./handlers/a-dash").default,
"mq-hls": require("./handlers/mq-hls").default,
"img-compress": require("./handlers/img-compress").default,
"video-compress": require("./handlers/video-compress").default,
}
export type TransformationPayloadType = {
filePath: string
workPath: string
handler: string
onProgress?: function
}
class Transformation {
static async transform(payload: TransformationPayloadType) {
const handler = Handlers[payload.handler]
if (typeof handler !== "function") {
throw new Error(`Invalid handler: ${payload.handler}`)
}
return await handler(payload)
}
}
export default Transformation