{"_id":"@ahmedrowaihi/bull-board-fetch","name":"@ahmedrowaihi/bull-board-fetch","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@ahmedrowaihi/bull-board-fetch","version":"1.0.0","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"description":"Fetch adapter for bull-board - works with Node.js 18+ and Bun using web standard fetch API","keywords":["bull-board","bullmq","fetch","node","bun","adapter"],"author":{"name":"Superstreamer"},"license":"MPL-2.0","repository":{"type":"git","url":"git+https://github.com/ahmedrowaihi/bull-board-fetch.git"},"bugs":{"url":"https://github.com/ahmedrowaihi/bull-board-fetch/issues"},"homepage":"https://github.com/ahmedrowaihi/bull-board-fetch#readme","scripts":{"build":"tsc","prepublishOnly":"npm run build","typecheck":"tsc --noEmit"},"dependencies":{"@bull-board/api":"^6.15.0","ejs":"^3.1.10"},"devDependencies":{"@types/ejs":"^3.1.5","@types/node":"^22.10.2","typescript":"^5.9.3"},"engines":{"node":">=18.0.0"},"peerDependencies":{"bun":">=1.0.0"},"peerDependenciesMeta":{"bun":{"optional":true}},"_id":"@ahmedrowaihi/bull-board-fetch@1.0.0","gitHead":"791281e5b89abccaf4b57a316297e8197d24aba3","_nodeVersion":"23.3.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-DFQhOES3a/xutyYRBImtj3xyTg3DmVLLDDZmfC8EsGjvS8YimDjX8mf10tXhMNb9fzwidQKGIUnpwu3s3RtUBA==","shasum":"5bf0325aaec699200e590e861f34e88a763db9e4","tarball":"https://registry.npmjs.org/@ahmedrowaihi/bull-board-fetch/-/bull-board-fetch-1.0.0.tgz","fileCount":6,"unpackedSize":35057,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFr/Sb+gKqyg2ccweKdH274ba4dRN30fY7X1YXVcNmukAiBhtEVI/j5rZE9TsqyF6cWHrsz37wG+npNUAv52ZdrFgA=="}]},"_npmUser":{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"},"directories":{},"maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/bull-board-fetch_1.0.0_1766506974023_0.799882956125304"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-23T16:22:53.898Z","1.0.0":"2025-12-23T16:22:54.166Z","modified":"2025-12-23T16:22:54.446Z"},"maintainers":[{"name":"ahmedrowaihi","email":"ahmedrowaihi1@gmail.com"}],"description":"Fetch adapter for bull-board - works with Node.js 18+ and Bun using web standard fetch API","homepage":"https://github.com/ahmedrowaihi/bull-board-fetch#readme","keywords":["bull-board","bullmq","fetch","node","bun","adapter"],"repository":{"type":"git","url":"git+https://github.com/ahmedrowaihi/bull-board-fetch.git"},"author":{"name":"Superstreamer"},"bugs":{"url":"https://github.com/ahmedrowaihi/bull-board-fetch/issues"},"license":"MPL-2.0","readme":"# @ahmedrowaihi/bull-board-fetch\n\nFetch adapter for [bull-board](https://github.com/felixmosh/bull-board). Works with Node.js 18+ and Bun using the web standard fetch API without requiring Hono or other frameworks.\n\n## Installation\n\n```bash\n# With Bun\nbun add @ahmedrowaihi/bull-board-fetch @bull-board/api\n\n# With npm/yarn/pnpm\nnpm install @ahmedrowaihi/bull-board-fetch @bull-board/api\n```\n\n## Usage\n\n```typescript\nimport { createBullBoard } from \"@bull-board/api\";\nimport { BullMQAdapter } from \"@bull-board/api/bullMQAdapter\";\nimport { FetchAdapter } from \"@ahmedrowaihi/bull-board-fetch\";\nimport { Queue } from \"bullmq\";\n\n// Create your queues\nconst queue = new Queue(\"my-queue\");\n\n// Create the adapter\nconst serverAdapter = new FetchAdapter();\nserverAdapter.setBasePath(\"/admin/queues\");\n\n// Create bull-board\ncreateBullBoard({\n  queues: [new BullMQAdapter(queue)],\n  serverAdapter,\n});\n\n// Get the fetch handler\nconst handler = serverAdapter.getFetchHandler();\n\n// Use with Bun's native server\nexport default {\n  port: 3000,\n  fetch: handler,\n};\n\n// Or with Node.js 18+ (using a fetch-compatible server)\n// Example with a simple Node.js server:\nimport { createServer } from \"node:http\";\n\nconst server = createServer(async (req, res) => {\n  const request = new Request(`http://${req.headers.host}${req.url}`, {\n    method: req.method,\n    headers: req.headers as HeadersInit,\n    body: req.method !== \"GET\" && req.method !== \"HEAD\" ? req : undefined,\n  });\n\n  const response = await handler(request);\n  \n  res.writeHead(response.status, Object.fromEntries(response.headers.entries()));\n  if (response.body) {\n    const body = await response.arrayBuffer();\n    res.end(Buffer.from(body));\n  } else {\n    res.end();\n  }\n});\n\nserver.listen(3000);\n```\n\n## Features\n\n- ✅ Works with Bun's native fetch API\n- ✅ No Hono or other framework dependencies\n- ✅ Handles static file serving\n- ✅ Supports base path configuration\n- ✅ EJS template rendering for HTML views\n- ✅ Automatic path prefix injection for static assets\n\n## API\n\n### `FetchAdapter`\n\n#### Methods\n\n- `setBasePath(path: string): this` - Set the base path for the dashboard\n- `setStaticPath(staticRoute: string, staticPath: string): this` - Set static file route and path\n- `setViewsPath(viewPath: string): this` - Set views/templates path\n- `setErrorHandler(handler: (error: Error) => ControllerHandlerReturnType): this` - Set error handler\n- `setApiRoutes(routes: readonly AppControllerRoute[]): this` - Set API routes\n- `setEntryRoute(routeDef: AppViewRoute): this` - Set entry route (HTML view)\n- `setQueues(bullBoardQueues: BullBoardQueues): this` - Set queues\n- `setUIConfig(config: UIConfig): this` - Set UI configuration\n- `getFetchHandler(): (request: Request) => Promise<Response>` - Get the fetch handler\n\n## Publishing\n\nThis package publishes TypeScript source directly (no build step required). To publish:\n\n```bash\n# Make sure you're logged into npm\nnpm login\n\n# Update version in package.json if needed\n# Then publish\nnpm publish --access public\n```\n\nNote: Make sure to update the `repository.url` in `package.json` with your actual GitHub repository URL before publishing.\n\n## License\n\nMPL-2.0\n\n","readmeFilename":"README.md","_rev":"1-d756ff697f5f0970f0a31843cb6cee94"}