{"_id":"@affenity/simplebull","name":"@affenity/simplebull","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@affenity/simplebull","version":"0.0.1","type":"module","exports":{".":"./src/index.ts","./*":"./src/*"},"types":"./src/index.ts","dependencies":{"bullmq":"^5.13.0","ioredis":"^5.4.1","zod":"^3.23.8"},"devDependencies":{"@bull-board/api":"^5.21.5","@bull-board/express":"^5.21.5","@bull-board/ui":"^5.21.5","@types/bun":"^1.1.9","@types/express":"^4.17.17","express":"^4.21.0","tsx":"^4.19.1"},"peerDependencies":{"typescript":"^5.6.2"},"_id":"@affenity/simplebull@0.0.1","description":"A highly opinionated, highly simplistic, highly not recommended for anyone else to use, library that looks\r like inngest.com and trigger.dev, but is free, straightforward to use, and are built on top of existing tools.","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-38h07afaa9KYOHLaJBtuglpJetWRMyglcawTZEdrvuGfvIjf81yVD+m/LZ67l8zFNHvX97ijVOteArG3JI0ToA==","shasum":"e4542556ce2b1fd9bb039d8ab3409ccfd96ad1b3","tarball":"https://registry.npmjs.org/@affenity/simplebull/-/simplebull-0.0.1.tgz","fileCount":7,"unpackedSize":34818,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC7f6oCRpJG05Y+7+h2lioQiCGggDFei5pBYhGuxAQruAiEAvNPbo6X7zqA0348WIFXC8kIRNlk76pk8TO1nhO9QxhQ="}]},"_npmUser":{"name":"affenity","email":"affenity@xnx.no"},"directories":{},"maintainers":[{"name":"affenity","email":"affenity@xnx.no"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/simplebull_0.0.1_1726404976843_0.8575322338354501"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-15T12:56:16.761Z","0.0.1":"2024-09-15T12:56:17.036Z","modified":"2024-09-15T12:56:17.311Z"},"maintainers":[{"name":"affenity","email":"affenity@xnx.no"}],"description":"A highly opinionated, highly simplistic, highly not recommended for anyone else to use, library that looks\r like inngest.com and trigger.dev, but is free, straightforward to use, and are built on top of existing tools.","readme":"# SimpleBull\r\n\r\nA highly opinionated, highly simplistic, highly not recommended for anyone else to use, library that looks\r\nlike inngest.com and trigger.dev, but is free, straightforward to use, and are built on top of existing tools.\r\n\r\n(Also meaning it's simple as heck to self-host. Just use Redis and BullMQ).\r\n\r\nThis is meant more like a proof oc concept, and not a production ready library.\r\n\r\n## Installing\r\n\r\n```bash\r\nbun add simplebull\r\n```\r\n\r\n## Usage\r\n\r\n```typescript\r\n//> Declaring an \"Action\" (Queue & Worker)\r\nconst processVideo = SimpleBull.action(\r\n    {\r\n        slug: \"process-video\",\r\n        schema: z.object({\r\n            videoUrl: z.string()\r\n        })\r\n    },\r\n    {\r\n        jobs: {\r\n            retries: {\r\n                max: 3,\r\n                delay: 1000,\r\n                backoff: \"fixed\"\r\n            }\r\n        }\r\n    },\r\n    async ({ ctx, job, runner, data }) => {\r\n        const downloadVideo = await runner.step(\r\n            { id: \"download-video\" },\r\n            () => downloadVideoFromUrl(data.videoUrl)\r\n        );\r\n\r\n        const transcodeVideo = await runner.step(\r\n            { id: \"transcode-video\" },\r\n            () => transcodeVideo(downloadVideo)\r\n        );\r\n\r\n        const generateTranscripts = await runner.step(\r\n            { id: \"generate-transcripts\" },\r\n            () => generateTranscripts(transcodeVideo)\r\n        );\r\n\r\n        const writeToDb = await runner.step(\r\n            { id: \"write-to-db\" },\r\n            () => db.video.create({\r\n                downloadedId: downloadVideo.id,\r\n                transcriptsLocation: generateTranscripts.location,\r\n                transcodedVideoLocation: transcodeVideo.location\r\n            })\r\n        );\r\n\r\n        return {\r\n            dbId: writeToDb.id\r\n        };\r\n    }\r\n);\r\n\r\n//> Initiating\r\nconst client = SimpleBull.client({ redisUrl: \"redis://\" });\r\nawait client.init(); //> This prepared the bullmq queues and workers\r\nawait client.start(); //> This starts them for work\r\n\r\n//> Adding a job\r\nprocessVideo.addJob({\r\n    videoUrl: \"https://www.youtube.com/watch?v=dQw4w9WgXcQ\"\r\n});\r\n```\r\n\r\nAs you can see, each step is run redundantly, and if any step fails, the previous successful steps won't be run again,\r\nand the job will start from the failed step.\r\n","readmeFilename":"README.md"}