From c02098084418d15d944c52599bdef2c9a70ae49d Mon Sep 17 00:00:00 2001 From: Notalifeform Date: Tue, 12 Nov 2024 09:15:24 +0100 Subject: [PATCH 1/9] feat: paused jobs: support edit/duplicate/clean (#846) --- packages/ui/src/components/JobCard/JobActions/JobActions.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/ui/src/components/JobCard/JobActions/JobActions.tsx b/packages/ui/src/components/JobCard/JobActions/JobActions.tsx index 0e7b12a2..e41988c1 100644 --- a/packages/ui/src/components/JobCard/JobActions/JobActions.tsx +++ b/packages/ui/src/components/JobCard/JobActions/JobActions.tsx @@ -52,6 +52,7 @@ const statusToButtonsMap: Record = { ], [STATUSES.completed]: [buttonTypes.duplicate, buttonTypes.retry, buttonTypes.clean], [STATUSES.waiting]: [buttonTypes.duplicate, buttonTypes.updateData, buttonTypes.clean], + [STATUSES.paused]: [buttonTypes.duplicate, buttonTypes.updateData, buttonTypes.clean], } as const; export const JobActions = ({ actions, status, allowRetries }: JobActionsProps) => { From b423427621590e921bd1dd44452e4f4c0123f968 Mon Sep 17 00:00:00 2001 From: Felix Mosheev <9304194+felixmosh@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:21:49 +0200 Subject: [PATCH 2/9] Release 6.4.0 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- packages/api/package.json | 4 ++-- packages/express/package.json | 6 +++--- packages/fastify/package.json | 6 +++--- packages/h3/package.json | 6 +++--- packages/hapi/package.json | 6 +++--- packages/hono/package.json | 6 +++--- packages/koa/package.json | 6 +++--- packages/nestjs/package.json | 12 ++++++------ packages/ui/package.json | 4 ++-- 11 files changed, 36 insertions(+), 29 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a73effc7..79ffdc0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,15 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +#### [v6.4.0](https://github.com/felixmosh/bull-board/compare/v6.3.3...v6.4.0) + +- feat: paused jobs: support edit/duplicate/clean [`#846`](https://github.com/felixmosh/bull-board/pull/846) + #### [v6.3.3](https://github.com/felixmosh/bull-board/compare/v6.3.2...v6.3.3) +> 31 October 2024 + +- Release 6.3.3 [`38c79ee`](https://github.com/felixmosh/bull-board/commit/38c79ee63c0bd676cc42fcd067611420809916c4) - fix: handle an error when highlighting an unmount component, occurs when navigating between tabs [`9add4ed`](https://github.com/felixmosh/bull-board/commit/9add4ed37d822c8e5bbf0973d553c2f4ed503910) - fix: failed status should show Error tab at start [`7cad06e`](https://github.com/felixmosh/bull-board/commit/7cad06e73a2a79c8c19206c79810eb623e47ca82) diff --git a/package.json b/package.json index 3a7cdc06..2e7a4ed1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bull-board/root", - "version": "6.3.3", + "version": "6.4.0", "private": true, "description": "Bull queue UI for inspecting jobs", "keywords": [ diff --git a/packages/api/package.json b/packages/api/package.json index 454c2f00..f528a34d 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@bull-board/api", - "version": "6.3.3", + "version": "6.4.0", "description": "A Dashboard server API built on top of bull or bullmq.", "keywords": [ "bull", @@ -39,7 +39,7 @@ "supertest": "^6.3.3" }, "peerDependencies": { - "@bull-board/ui": "6.3.3" + "@bull-board/ui": "6.4.0" }, "publishConfig": { "access": "public" diff --git a/packages/express/package.json b/packages/express/package.json index da923d9c..499619d8 100644 --- a/packages/express/package.json +++ b/packages/express/package.json @@ -1,6 +1,6 @@ { "name": "@bull-board/express", - "version": "6.3.3", + "version": "6.4.0", "description": "A Express.js server adapter for Bull-Board dashboard.", "keywords": [ "bull", @@ -28,8 +28,8 @@ "clean": "rm -rf dist" }, "dependencies": { - "@bull-board/api": "6.3.3", - "@bull-board/ui": "6.3.3", + "@bull-board/api": "6.4.0", + "@bull-board/ui": "6.4.0", "ejs": "^3.1.10", "express": "^4.19.2" }, diff --git a/packages/fastify/package.json b/packages/fastify/package.json index 4bc9aeeb..2b44e1a3 100644 --- a/packages/fastify/package.json +++ b/packages/fastify/package.json @@ -1,6 +1,6 @@ { "name": "@bull-board/fastify", - "version": "6.3.3", + "version": "6.4.0", "description": "A Fastify.js server adapter for Bull-Board dashboard.", "keywords": [ "bull", @@ -28,8 +28,8 @@ "clean": "rm -rf dist" }, "dependencies": { - "@bull-board/api": "6.3.3", - "@bull-board/ui": "6.3.3", + "@bull-board/api": "6.4.0", + "@bull-board/ui": "6.4.0", "@fastify/static": "^8.0.1", "@fastify/view": "^10.0.1", "ejs": "^3.1.10" diff --git a/packages/h3/package.json b/packages/h3/package.json index 9c6a96e5..3bdb0388 100644 --- a/packages/h3/package.json +++ b/packages/h3/package.json @@ -1,6 +1,6 @@ { "name": "@bull-board/h3", - "version": "6.3.3", + "version": "6.4.0", "description": "A H3 server adapter for Bull-Board dashboard.", "keywords": [ "bull", @@ -29,8 +29,8 @@ "clean": "rm -rf dist" }, "dependencies": { - "@bull-board/api": "6.3.3", - "@bull-board/ui": "6.3.3", + "@bull-board/api": "6.4.0", + "@bull-board/ui": "6.4.0", "ejs": "^3.1.10", "h3": "^1.10.0" }, diff --git a/packages/hapi/package.json b/packages/hapi/package.json index 59bc43c1..cb6fcd2a 100644 --- a/packages/hapi/package.json +++ b/packages/hapi/package.json @@ -1,6 +1,6 @@ { "name": "@bull-board/hapi", - "version": "6.3.3", + "version": "6.4.0", "description": "A Hapi.js server adapter for Bull-Board dashboard.", "keywords": [ "bull", @@ -29,8 +29,8 @@ "clean": "rm -rf dist" }, "dependencies": { - "@bull-board/api": "6.3.3", - "@bull-board/ui": "6.3.3", + "@bull-board/api": "6.4.0", + "@bull-board/ui": "6.4.0", "@hapi/inert": "^6.0.5", "@hapi/vision": "^6.1.0", "ejs": "^3.1.10" diff --git a/packages/hono/package.json b/packages/hono/package.json index 3b41fc4b..ab834a51 100644 --- a/packages/hono/package.json +++ b/packages/hono/package.json @@ -1,6 +1,6 @@ { "name": "@bull-board/hono", - "version": "6.3.3", + "version": "6.4.0", "description": "A Hono server adapter for Bull-Board dashboard.", "keywords": [ "bull", @@ -28,8 +28,8 @@ "clean": "rm -rf dist" }, "dependencies": { - "@bull-board/api": "6.3.3", - "@bull-board/ui": "6.3.3", + "@bull-board/api": "6.4.0", + "@bull-board/ui": "6.4.0", "ejs": "^3.1.10", "hono": "^4.4.7" }, diff --git a/packages/koa/package.json b/packages/koa/package.json index 1d6aef93..ecffffdf 100644 --- a/packages/koa/package.json +++ b/packages/koa/package.json @@ -1,6 +1,6 @@ { "name": "@bull-board/koa", - "version": "6.3.3", + "version": "6.4.0", "description": "A Koa.js server adapter for Bull-Board dashboard.", "keywords": [ "bull", @@ -28,8 +28,8 @@ "clean": "rm -rf dist" }, "dependencies": { - "@bull-board/api": "6.3.3", - "@bull-board/ui": "6.3.3", + "@bull-board/api": "6.4.0", + "@bull-board/ui": "6.4.0", "@koa/bodyparser": "^5.1.1", "ejs": "^3.1.10", "koa": "^2.15.3", diff --git a/packages/nestjs/package.json b/packages/nestjs/package.json index c9825d5f..153b58d8 100644 --- a/packages/nestjs/package.json +++ b/packages/nestjs/package.json @@ -1,6 +1,6 @@ { "name": "@bull-board/nestjs", - "version": "6.3.3", + "version": "6.4.0", "description": "A NestJS module for Bull-Board dashboard.", "keywords": [ "bull", @@ -19,9 +19,9 @@ "clean": "rm -rf dist" }, "devDependencies": { - "@bull-board/api": "^6.3.3", - "@bull-board/express": "^6.3.3", - "@bull-board/fastify": "^6.3.3", + "@bull-board/api": "^6.4.0", + "@bull-board/express": "^6.4.0", + "@bull-board/fastify": "^6.4.0", "@nestjs/bullmq": "^10.0.0", "@nestjs/common": "^10.0.1", "@nestjs/core": "^10.0.1", @@ -36,8 +36,8 @@ "@nestjs/bull-shared": "^10.0.0" }, "peerDependencies": { - "@bull-board/api": "^6.3.3", - "@bull-board/express": "^6.3.3", + "@bull-board/api": "^6.4.0", + "@bull-board/express": "^6.4.0", "@nestjs/common": "^9.0.0 || ^10.0.0", "@nestjs/core": "^9.0.0 || ^10.0.0", "reflect-metadata": "^0.1.13 || ^0.2.0", diff --git a/packages/ui/package.json b/packages/ui/package.json index 63906f51..ca4cb21c 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -1,6 +1,6 @@ { "name": "@bull-board/ui", - "version": "6.3.3", + "version": "6.4.0", "description": "A Dashboard UI built on top of bull or bullmq.", "keywords": [ "bull", @@ -32,7 +32,7 @@ "gen:jsonSchema:bull": "npx ts-json-schema-generator --path '../../node_modules/bull/*.ts' --type 'Bull.JobOptions' --out './src/schemas/bull/jobOptions.json'" }, "dependencies": { - "@bull-board/api": "6.3.3" + "@bull-board/api": "6.4.0" }, "devDependencies": { "@codemirror/commands": "^6.5.0", From 6f3bdccf02e823e94f6b090e230c60479c98b267 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:33:18 +0200 Subject: [PATCH 3/9] chore(deps): bump webpack in the npm_and_yarn group across 1 directory (#848) Bumps the npm_and_yarn group with 1 update in the / directory: [webpack](https://github.com/webpack/webpack). Updates `webpack` from 5.95.0 to 5.96.1 - [Release notes](https://github.com/webpack/webpack/releases) - [Commits](https://github.com/webpack/webpack/compare/v5.95.0...v5.96.1) --- updated-dependencies: - dependency-name: webpack dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 80 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 58 insertions(+), 22 deletions(-) diff --git a/yarn.lock b/yarn.lock index 30537811..e18f9cf7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3276,10 +3276,26 @@ resolved "https://registry.yarnpkg.com/@types/ejs/-/ejs-3.1.5.tgz#49d738257cc73bafe45c13cb8ff240683b4d5117" integrity sha512-nv+GSx77ZtXiJzwKdsASqi+YQ5Z7vwHsTP0JY2SiQgjGckkBRKZnk8nIM+7oUZ1VCtuTz0+By4qVR7fqzp/Dfg== -"@types/estree@^1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4" - integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw== +"@types/eslint-scope@^3.7.7": + version "3.7.7" + resolved "https://registry.yarnpkg.com/@types/eslint-scope/-/eslint-scope-3.7.7.tgz#3108bd5f18b0cdb277c867b3dd449c9ed7079ac5" + integrity sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg== + dependencies: + "@types/eslint" "*" + "@types/estree" "*" + +"@types/eslint@*": + version "9.6.1" + resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-9.6.1.tgz#d5795ad732ce81715f27f75da913004a56751584" + integrity sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag== + dependencies: + "@types/estree" "*" + "@types/json-schema" "*" + +"@types/estree@*", "@types/estree@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.6.tgz#628effeeae2064a1b4e79f78e81d87b7e5fc7b50" + integrity sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw== "@types/express-serve-static-core@^4.17.28", "@types/express-serve-static-core@^4.17.33": version "4.17.36" @@ -3412,7 +3428,7 @@ jest-matcher-utils "^27.0.0" pretty-format "^27.0.0" -"@types/json-schema@^7.0.12": +"@types/json-schema@*", "@types/json-schema@^7.0.12": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== @@ -3563,7 +3579,7 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== -"@types/react-dom@^17.0.14": +"@types/react-dom@17.0.20", "@types/react-dom@^17.0.14": version "17.0.20" resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.20.tgz#e0c8901469d732b36d8473b40b679ad899da1b53" integrity sha512-4pzIjSxDueZZ90F52mU3aPoogkHIoSIDG+oQ+wQK7Cy2B9S+MvOqY0uEA/qawKz381qrEDkvpwyt8Bm31I8sbA== @@ -3594,7 +3610,7 @@ "@types/history" "^4.7.11" "@types/react" "*" -"@types/react@*", "@types/react@^17", "@types/react@^17.0.14": +"@types/react@*", "@types/react@17.0.63", "@types/react@^17", "@types/react@^17.0.14": version "17.0.63" resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.63.tgz#78ca41a34b1e4fd5ba9398d33bc78a81bfd5c180" integrity sha512-T+aaG8RlIkgJ4VzWLJYbMW9QX7sIAV8CcuyV6FU6Hm7yu3Bee1YBZQRu2vYEm/dU8kre+/mzl2aGYh5MFgVLaQ== @@ -3935,11 +3951,6 @@ accepts@^1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" -acorn-import-attributes@^1.9.5: - version "1.9.5" - resolved "https://registry.yarnpkg.com/acorn-import-attributes/-/acorn-import-attributes-1.9.5.tgz#7eb1557b1ba05ef18b5ed0ec67591bfab04688ef" - integrity sha512-n02Vykv5uA3eHGM/Z2dQrcD56kL8TyDb2p1+0P83PClMnC/nc+anbQRhIOWnSq4Ke/KvDPrY3C9hDtC/A3eHnQ== - acorn-jsx@^5.3.1: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" @@ -3955,7 +3966,12 @@ acorn@^7.4.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.4.1, acorn@^8.7.0, acorn@^8.7.1, acorn@^8.8.2: +acorn@^8.14.0: + version "8.14.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.14.0.tgz#063e2c70cac5fb4f6467f0b11152e04c682795b0" + integrity sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA== + +acorn@^8.4.1, acorn@^8.7.0, acorn@^8.8.2: version "8.11.2" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b" integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w== @@ -4545,7 +4561,7 @@ braces@^3.0.3, braces@~3.0.2: dependencies: fill-range "^7.1.1" -browserslist@^4.21.10, browserslist@^4.21.9: +browserslist@^4.21.9: version "4.21.10" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.21.10.tgz#dbbac576628c13d3b2231332cb2ec5a46e015bb0" integrity sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ== @@ -4565,6 +4581,16 @@ browserslist@^4.23.1: node-releases "^2.0.18" update-browserslist-db "^1.1.0" +browserslist@^4.24.0: + version "4.24.2" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.24.2.tgz#f5845bc91069dbd55ee89faf9822e1d885d16580" + integrity sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg== + dependencies: + caniuse-lite "^1.0.30001669" + electron-to-chromium "^1.5.41" + node-releases "^2.0.18" + update-browserslist-db "^1.1.1" + bs-logger@0.x: version "0.2.6" resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" @@ -4763,6 +4789,11 @@ caniuse-lite@^1.0.30001616, caniuse-lite@^1.0.30001663: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001667.tgz#99fc5ea0d9c6e96897a104a8352604378377f949" integrity sha512-7LTwJjcRkzKFmtqGsibMeuXmvFDfZq/nzIjnmgCGzKKRVzjD72selLDK1oPF/Oxzmt4fNcPvTDvGqSDG4tCALw== +caniuse-lite@^1.0.30001669: + version "1.0.30001680" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz#5380ede637a33b9f9f1fc6045ea99bd142f3da5e" + integrity sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA== + caseless@~0.12.0: version "0.12.0" resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" @@ -5781,6 +5812,11 @@ electron-to-chromium@^1.5.28: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.35.tgz#1d38d386186c72b1fa6e74c3a7de5f888b503100" integrity sha512-hOSRInrIDm0Brzp4IHW2F/VM+638qOL2CzE0DgpnGzKW27C95IqqeqgKz/hxHGnvPxvQGpHUGD5qRVC9EZY2+A== +electron-to-chromium@^1.5.41: + version "1.5.56" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.56.tgz#3213f369efc3a41091c3b2c05bc0f406108ac1df" + integrity sha512-7lXb9dAvimCFdvUMTyucD4mnIndt/xhRKFAlky0CyFogdnNmdPQNoHI23msF/2V4mpTxMzgMdjK4+YRlFlRQZw== + emittery@^0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" @@ -12778,7 +12814,7 @@ update-browserslist-db@^1.0.11: escalade "^3.1.1" picocolors "^1.0.0" -update-browserslist-db@^1.1.0: +update-browserslist-db@^1.1.0, update-browserslist-db@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz#80846fba1d79e82547fb661f8d141e0945755fe5" integrity sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A== @@ -13037,17 +13073,17 @@ webpack-sources@^3.2.3: integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== webpack@^5.94.0: - version "5.95.0" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.95.0.tgz#8fd8c454fa60dad186fbe36c400a55848307b4c0" - integrity sha512-2t3XstrKULz41MNMBF+cJ97TyHdyQ8HCt//pqErqDvNjU9YQBnZxIHa11VXsi7F3mb5/aO2tuDxdeTPdU7xu9Q== + version "5.96.1" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.96.1.tgz#3676d1626d8312b6b10d0c18cc049fba7ac01f0c" + integrity sha512-l2LlBSvVZGhL4ZrPwyr8+37AunkcYj5qh8o6u2/2rzoPc8gxFJkLj1WxNgooi9pnoc06jh0BjuXnamM4qlujZA== dependencies: - "@types/estree" "^1.0.5" + "@types/eslint-scope" "^3.7.7" + "@types/estree" "^1.0.6" "@webassemblyjs/ast" "^1.12.1" "@webassemblyjs/wasm-edit" "^1.12.1" "@webassemblyjs/wasm-parser" "^1.12.1" - acorn "^8.7.1" - acorn-import-attributes "^1.9.5" - browserslist "^4.21.10" + acorn "^8.14.0" + browserslist "^4.24.0" chrome-trace-event "^1.0.2" enhanced-resolve "^5.17.1" es-module-lexer "^1.2.1" From f07c544f58cd39932c7eff8d47c4ab058dcfefc4 Mon Sep 17 00:00:00 2001 From: Kravets <57632712+kravetsone@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:03:40 +0300 Subject: [PATCH 4/9] Add elysia adapter (#769) * feat: add elysia adapter * chore: use typings from dist and remove Promise * chore: improve package and README * chore: improve elysia example * chore: use skipLibCheck (https://github.com/oven-sh/bun/issues/8761) * change: author at package * chore: bumps --- README.md | 96 +++--- examples/with-elysia/README.md | 3 + examples/with-elysia/index.ts | 64 ++++ examples/with-elysia/package.json | 18 ++ examples/with-elysia/tsconfig.json | 15 + examples/with-elysia/yarn.lock | 427 +++++++++++++++++++++++++++ packages/api/tsconfig.json | 3 +- packages/elysia/README.md | 29 ++ packages/elysia/package.json | 53 ++++ packages/elysia/src/ElysiaAdapter.ts | 180 +++++++++++ packages/elysia/src/index.ts | 1 + packages/elysia/tsconfig.json | 25 ++ packages/express/tsconfig.json | 3 +- packages/fastify/tsconfig.json | 3 +- packages/hapi/tsconfig.json | 3 +- packages/hono/tsconfig.json | 3 +- packages/koa/tsconfig.json | 3 +- packages/ui/tsconfig.json | 3 +- tsconfig.json | 3 +- yarn.lock | 79 ++++- 20 files changed, 957 insertions(+), 57 deletions(-) create mode 100644 examples/with-elysia/README.md create mode 100644 examples/with-elysia/index.ts create mode 100644 examples/with-elysia/package.json create mode 100644 examples/with-elysia/tsconfig.json create mode 100644 examples/with-elysia/yarn.lock create mode 100644 packages/elysia/README.md create mode 100644 packages/elysia/package.json create mode 100644 packages/elysia/src/ElysiaAdapter.ts create mode 100644 packages/elysia/src/index.ts create mode 100644 packages/elysia/tsconfig.json diff --git a/README.md b/README.md index bdec214e..9961af9d 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ With this library you get a beautiful UI for visualizing what's happening with e ## Packages | Name | Version | -|--------------------------------------------------------------------------|-------------------------------------------------------------------| +| ------------------------------------------------------------------------ | ----------------------------------------------------------------- | | [@bull-board/api](https://www.npmjs.com/package/@bull-board/api) | ![npm (scoped)](https://img.shields.io/npm/v/@bull-board/api) | | [@bull-board/ui](https://www.npmjs.com/package/@bull-board/ui) | ![npm (scoped)](https://img.shields.io/npm/v/@bull-board/ui) | | [@bull-board/express](https://www.npmjs.com/package/@bull-board/express) | ![npm (scoped)](https://img.shields.io/npm/v/@bull-board/express) | @@ -29,6 +29,7 @@ With this library you get a beautiful UI for visualizing what's happening with e | [@bull-board/nestjs](https://www.npmjs.com/package/@bull-board/nestjs) | ![npm (scoped)](https://img.shields.io/npm/v/@bull-board/nestjs) | | [@bull-board/hono](https://www.npmjs.com/package/@bull-board/hono) | ![npm (scoped)](https://img.shields.io/npm/v/@bull-board/hono) | | [@bull-board/h3](https://www.npmjs.com/package/@bull-board/h3) | ![npm (scoped)](https://img.shields.io/npm/v/@bull-board/h3) | +| [@bull-board/elysia](https://www.npmjs.com/package/@bull-board/elysia) | ![npm (scoped)](https://img.shields.io/npm/v/@bull-board/elysia) | ## Notes @@ -59,9 +60,12 @@ yarn add @bull-board/nestjs yarn add @bull-board/hono # or yarn add @bull-board/h3 +# or +bun add @bull-board/elysia ``` ### NestJS specific setup + @bull-board provides a module for easy integration with NestJS, for reference on how to use the module refer to the [NestJS Module](https://github.com/felixmosh/bull-board/tree/master/packages/nestjs) package ## Hello World @@ -104,8 +108,8 @@ app.listen(3000, () => { That's it! Now you can access the `/admin/queues` route, and you will be able to monitor everything that is happening in your queues 😁 - For more advanced usages check the `examples` folder, currently it contains: + 1. [Basic authentication example](https://github.com/felixmosh/bull-board/tree/master/examples/with-express-auth) 2. [Multiple instance of the board](https://github.com/felixmosh/bull-board/tree/master/examples/with-multiple-instances) 3. [With Fastify server](https://github.com/felixmosh/bull-board/tree/master/examples/with-fastify) @@ -114,23 +118,24 @@ For more advanced usages check the `examples` folder, currently it contains: 6. [With Nest.js server using the built-in module](https://github.com/felixmosh/bull-board/tree/master/examples/with-nestjs-module) (Thanx to @dennissnijder) 7. [With Nest.js server using the express adapter](https://github.com/felixmosh/bull-board/tree/master/examples/with-nestjs) (Thanx to @lodi-g) 8. [With Hono server](https://github.com/felixmosh/bull-board/tree/master/examples/with-hono) (Thanks to @nihalgonsalves) -8. [With H3 server using the h3 adapter](https://github.com/felixmosh/bull-board/tree/master/examples/with-h3) (Thanx to @genu) - +9. [With H3 server using the h3 adapter](https://github.com/felixmosh/bull-board/tree/master/examples/with-h3) (Thanx to @genu) +10. [With Elysia server using the Elysia adapter](https://github.com/felixmosh/bull-board/tree/master/examples/with-elysia) (Thanx to @genu) ### Board options + 1. `uiConfig.boardTitle` (default: `Bull Dashboard`) -The Board and page titles + The Board and page titles 2. `uiConfig.boardLogo` (default: `empty`) `{ path: string; width?: number | string; height?: number | string }` -An object that allows you to specify a different logo + An object that allows you to specify a different logo 3. `uiConfig.miscLinks` (default: `empty`) `Array< { text: string; url: string }>` -An array of misc link that you can add to the dashboard, such as logout link. + An array of misc link that you can add to the dashboard, such as logout link. 4. uiConfig.favIcon (default: `{ default: 'static/images/logo.svg', alternative: 'static/favicon-32x32.png', }`) `{ default: string; alternative: 'string' }` -An object that allows you to specify the default and alternative favicons. + An object that allows you to specify the default and alternative favicons. ```js const QueueMQ = require('bullmq'); -const {createBullBoard} = require('@bull-board/api'); -const {BullMQAdapter} = require('@bull-board/api/bullMQAdapter'); +const { createBullBoard } = require('@bull-board/api'); +const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); const queueMQ = new QueueMQ(); @@ -145,7 +150,7 @@ createBullBoard({ width: '100px', height: 200, }, - miscLinks: [{text: 'Logout', url: '/logout'}], + miscLinks: [{ text: 'Logout', url: '/logout' }], favIcon: { default: 'static/images/logo.svg', alternative: 'static/favicon-32x32.png', @@ -156,45 +161,46 @@ createBullBoard({ ``` ### Queue options + 1. `readOnlyMode` (default: `false`) -Makes the UI as read only, hides all queue & job related actions + Makes the UI as read only, hides all queue & job related actions ```js -const Queue = require('bull') -const QueueMQ = require('bullmq') -const { createBullBoard } = require('@bull-board/api') -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter') -const { BullAdapter } = require('@bull-board/api/bullAdapter') +const Queue = require('bull'); +const QueueMQ = require('bullmq'); +const { createBullBoard } = require('@bull-board/api'); +const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); +const { BullAdapter } = require('@bull-board/api/bullAdapter'); -const someQueue = new Queue() -const queueMQ = new QueueMQ() +const someQueue = new Queue(); +const queueMQ = new QueueMQ(); createBullBoard({ queues: [ new BullAdapter(someQueue, { readOnlyMode: true }), // only this queue will be in read only mode new BullMQAdapter(queueMQ, { readOnlyMode: true }), - ] -}) + ], +}); ``` 2. `allowRetries` (default: `true`) -When set to `false` the UI removes the job retry buttons for a queue. This option will be ignored if `readOnlyMode` is `true`. + When set to `false` the UI removes the job retry buttons for a queue. This option will be ignored if `readOnlyMode` is `true`. ```js -const QueueMQ = require('bullmq') -const { createBullBoard } = require('@bull-board/api') -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter') -const { BullAdapter } = require('@bull-board/api/bullAdapter') +const QueueMQ = require('bullmq'); +const { createBullBoard } = require('@bull-board/api'); +const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); +const { BullAdapter } = require('@bull-board/api/bullAdapter'); -const someQueue = new Queue() -const queueMQ = new QueueMQ() +const someQueue = new Queue(); +const queueMQ = new QueueMQ(); createBullBoard({ queues: [ new BullAdapter(someQueue, { allowRetries: false }), // No retry buttons new BullMQAdapter(queueMQ, { allowRetries: true, readOnlyMode: true }), // allowRetries will be ignored in this case in lieu of readOnlyMode - ] -}) + ], +}); ``` 3. `description` (default: `empty`) @@ -212,18 +218,18 @@ const { createBullBoard } = require('@bull-board/api'); const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); const redact = fastRedact({ - paths: ['headers.cookie', 'password', 'access_token'] -}) + paths: ['headers.cookie', 'password', 'access_token'], +}); -const queueMQ = new QueueMQ() +const queueMQ = new QueueMQ(); const queueAdapter = new BullMQAdapter(queueMQ); queueAdapter.setFormatter('name', (job) => `#Queue1 - ${job.name}`); queueAdapter.setFormatter('data', (data) => redact(data)); queueAdapter.setFormatter('returnValue', (returnValue) => redact(returnValue)); createBullBoard({ - queues: [queueAdapter] -}) + queues: [queueAdapter], +}); ``` ### Hosting router on a sub path @@ -231,23 +237,21 @@ createBullBoard({ If you host your express service on a different path than root (/) ie. https:////, then you can add the following code to provide the configuration to the bull-board router. In this example the sub path will be `my-base-path`. ```js -const Queue = require('bull') -const { createBullBoard } = require('@bull-board/api') -const { BullAdapter } = require('@bull-board/api/bullAdapter') -const { ExpressAdapter } = require('@bull-board/express') +const Queue = require('bull'); +const { createBullBoard } = require('@bull-board/api'); +const { BullAdapter } = require('@bull-board/api/bullAdapter'); +const { ExpressAdapter } = require('@bull-board/express'); const basePath = '/my-base-path'; -const someQueue = new Queue('someQueueName') +const someQueue = new Queue('someQueueName'); const serverAdapter = new ExpressAdapter(); -serverAdapter.setBasePath(basePath) +serverAdapter.setBasePath(basePath); createBullBoard({ - queues: [ - new BullAdapter(someQueue), - ], - serverAdapter -}) + queues: [new BullAdapter(someQueue)], + serverAdapter, +}); // ... express server configuration diff --git a/examples/with-elysia/README.md b/examples/with-elysia/README.md new file mode 100644 index 00000000..b6c4895a --- /dev/null +++ b/examples/with-elysia/README.md @@ -0,0 +1,3 @@ +# Elysia example + +This example shows how to use [Elysia](https://elysiajs.com/) as a server for bull-board. diff --git a/examples/with-elysia/index.ts b/examples/with-elysia/index.ts new file mode 100644 index 00000000..45a88005 --- /dev/null +++ b/examples/with-elysia/index.ts @@ -0,0 +1,64 @@ +import { createBullBoard } from "@bull-board/api"; +import { BullMQAdapter } from "@bull-board/api/bullMQAdapter"; +import { ElysiaAdapter } from "@bull-board/elysia"; +import { Queue as QueueMQ, Worker } from "bullmq"; +import Elysia from "elysia"; + +const sleep = (t: number) => + new Promise((resolve) => setTimeout(resolve, t * 1000)); + +const redisOptions = { + port: 6379, + host: "localhost", + password: "", +}; + +const createQueueMQ = (name: string) => + new QueueMQ(name, { connection: redisOptions }); + +async function setupBullMQProcessor(queueName: string) { + new Worker( + queueName, + async (job) => { + for (let i = 0; i <= 100; i++) { + await sleep(Math.random()); + await job.updateProgress(i); + await job.log(`Processing job at interval ${i}`); + + if (Math.random() * 200 < 1) throw new Error(`Random error ${i}`); + } + + return { jobId: `This is the return value of job (${job.id})` }; + }, + { connection: redisOptions }, + ); +} + +const exampleBullMq = createQueueMQ("BullMQ"); + +await setupBullMQProcessor(exampleBullMq.name); + +const serverAdapter = new ElysiaAdapter("/ui"); + +createBullBoard({ + queues: [new BullMQAdapter(exampleBullMq)], + serverAdapter, +}); + +const app = new Elysia() + .use(serverAdapter.registerPlugin()) + .get("/add", async ({ query }) => { + await exampleBullMq.add("Add", { title: query.title }); + + return { ok: true }; + }); + +app.listen(3000, ({ port, url }) => { + /* eslint-disable no-console */ + console.log(`Running on ${url.hostname}:${port}...`); + console.log(`For the UI of instance1, open http://localhost:${port}/ui`); + console.log("Make sure Redis is running on port 6379 by default"); + console.log("To populate the queue, run:"); + console.log(` curl http://localhost:${port}/add?title=Example`); + /* eslint-enable no-console */ +}); diff --git a/examples/with-elysia/package.json b/examples/with-elysia/package.json new file mode 100644 index 00000000..7ee14149 --- /dev/null +++ b/examples/with-elysia/package.json @@ -0,0 +1,18 @@ +{ + "name": "bull-board-with-elysia", + "type": "module", + "version": "1.0.0", + "description": "Example of how to use Elysia server with bull-board", + "module": "index.ts", + "scripts": { + "start": "bun index.ts", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "kravetsone", + "license": "ISC", + "dependencies": { + "@bull-board/elysia": "^5.20.1", + "bullmq": "^4.6.0", + "elysia": "^1.0.22" + } +} diff --git a/examples/with-elysia/tsconfig.json b/examples/with-elysia/tsconfig.json new file mode 100644 index 00000000..4c4b6f9b --- /dev/null +++ b/examples/with-elysia/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "lib": ["ESNext"], + "module": "ESNext", + "target": "ESNext", + "moduleResolution": "Bundler", + "esModuleInterop": true, + "strict": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "rootDir": "./src", + "noEmit": true + }, + "include": ["src"] +} diff --git a/examples/with-elysia/yarn.lock b/examples/with-elysia/yarn.lock new file mode 100644 index 00000000..fde012bb --- /dev/null +++ b/examples/with-elysia/yarn.lock @@ -0,0 +1,427 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@bull-board/api@5.20.1": + version "5.20.1" + resolved "https://registry.yarnpkg.com/@bull-board/api/-/api-5.20.1.tgz#826567731aeea8ce006aa6f5ea0d1d7cc2f5a7a7" + integrity sha512-45aDhnOzWRrtUUAKHxdClSnLIus5f8BK3ATzb2IwI/BRgOi1lWTe1YG266hVqDdWXsUDxKzf75DAANKfAoEsRA== + dependencies: + redis-info "^3.0.8" + +"@bull-board/elysia@../../packages/elysia": + version "5.20.1" + dependencies: + "@bull-board/api" "5.20.1" + "@bull-board/ui" "5.20.1" + "@elysiajs/static" "^1.0.3" + ejs "^3.1.10" + +"@bull-board/ui@5.20.1": + version "5.20.1" + resolved "https://registry.yarnpkg.com/@bull-board/ui/-/ui-5.20.1.tgz#bf05cd6e1c1e7010baf49b4f0353c03a81cc44f3" + integrity sha512-RzNinC4FKHNuxzkIRsCL+n9iO5RxmF5YM7byCuuv1/UeFjtCtsLHFi6TI9ZgJsXETA2Uxq9Mg7ppncojUjrINw== + dependencies: + "@bull-board/api" "5.20.1" + +"@elysiajs/static@^1.0.3": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@elysiajs/static/-/static-1.0.3.tgz#0175a14762aecf1e0250b7bd961616e645cbafa3" + integrity sha512-+oMDfqRC8OFgzsrHQBUjlMHTUqYAyFpq3HPaHochgs9a+i/SBKfX6Ow4kepBIOMTlf43knw3wfHu6sEVsXzLRw== + dependencies: + node-cache "^5.1.2" + +"@ioredis/commands@^1.1.1": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ioredis/commands/-/commands-1.2.0.tgz#6d61b3097470af1fdbbe622795b8921d42018e11" + integrity sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg== + +"@msgpackr-extract/msgpackr-extract-darwin-arm64@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.3.tgz#9edec61b22c3082018a79f6d1c30289ddf3d9d11" + integrity sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw== + +"@msgpackr-extract/msgpackr-extract-darwin-x64@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.3.tgz#33677a275204898ad8acbf62734fc4dc0b6a4855" + integrity sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw== + +"@msgpackr-extract/msgpackr-extract-linux-arm64@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.3.tgz#19edf7cdc2e7063ee328403c1d895a86dd28f4bb" + integrity sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg== + +"@msgpackr-extract/msgpackr-extract-linux-arm@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.3.tgz#94fb0543ba2e28766c3fc439cabbe0440ae70159" + integrity sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw== + +"@msgpackr-extract/msgpackr-extract-linux-x64@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.3.tgz#4a0609ab5fe44d07c9c60a11e4484d3c38bbd6e3" + integrity sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg== + +"@msgpackr-extract/msgpackr-extract-win32-x64@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.3.tgz#0aa5502d547b57abfc4ac492de68e2006e417242" + integrity sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ== + +"@sinclair/typebox@^0.32.15": + version "0.32.32" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.32.32.tgz#e12172fe394e7adc868c62354f4f677e3196630e" + integrity sha512-m+A3zFSI87TCtoz6vQCSnd+t/kDKL78JmzhKYkON+7SnHSa+794qraIVpm6ozFGK+5svnVOt1LJ7BUEhGkIvgg== + +ansi-styles@^4.1.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +async@^3.2.3: + version "3.2.5" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66" + integrity sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg== + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +brace-expansion@^1.1.7: + version "1.1.11" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" + integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== + dependencies: + balanced-match "^1.0.0" + concat-map "0.0.1" + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +bullmq@^4.6.0: + version "4.17.0" + resolved "https://registry.yarnpkg.com/bullmq/-/bullmq-4.17.0.tgz#f8f61bea80fb72ab690c1e926de0464f3222f1ea" + integrity sha512-URnHgB01rlCP8RTpmW3kFnvv3vdd2aI1OcBMYQwnqODxGiJUlz9MibDVXE83mq7ee1eS1IvD9lMQqGszX6E5Pw== + dependencies: + cron-parser "^4.6.0" + glob "^8.0.3" + ioredis "^5.3.2" + lodash "^4.17.21" + msgpackr "^1.6.2" + node-abort-controller "^3.1.1" + semver "^7.5.4" + tslib "^2.0.0" + uuid "^9.0.0" + +chalk@^4.0.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" + integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + +clone@2.x: + version "2.1.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" + integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== + +cluster-key-slot@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz#88ddaa46906e303b5de30d3153b7d9fe0a0c19ac" + integrity sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA== + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +concat-map@0.0.1: + version "0.0.1" + resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== + +cookie@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" + integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== + +cron-parser@^4.6.0: + version "4.9.0" + resolved "https://registry.yarnpkg.com/cron-parser/-/cron-parser-4.9.0.tgz#0340694af3e46a0894978c6f52a6dbb5c0f11ad5" + integrity sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q== + dependencies: + luxon "^3.2.1" + +debug@^4.3.4: + version "4.3.5" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" + integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== + dependencies: + ms "2.1.2" + +denque@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" + integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== + +detect-libc@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" + integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== + +ejs@^3.1.10: + version "3.1.10" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b" + integrity sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA== + dependencies: + jake "^10.8.5" + +elysia@^1.0.22: + version "1.0.23" + resolved "https://registry.yarnpkg.com/elysia/-/elysia-1.0.23.tgz#6ace54f28c4018219734dd4feef27cd38bd65a65" + integrity sha512-484cI3C9bHGMVHuYxvz2qXMOonVix+1AyD1LI0Mgyh+XVDIL4nKqksW/rsyIs7wkfFbt0bz5XbxaOblqBwiXSQ== + dependencies: + "@sinclair/typebox" "^0.32.15" + cookie "^0.6.0" + eventemitter3 "^5.0.1" + fast-decode-uri-component "^1.0.1" + fast-querystring "^1.1.2" + openapi-types "^12.1.3" + +eventemitter3@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" + integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== + +fast-decode-uri-component@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz#46f8b6c22b30ff7a81357d4f59abfae938202543" + integrity sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg== + +fast-querystring@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/fast-querystring/-/fast-querystring-1.1.2.tgz#a6d24937b4fc6f791b4ee31dcb6f53aeafb89f53" + integrity sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg== + dependencies: + fast-decode-uri-component "^1.0.1" + +filelist@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.4.tgz#f78978a1e944775ff9e62e744424f215e58352b5" + integrity sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q== + dependencies: + minimatch "^5.0.1" + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + +glob@^8.0.3: + version "8.1.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.1.0.tgz#d388f656593ef708ee3e34640fdfb99a9fd1c33e" + integrity sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +ioredis@^5.3.2: + version "5.4.1" + resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.4.1.tgz#1c56b70b759f01465913887375ed809134296f40" + integrity sha512-2YZsvl7jopIa1gaePkeMtd9rAcSjOOjPtpcLlOeusyO+XH2SK5ZcT+UCrElPP+WVIInh2TzeI4XW9ENaSLVVHA== + dependencies: + "@ioredis/commands" "^1.1.1" + cluster-key-slot "^1.1.0" + debug "^4.3.4" + denque "^2.1.0" + lodash.defaults "^4.2.0" + lodash.isarguments "^3.1.0" + redis-errors "^1.2.0" + redis-parser "^3.0.0" + standard-as-callback "^2.1.0" + +jake@^10.8.5: + version "10.9.1" + resolved "https://registry.yarnpkg.com/jake/-/jake-10.9.1.tgz#8dc96b7fcc41cb19aa502af506da4e1d56f5e62b" + integrity sha512-61btcOHNnLnsOdtLgA5efqQWjnSi/vow5HbI7HMdKKWqvrKR1bLK3BPlJn9gcSaP2ewuamUSMB5XEy76KUIS2w== + dependencies: + async "^3.2.3" + chalk "^4.0.2" + filelist "^1.0.4" + minimatch "^3.1.2" + +lodash.defaults@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" + integrity sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ== + +lodash.isarguments@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + integrity sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg== + +lodash@^4.17.11, lodash@^4.17.21: + version "4.17.21" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" + integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== + +luxon@^3.2.1: + version "3.4.4" + resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.4.4.tgz#cf20dc27dc532ba41a169c43fdcc0063601577af" + integrity sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA== + +minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^5.0.1: + version "5.1.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" + integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== + dependencies: + brace-expansion "^2.0.1" + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +msgpackr-extract@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/msgpackr-extract/-/msgpackr-extract-3.0.3.tgz#e9d87023de39ce714872f9e9504e3c1996d61012" + integrity sha512-P0efT1C9jIdVRefqjzOQ9Xml57zpOXnIuS+csaB4MdZbTdmGDLo8XhzBG1N7aO11gKDDkJvBLULeFTo46wwreA== + dependencies: + node-gyp-build-optional-packages "5.2.2" + optionalDependencies: + "@msgpackr-extract/msgpackr-extract-darwin-arm64" "3.0.3" + "@msgpackr-extract/msgpackr-extract-darwin-x64" "3.0.3" + "@msgpackr-extract/msgpackr-extract-linux-arm" "3.0.3" + "@msgpackr-extract/msgpackr-extract-linux-arm64" "3.0.3" + "@msgpackr-extract/msgpackr-extract-linux-x64" "3.0.3" + "@msgpackr-extract/msgpackr-extract-win32-x64" "3.0.3" + +msgpackr@^1.6.2: + version "1.10.2" + resolved "https://registry.yarnpkg.com/msgpackr/-/msgpackr-1.10.2.tgz#a73de4767f76659e8c69cf9c80fdfce83937a44a" + integrity sha512-L60rsPynBvNE+8BWipKKZ9jHcSGbtyJYIwjRq0VrIvQ08cRjntGXJYW/tmciZ2IHWIY8WEW32Qa2xbh5+SKBZA== + optionalDependencies: + msgpackr-extract "^3.0.2" + +node-abort-controller@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548" + integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== + +node-cache@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/node-cache/-/node-cache-5.1.2.tgz#f264dc2ccad0a780e76253a694e9fd0ed19c398d" + integrity sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg== + dependencies: + clone "2.x" + +node-gyp-build-optional-packages@5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz#522f50c2d53134d7f3a76cd7255de4ab6c96a3a4" + integrity sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw== + dependencies: + detect-libc "^2.0.1" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +openapi-types@^12.1.3: + version "12.1.3" + resolved "https://registry.yarnpkg.com/openapi-types/-/openapi-types-12.1.3.tgz#471995eb26c4b97b7bd356aacf7b91b73e777dd3" + integrity sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw== + +redis-errors@^1.0.0, redis-errors@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad" + integrity sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w== + +redis-info@^3.0.8: + version "3.1.0" + resolved "https://registry.yarnpkg.com/redis-info/-/redis-info-3.1.0.tgz#5e349c8720e82d27ac84c73136dce0931e10469a" + integrity sha512-ER4L9Sh/vm63DkIE0bkSjxluQlioBiBgf5w1UuldaW/3vPcecdljVDisZhmnCMvsxHNiARTTDDHGg9cGwTfrKg== + dependencies: + lodash "^4.17.11" + +redis-parser@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-3.0.0.tgz#b66d828cdcafe6b4b8a428a7def4c6bcac31c8b4" + integrity sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A== + dependencies: + redis-errors "^1.0.0" + +semver@^7.5.4: + version "7.6.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" + integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== + +standard-as-callback@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.1.0.tgz#8953fc05359868a77b5b9739a665c5977bb7df45" + integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A== + +supports-color@^7.1.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + +tslib@^2.0.0: + version "2.6.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" + integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== + +uuid@^9.0.0: + version "9.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 8233d290..90aef305 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -12,7 +12,8 @@ "noUnusedParameters": true, "noUnusedLocals": true, "resolveJsonModule": true, - "declaration": true + "declaration": true, + "skipLibCheck": true }, "include": ["./src", "./typings/*.ts"] } diff --git a/packages/elysia/README.md b/packages/elysia/README.md new file mode 100644 index 00000000..a00581c9 --- /dev/null +++ b/packages/elysia/README.md @@ -0,0 +1,29 @@ +# @bull-board @bull-board/elysia + +[Elysia](https://github.com/elysiajs/elysia) server adapter for `bull-board`. + +

+ + npm version + + + npm downloads + + + licence + +

+ +![Overview](https://raw.githubusercontent.com/felixmosh/bull-board/master/screenshots/overview.png) +![UI](https://raw.githubusercontent.com/felixmosh/bull-board/master/screenshots/dashboard.png) + +# Usage examples + +1. [Simple Elysia setup](https://github.com/felixmosh/bull-board/tree/master/examples/with-elysia) + +For more info visit the main [README](https://github.com/felixmosh/bull-board#readme) + +### Authors + +- [@kravetsone](https://github.com/kravetsone) - author of this adapter +- [@felixmosh](https://github.com/felixmosh) - author of bull board core diff --git a/packages/elysia/package.json b/packages/elysia/package.json new file mode 100644 index 00000000..b6fe5d9b --- /dev/null +++ b/packages/elysia/package.json @@ -0,0 +1,53 @@ +{ + "name": "@bull-board/elysia", + "type": "commonjs", + "version": "5.20.1", + "description": "A Elysia server adapter for Bull-Board dashboard.", + "keywords": [ + "bull", + "bullmq", + "redis", + "elysia", + "elysia-plugin", + "adapter", + "queue", + "monitoring", + "dashboard" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/felixmosh/bull-board.git", + "directory": "packages/elysia" + }, + "license": "MIT", + "author": { + "name": "kravetsone", + "url": "https://github.com/kravetsone" + }, + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "files": [ + "dist" + ], + "scripts": { + "build": "tsc", + "clean": "rm -rf dist" + }, + "dependencies": { + "@bull-board/api": "6.3.3", + "@bull-board/ui": "6.3.3", + "@elysiajs/static": "^1.1.1", + "ejs": "^3.1.10" + }, + "peerDependencies": { + "elysia": "^1.0.22" + }, + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "@types/bun": "^1.1.13", + "@types/ejs": "^3.1.5", + "elysia": "^1.1.24" + } +} diff --git a/packages/elysia/src/ElysiaAdapter.ts b/packages/elysia/src/ElysiaAdapter.ts new file mode 100644 index 00000000..ebdf9ddf --- /dev/null +++ b/packages/elysia/src/ElysiaAdapter.ts @@ -0,0 +1,180 @@ +import type { + AppControllerRoute, + AppViewRoute, + BullBoardQueues, + ControllerHandlerReturnType, + HTTPMethod, + IServerAdapter, + UIConfig, +} from "@bull-board/api/dist/typings/app"; +import staticPlugin from "@elysiajs/static"; +import ejs from "ejs"; +import { Elysia } from "elysia"; + +export class ElysiaAdapter implements IServerAdapter { + private plugin: Elysia; + private basePath = ""; + + constructor(basePath = "") { + this.basePath = basePath; + this.plugin = new Elysia({ + name: "@bull-board/elysia", + prefix: basePath, + }); + } + + private entryRoute: AppViewRoute | undefined; + private statics: { path: string; route: string } | undefined; + private bullBoardQueues: BullBoardQueues | undefined; + private viewPath: string | undefined; + private uiConfig: UIConfig = {}; + + public setStaticPath( + staticsRoute: string, + staticsPath: string, + ): ElysiaAdapter { + this.statics = { route: staticsRoute, path: staticsPath }; + + return this; + } + + public setViewsPath(viewPath: string): ElysiaAdapter { + this.viewPath = viewPath; + + return this; + } + + public setErrorHandler( + handler: (error: Error) => ControllerHandlerReturnType, + ) { + this.plugin.onError(({ error, set }) => { + const response = handler(error); + set.status = response.status || 500; + + return response.body; + }); + + return this; + } + + public setApiRoutes(routes: AppControllerRoute[]): ElysiaAdapter { + for (const { route, handler, method } of routes) { + const methods = Array.isArray(method) ? method : [method]; + + for (const method of methods) { + this.registerRoute(route, method, handler); + } + } + + return this; + } + + public setEntryRoute(routeDef: AppViewRoute): ElysiaAdapter { + this.entryRoute = routeDef; + + return this; + } + + public setQueues(bullBoardQueues: BullBoardQueues): ElysiaAdapter { + this.bullBoardQueues = bullBoardQueues; + return this; + } + + public setUIConfig(config: UIConfig = {}): ElysiaAdapter { + this.uiConfig = config; + + return this; + } + + public registerPlugin() { + if (!this.statics) { + throw new Error( + `Please call 'setStaticPath' before using 'registerHandlers'`, + ); + } + if (!this.entryRoute) { + throw new Error( + `Please call 'setEntryRoute' before using 'registerHandlers'`, + ); + } + if (!this.viewPath) { + throw new Error( + `Please call 'setViewsPath' before using 'registerHandlers'`, + ); + } + + if (!this.uiConfig) { + throw new Error( + `Please call 'setUIConfig' before using 'registerHandlers'`, + ); + } + + const { method, route, handler } = this.entryRoute; + + const routes = Array.isArray(route) ? route : [route]; + + for (const route of routes) { + this.plugin.route(method.toUpperCase(), route, async () => { + const { name: filename, params } = handler({ + basePath: this.basePath, + uiConfig: this.uiConfig, + }); + + return new Response( + await ejs.renderFile(`${this.viewPath}/${filename}`, params), + { + headers: { + "content-type": "text/html", + }, + }, + ); + }); + } + + this.plugin.use( + staticPlugin({ + prefix: this.statics.route, + assets: this.statics.path, + }), + ); + + return this.plugin; + } + + private registerRoute( + routeOrRoutes: string | string[], + method: HTTPMethod, + handler: AppControllerRoute["handler"], + ) { + const { bullBoardQueues } = this; + + if (!bullBoardQueues) { + throw new Error( + `Please call 'setQueues' before using 'registerHandlers'`, + ); + } + + const routes = Array.isArray(routeOrRoutes) + ? routeOrRoutes + : [routeOrRoutes]; + + for (const route of routes) { + this.plugin.route( + method.toUpperCase(), + route, + async ({ params, body, query, set }) => { + const response = await handler({ + queues: this.bullBoardQueues as BullBoardQueues, + params, + body: body as Record, + query, + }); + + if(response.status) set.status = response.status; + + return response.body; + }, + ); + } + } +} diff --git a/packages/elysia/src/index.ts b/packages/elysia/src/index.ts new file mode 100644 index 00000000..1711f391 --- /dev/null +++ b/packages/elysia/src/index.ts @@ -0,0 +1 @@ +export * from "./ElysiaAdapter"; diff --git a/packages/elysia/tsconfig.json b/packages/elysia/tsconfig.json new file mode 100644 index 00000000..231300fe --- /dev/null +++ b/packages/elysia/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "outDir": "dist", + "esModuleInterop": true, + "lib": [ + "es2019", + "DOM" + ], + "module": "CommonJS", + "moduleResolution": "node", + "noImplicitAny": true, + "sourceMap": true, + "strict": true, + "target": "es2019", + "noUnusedParameters": true, + "noUnusedLocals": true, + "resolveJsonModule": true, + "declaration": true, + "skipLibCheck": true + }, + "include": [ + "./src", + "./typings/*.d.ts" + ] +} \ No newline at end of file diff --git a/packages/express/tsconfig.json b/packages/express/tsconfig.json index e03a32cf..09fc71b6 100644 --- a/packages/express/tsconfig.json +++ b/packages/express/tsconfig.json @@ -12,7 +12,8 @@ "noUnusedParameters": true, "noUnusedLocals": true, "resolveJsonModule": true, - "declaration": true + "declaration": true, + "skipLibCheck": true }, "include": ["./src", "./typings/*.d.ts"] } diff --git a/packages/fastify/tsconfig.json b/packages/fastify/tsconfig.json index e03a32cf..09fc71b6 100644 --- a/packages/fastify/tsconfig.json +++ b/packages/fastify/tsconfig.json @@ -12,7 +12,8 @@ "noUnusedParameters": true, "noUnusedLocals": true, "resolveJsonModule": true, - "declaration": true + "declaration": true, + "skipLibCheck": true }, "include": ["./src", "./typings/*.d.ts"] } diff --git a/packages/hapi/tsconfig.json b/packages/hapi/tsconfig.json index e03a32cf..09fc71b6 100644 --- a/packages/hapi/tsconfig.json +++ b/packages/hapi/tsconfig.json @@ -12,7 +12,8 @@ "noUnusedParameters": true, "noUnusedLocals": true, "resolveJsonModule": true, - "declaration": true + "declaration": true, + "skipLibCheck": true }, "include": ["./src", "./typings/*.d.ts"] } diff --git a/packages/hono/tsconfig.json b/packages/hono/tsconfig.json index 59f5bfff..3a05cf07 100644 --- a/packages/hono/tsconfig.json +++ b/packages/hono/tsconfig.json @@ -12,7 +12,8 @@ "noUnusedParameters": true, "noUnusedLocals": true, "resolveJsonModule": true, - "declaration": true + "declaration": true, + "skipLibCheck": true }, "include": ["./src", "./typings/*.d.ts"] } diff --git a/packages/koa/tsconfig.json b/packages/koa/tsconfig.json index e03a32cf..09fc71b6 100644 --- a/packages/koa/tsconfig.json +++ b/packages/koa/tsconfig.json @@ -12,7 +12,8 @@ "noUnusedParameters": true, "noUnusedLocals": true, "resolveJsonModule": true, - "declaration": true + "declaration": true, + "skipLibCheck": true }, "include": ["./src", "./typings/*.d.ts"] } diff --git a/packages/ui/tsconfig.json b/packages/ui/tsconfig.json index f29f804a..b5786086 100644 --- a/packages/ui/tsconfig.json +++ b/packages/ui/tsconfig.json @@ -14,7 +14,8 @@ "noUnusedLocals": true, "resolveJsonModule": true, "declaration": true, - "noEmit": true + "noEmit": true, + "skipLibCheck": true }, "include": ["./src", "./typings/*.d.ts"] } diff --git a/tsconfig.json b/tsconfig.json index 99b9f092..5922b021 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,6 +11,7 @@ "noUnusedParameters": true, "noUnusedLocals": true, "resolveJsonModule": true, - "declaration": true + "declaration": true, + "skipLibCheck": true }, } diff --git a/yarn.lock b/yarn.lock index e18f9cf7..91246053 100644 --- a/yarn.lock +++ b/yarn.lock @@ -500,6 +500,13 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" +"@elysiajs/static@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@elysiajs/static/-/static-1.1.1.tgz#f6ba0406a1e9cd7614aeaad754d6481252513e72" + integrity sha512-H1KqsuNHhHKYKUkPoies0pPQBgbA4qsfre840FKraeF99jz++2P/igrOagp8cWqwFGrHP1V+nwGlGm9U6rZAEg== + dependencies: + node-cache "^5.1.2" + "@eslint-community/eslint-utils@^4.2.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" @@ -3125,6 +3132,11 @@ resolved "https://registry.yarnpkg.com/@sideway/pinpoint/-/pinpoint-2.0.0.tgz#cff8ffadc372ad29fd3f78277aeb29e632cc70df" integrity sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ== +"@sinclair/typebox@0.32.34": + version "0.32.34" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.32.34.tgz#a1c59d4df30982263cc7aa64c2c853878050838d" + integrity sha512-a3Z3ytYl6R/+7ldxx04PO1semkwWlX/8pTqxsPw4quIcIXDFPZhOc1Wx8azWmkU26ccK3mHwcWenn0avNgAKQg== + "@sinclair/typebox@^0.27.8": version "0.27.8" resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e" @@ -3236,6 +3248,13 @@ "@types/connect" "*" "@types/node" "*" +"@types/bun@^1.1.13": + version "1.1.13" + resolved "https://registry.yarnpkg.com/@types/bun/-/bun-1.1.13.tgz#a53b3a64c8f539bbe33ceb0a9f3b98c6a79a3407" + integrity sha512-KmQxSBgVWCl6RSuerlLGZlIWfdxkKqat0nxN61+qu4y1KDn0Ll3j7v1Pl8GnaL3a/U6GGWVTJh75ap62kR1E8Q== + dependencies: + bun-types "1.1.34" + "@types/co-body@^6.1.3": version "6.1.3" resolved "https://registry.yarnpkg.com/@types/co-body/-/co-body-6.1.3.tgz#201796c6389066b400cfcb4e1ec5c3db798265a2" @@ -3554,6 +3573,13 @@ dependencies: undici-types "~5.26.4" +"@types/node@~20.12.8": + version "20.12.14" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.12.14.tgz#0c5cf7ef26aedfd64b0539bba9380ed1f57dcc77" + integrity sha512-scnD59RpYD91xngrQQLGkE+6UrHUPzeKZWhhjBSa3HSkwjbQc38+q3RoIVEwxQGRw3M+j5hpNAM+lgV3cVormg== + dependencies: + undici-types "~5.26.4" + "@types/normalize-package-data@^2.4.0": version "2.4.1" resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz#d3357479a0fdfdd5907fe67e17e0a85c906e1301" @@ -3686,6 +3712,13 @@ resolved "https://registry.yarnpkg.com/@types/unist/-/unist-3.0.3.tgz#acaab0f919ce69cce629c2d4ed2eb4adc1b6c20c" integrity sha512-ko/gIFJRv177XgZsZcBwnqJN5x/Gien8qNOn0D5bQU/zAzVf9Zt3BlcUiLqhV9y4ARk0GbT3tnUiPNgnTXzc/Q== +"@types/ws@~8.5.10": + version "8.5.10" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.10.tgz#4acfb517970853fa6574a3a6886791d04a396787" + integrity sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A== + dependencies: + "@types/node" "*" + "@types/yargs-parser@*": version "21.0.0" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" @@ -4659,6 +4692,14 @@ bullmq@^4.6.0: tslib "^2.0.0" uuid "^9.0.0" +bun-types@1.1.34: + version "1.1.34" + resolved "https://registry.yarnpkg.com/bun-types/-/bun-types-1.1.34.tgz#cf0e1dc5aa8875573a3acb09bead0f23bab5aca2" + integrity sha512-br5QygTEL/TwB4uQOb96Ky22j4Gq2WxWH/8Oqv20fk5HagwKXo/akB+LiYgSfzexCt6kkcUaVm+bKiPl71xPvw== + dependencies: + "@types/node" "~20.12.8" + "@types/ws" "~8.5.10" + bundle-name@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/bundle-name/-/bundle-name-3.0.0.tgz#ba59bcc9ac785fb67ccdbf104a2bf60c099f0e1a" @@ -4962,6 +5003,11 @@ clone-deep@^4.0.1: kind-of "^6.0.2" shallow-clone "^3.0.0" +clone@2.x: + version "2.1.2" + resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" + integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== + clone@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" @@ -5314,6 +5360,11 @@ cookie@^0.6.0: resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== +cookie@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-1.0.1.tgz#e1a00d20420e0266aff817815640289eef142751" + integrity sha512-Xd8lFX4LM9QEEwxQpF9J9NTUh8pmdJO0cyRJhFiDoLTk2eH8FXlRv2IFGYVadZpqI3j8fhNrSdKCeYPxiAhLXw== + cookiejar@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/cookiejar/-/cookiejar-2.1.4.tgz#ee669c1fea2cf42dc31585469d193fef0d65771b" @@ -5808,9 +5859,19 @@ electron-to-chromium@^1.4.477: integrity sha512-FFa8QKjQK/A5QuFr2167myhMesGrhlOBD+3cYNxO9/S4XzHEXesyTD/1/xF644gC8buFPz3ca6G1LOQD0tZrrg== electron-to-chromium@^1.5.28: - version "1.5.35" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.35.tgz#1d38d386186c72b1fa6e74c3a7de5f888b503100" - integrity sha512-hOSRInrIDm0Brzp4IHW2F/VM+638qOL2CzE0DgpnGzKW27C95IqqeqgKz/hxHGnvPxvQGpHUGD5qRVC9EZY2+A== + version "1.5.55" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.55.tgz#73684752aa2e1aa49cafb355a41386c6637e76a9" + integrity sha512-6maZ2ASDOTBtjt9FhqYPRnbvKU5tjG0IN9SztUOWYw2AzNDNpKJYLJmlK0/En4Hs/aiWnB+JZ+gW19PIGszgKg== + +elysia@^1.1.24: + version "1.1.24" + resolved "https://registry.yarnpkg.com/elysia/-/elysia-1.1.24.tgz#093eeb60c8338e4e14bae33e3718b54682dbcabe" + integrity sha512-viJOb+PADrxJn7ntlQfoXsLuVgHNS09gn9dj2yroHnwqheN0hZp81WCGRQXkvh4kW5zGISX50/eqAcoNDpdL/g== + dependencies: + "@sinclair/typebox" "0.32.34" + cookie "^1.0.1" + fast-decode-uri-component "^1.0.1" + openapi-types "^12.1.3" electron-to-chromium@^1.5.41: version "1.5.56" @@ -9671,6 +9732,13 @@ node-abort-controller@^3.0.1, node-abort-controller@^3.1.1: resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548" integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== +node-cache@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/node-cache/-/node-cache-5.1.2.tgz#f264dc2ccad0a780e76253a694e9fd0ed19c398d" + integrity sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg== + dependencies: + clone "2.x" + node-domexception@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" @@ -10067,6 +10135,11 @@ open@9.1.0: is-inside-container "^1.0.0" is-wsl "^2.2.0" +openapi-types@^12.1.3: + version "12.1.3" + resolved "https://registry.yarnpkg.com/openapi-types/-/openapi-types-12.1.3.tgz#471995eb26c4b97b7bd356aacf7b91b73e777dd3" + integrity sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw== + optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" From e9aaf46a396280e985d466c99d4f206d4c6591c0 Mon Sep 17 00:00:00 2001 From: kravetsone <57632712+kravetsone@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:55:32 +0300 Subject: [PATCH 5/9] chore: support top-level await in example --- examples/with-elysia/package.json | 18 +++ examples/with-elysia/tsconfig.json | 16 ++ examples/with-elysia/yarn.lock | 210 +++++++++++++++++++++++++++ packages/elysia/src/ElysiaAdapter.ts | 180 +++++++++++++++++++++++ 4 files changed, 424 insertions(+) create mode 100644 examples/with-elysia/package.json create mode 100644 examples/with-elysia/tsconfig.json create mode 100644 examples/with-elysia/yarn.lock create mode 100644 packages/elysia/src/ElysiaAdapter.ts diff --git a/examples/with-elysia/package.json b/examples/with-elysia/package.json new file mode 100644 index 00000000..74628258 --- /dev/null +++ b/examples/with-elysia/package.json @@ -0,0 +1,18 @@ +{ + "name": "bull-board-with-elysia", + "type": "module", + "version": "1.0.0", + "description": "Example of how to use Elysia server with bull-board", + "module": "index.ts", + "scripts": { + "start": "bun index.ts", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "kravetsone", + "license": "ISC", + "dependencies": { + "@bull-board/elysia": "^5.20.1", + "bullmq": "^5.13.2", + "elysia": "^1.1.24" + } +} diff --git a/examples/with-elysia/tsconfig.json b/examples/with-elysia/tsconfig.json new file mode 100644 index 00000000..48b1d794 --- /dev/null +++ b/examples/with-elysia/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "lib": ["ESNext", "DOM"], + "module": "ESNext", + "target": "ESNext", + "moduleResolution": "Bundler", + "esModuleInterop": true, + "strict": true, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "noUncheckedIndexedAccess": true, + "verbatimModuleSyntax": true, + "rootDir": "./src", + "noEmit": true + } +} diff --git a/examples/with-elysia/yarn.lock b/examples/with-elysia/yarn.lock new file mode 100644 index 00000000..4a575e84 --- /dev/null +++ b/examples/with-elysia/yarn.lock @@ -0,0 +1,210 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@ioredis/commands@^1.1.1": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@ioredis/commands/-/commands-1.2.0.tgz#6d61b3097470af1fdbbe622795b8921d42018e11" + integrity sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg== + +"@msgpackr-extract/msgpackr-extract-darwin-arm64@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.3.tgz#9edec61b22c3082018a79f6d1c30289ddf3d9d11" + integrity sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw== + +"@msgpackr-extract/msgpackr-extract-darwin-x64@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.3.tgz#33677a275204898ad8acbf62734fc4dc0b6a4855" + integrity sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw== + +"@msgpackr-extract/msgpackr-extract-linux-arm64@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.3.tgz#19edf7cdc2e7063ee328403c1d895a86dd28f4bb" + integrity sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg== + +"@msgpackr-extract/msgpackr-extract-linux-arm@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.3.tgz#94fb0543ba2e28766c3fc439cabbe0440ae70159" + integrity sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw== + +"@msgpackr-extract/msgpackr-extract-linux-x64@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.3.tgz#4a0609ab5fe44d07c9c60a11e4484d3c38bbd6e3" + integrity sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg== + +"@msgpackr-extract/msgpackr-extract-win32-x64@3.0.3": + version "3.0.3" + resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.3.tgz#0aa5502d547b57abfc4ac492de68e2006e417242" + integrity sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ== + +"@sinclair/typebox@0.32.34": + version "0.32.34" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.32.34.tgz#a1c59d4df30982263cc7aa64c2c853878050838d" + integrity sha512-a3Z3ytYl6R/+7ldxx04PO1semkwWlX/8pTqxsPw4quIcIXDFPZhOc1Wx8azWmkU26ccK3mHwcWenn0avNgAKQg== + +bullmq@^5.13.2: + version "5.25.6" + resolved "https://registry.yarnpkg.com/bullmq/-/bullmq-5.25.6.tgz#7a7bb38e48556e96cba1a4c6988679ed6e194d06" + integrity sha512-jxpa/DB02V20CqBAgyqpQazT630CJm0r4fky8EchH3mcJAomRtKXLS6tRA0J8tb29BDGlr/LXhlUuZwdBJBSdA== + dependencies: + cron-parser "^4.6.0" + ioredis "^5.4.1" + msgpackr "^1.11.2" + node-abort-controller "^3.1.1" + semver "^7.5.4" + tslib "^2.0.0" + uuid "^9.0.0" + +cluster-key-slot@^1.1.0: + version "1.1.2" + resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz#88ddaa46906e303b5de30d3153b7d9fe0a0c19ac" + integrity sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA== + +cookie@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-1.0.1.tgz#e1a00d20420e0266aff817815640289eef142751" + integrity sha512-Xd8lFX4LM9QEEwxQpF9J9NTUh8pmdJO0cyRJhFiDoLTk2eH8FXlRv2IFGYVadZpqI3j8fhNrSdKCeYPxiAhLXw== + +cron-parser@^4.6.0: + version "4.9.0" + resolved "https://registry.yarnpkg.com/cron-parser/-/cron-parser-4.9.0.tgz#0340694af3e46a0894978c6f52a6dbb5c0f11ad5" + integrity sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q== + dependencies: + luxon "^3.2.1" + +debug@^4.3.4: + version "4.3.5" + resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" + integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== + dependencies: + ms "2.1.2" + +denque@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" + integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== + +detect-libc@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" + integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== + +elysia@^1.1.24: + version "1.1.24" + resolved "https://registry.yarnpkg.com/elysia/-/elysia-1.1.24.tgz#093eeb60c8338e4e14bae33e3718b54682dbcabe" + integrity sha512-viJOb+PADrxJn7ntlQfoXsLuVgHNS09gn9dj2yroHnwqheN0hZp81WCGRQXkvh4kW5zGISX50/eqAcoNDpdL/g== + dependencies: + "@sinclair/typebox" "0.32.34" + cookie "^1.0.1" + fast-decode-uri-component "^1.0.1" + openapi-types "^12.1.3" + +fast-decode-uri-component@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz#46f8b6c22b30ff7a81357d4f59abfae938202543" + integrity sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg== + +ioredis@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.4.1.tgz#1c56b70b759f01465913887375ed809134296f40" + integrity sha512-2YZsvl7jopIa1gaePkeMtd9rAcSjOOjPtpcLlOeusyO+XH2SK5ZcT+UCrElPP+WVIInh2TzeI4XW9ENaSLVVHA== + dependencies: + "@ioredis/commands" "^1.1.1" + cluster-key-slot "^1.1.0" + debug "^4.3.4" + denque "^2.1.0" + lodash.defaults "^4.2.0" + lodash.isarguments "^3.1.0" + redis-errors "^1.2.0" + redis-parser "^3.0.0" + standard-as-callback "^2.1.0" + +lodash.defaults@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" + integrity sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ== + +lodash.isarguments@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" + integrity sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg== + +luxon@^3.2.1: + version "3.4.4" + resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.4.4.tgz#cf20dc27dc532ba41a169c43fdcc0063601577af" + integrity sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA== + +ms@2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +msgpackr-extract@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/msgpackr-extract/-/msgpackr-extract-3.0.3.tgz#e9d87023de39ce714872f9e9504e3c1996d61012" + integrity sha512-P0efT1C9jIdVRefqjzOQ9Xml57zpOXnIuS+csaB4MdZbTdmGDLo8XhzBG1N7aO11gKDDkJvBLULeFTo46wwreA== + dependencies: + node-gyp-build-optional-packages "5.2.2" + optionalDependencies: + "@msgpackr-extract/msgpackr-extract-darwin-arm64" "3.0.3" + "@msgpackr-extract/msgpackr-extract-darwin-x64" "3.0.3" + "@msgpackr-extract/msgpackr-extract-linux-arm" "3.0.3" + "@msgpackr-extract/msgpackr-extract-linux-arm64" "3.0.3" + "@msgpackr-extract/msgpackr-extract-linux-x64" "3.0.3" + "@msgpackr-extract/msgpackr-extract-win32-x64" "3.0.3" + +msgpackr@^1.11.2: + version "1.11.2" + resolved "https://registry.yarnpkg.com/msgpackr/-/msgpackr-1.11.2.tgz#4463b7f7d68f2e24865c395664973562ad24473d" + integrity sha512-F9UngXRlPyWCDEASDpTf6c9uNhGPTqnTeLVt7bN+bU1eajoR/8V9ys2BRaV5C/e5ihE6sJ9uPIKaYt6bFuO32g== + optionalDependencies: + msgpackr-extract "^3.0.2" + +node-abort-controller@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548" + integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== + +node-gyp-build-optional-packages@5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz#522f50c2d53134d7f3a76cd7255de4ab6c96a3a4" + integrity sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw== + dependencies: + detect-libc "^2.0.1" + +openapi-types@^12.1.3: + version "12.1.3" + resolved "https://registry.yarnpkg.com/openapi-types/-/openapi-types-12.1.3.tgz#471995eb26c4b97b7bd356aacf7b91b73e777dd3" + integrity sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw== + +redis-errors@^1.0.0, redis-errors@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad" + integrity sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w== + +redis-parser@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-3.0.0.tgz#b66d828cdcafe6b4b8a428a7def4c6bcac31c8b4" + integrity sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A== + dependencies: + redis-errors "^1.0.0" + +semver@^7.5.4: + version "7.6.2" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" + integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== + +standard-as-callback@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.1.0.tgz#8953fc05359868a77b5b9739a665c5977bb7df45" + integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A== + +tslib@^2.0.0: + version "2.6.3" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" + integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== + +uuid@^9.0.0: + version "9.0.1" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" + integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== diff --git a/packages/elysia/src/ElysiaAdapter.ts b/packages/elysia/src/ElysiaAdapter.ts new file mode 100644 index 00000000..8090800f --- /dev/null +++ b/packages/elysia/src/ElysiaAdapter.ts @@ -0,0 +1,180 @@ +import type { + AppControllerRoute, + AppViewRoute, + BullBoardQueues, + ControllerHandlerReturnType, + HTTPMethod, + IServerAdapter, + UIConfig, +} from "@bull-board/api/dist/typings/app"; +import staticPlugin from "@elysiajs/static"; +import ejs from "ejs"; +import { Elysia } from "elysia"; + +export class ElysiaAdapter implements IServerAdapter { + private plugin: Elysia; + private basePath = ""; + + constructor(basePath = "") { + this.basePath = basePath; + this.plugin = new Elysia({ + name: "@bull-board/elysia", + prefix: basePath, + }); + } + + private entryRoute: AppViewRoute | undefined; + private statics: { path: string; route: string } | undefined; + private bullBoardQueues: BullBoardQueues | undefined; + private viewPath: string | undefined; + private uiConfig: UIConfig = {}; + + public setStaticPath( + staticsRoute: string, + staticsPath: string, + ): ElysiaAdapter { + this.statics = { route: staticsRoute, path: staticsPath }; + + return this; + } + + public setViewsPath(viewPath: string): ElysiaAdapter { + this.viewPath = viewPath; + + return this; + } + + public setErrorHandler( + handler: (error: Error) => ControllerHandlerReturnType, + ) { + this.plugin.onError(({ error, set }) => { + const response = handler(error); + set.status = response.status || 500; + + return response.body; + }); + + return this; + } + + public setApiRoutes(routes: AppControllerRoute[]): ElysiaAdapter { + for (const { route, handler, method } of routes) { + const methods = Array.isArray(method) ? method : [method]; + + for (const method of methods) { + this.registerRoute(route, method, handler); + } + } + + return this; + } + + public setEntryRoute(routeDef: AppViewRoute): ElysiaAdapter { + this.entryRoute = routeDef; + + return this; + } + + public setQueues(bullBoardQueues: BullBoardQueues): ElysiaAdapter { + this.bullBoardQueues = bullBoardQueues; + return this; + } + + public setUIConfig(config: UIConfig = {}): ElysiaAdapter { + this.uiConfig = config; + + return this; + } + + public registerPlugin() { + if (!this.statics) { + throw new Error( + `Please call 'setStaticPath' before using 'registerHandlers'`, + ); + } + if (!this.entryRoute) { + throw new Error( + `Please call 'setEntryRoute' before using 'registerHandlers'`, + ); + } + if (!this.viewPath) { + throw new Error( + `Please call 'setViewsPath' before using 'registerHandlers'`, + ); + } + + if (!this.uiConfig) { + throw new Error( + `Please call 'setUIConfig' before using 'registerHandlers'`, + ); + } + + const { method, route, handler } = this.entryRoute; + + const routes = Array.isArray(route) ? route : [route]; + + for (const route of routes) { + this.plugin.route(method.toUpperCase(), route, async () => { + const { name: filename, params } = handler({ + basePath: this.basePath, + uiConfig: this.uiConfig, + }); + + return new Response( + await ejs.renderFile(`${this.viewPath}/${filename}`, params), + { + headers: { + "content-type": "text/html", + }, + }, + ); + }); + } + + this.plugin.use( + staticPlugin({ + prefix: this.statics.route, + assets: this.statics.path, + }), + ); + + return this.plugin.as("plugin"); + } + + private registerRoute( + routeOrRoutes: string | string[], + method: HTTPMethod, + handler: AppControllerRoute["handler"], + ) { + const { bullBoardQueues } = this; + + if (!bullBoardQueues) { + throw new Error( + `Please call 'setQueues' before using 'registerHandlers'`, + ); + } + + const routes = Array.isArray(routeOrRoutes) + ? routeOrRoutes + : [routeOrRoutes]; + + for (const route of routes) { + this.plugin.route( + method.toUpperCase(), + route, + async ({ params, body, query, set }) => { + const response = await handler({ + queues: this.bullBoardQueues as BullBoardQueues, + params, + body: body as Record, + query, + }); + + if(response.status) set.status = response.status; + + return response.body; + }, + ); + } + } +} From b453d5b28269ec49240d15cc318237601311ed51 Mon Sep 17 00:00:00 2001 From: kravetsone <57632712+kravetsone@users.noreply.github.com> Date: Wed, 13 Nov 2024 01:56:35 +0300 Subject: [PATCH 6/9] chore: add docker-compose.redis for better testing --- docker-compose.redis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 docker-compose.redis.yml diff --git a/docker-compose.redis.yml b/docker-compose.redis.yml new file mode 100644 index 00000000..a3e59940 --- /dev/null +++ b/docker-compose.redis.yml @@ -0,0 +1,11 @@ +services: + redis: + image: redis:latest + hostname: redis + restart: unless-stopped + ports: + - 6379:6379 + volumes: + - redis_data:/data +volumes: + redis_data: From ea2d204a6adfb787d2f851cf8784ef602fa8df70 Mon Sep 17 00:00:00 2001 From: kravetsone <57632712+kravetsone@users.noreply.github.com> Date: Wed, 13 Nov 2024 01:57:11 +0300 Subject: [PATCH 7/9] chore: a lot of fixes --- examples/with-elysia/index.ts | 83 +++--- examples/with-elysia/package.json | 4 +- examples/with-elysia/yarn.lock | 390 ++------------------------- packages/elysia/package.json | 6 +- packages/elysia/src/ElysiaAdapter.ts | 341 ++++++++++++----------- 5 files changed, 227 insertions(+), 597 deletions(-) diff --git a/examples/with-elysia/index.ts b/examples/with-elysia/index.ts index 45a88005..ba6d5526 100644 --- a/examples/with-elysia/index.ts +++ b/examples/with-elysia/index.ts @@ -1,64 +1,65 @@ -import { createBullBoard } from "@bull-board/api"; -import { BullMQAdapter } from "@bull-board/api/bullMQAdapter"; -import { ElysiaAdapter } from "@bull-board/elysia"; -import { Queue as QueueMQ, Worker } from "bullmq"; -import Elysia from "elysia"; +import { createBullBoard } from '@bull-board/api'; +import { BullMQAdapter } from '@bull-board/api/bullMQAdapter'; +import { ElysiaAdapter } from '@bull-board/elysia'; +import { Queue as QueueMQ, Worker } from 'bullmq'; +import Elysia from '../../node_modules/elysia'; -const sleep = (t: number) => - new Promise((resolve) => setTimeout(resolve, t * 1000)); +const sleep = (t: number) => new Promise((resolve) => setTimeout(resolve, t * 1000)); const redisOptions = { - port: 6379, - host: "localhost", - password: "", + port: 6379, + host: 'localhost', + password: '', }; -const createQueueMQ = (name: string) => - new QueueMQ(name, { connection: redisOptions }); +const createQueueMQ = (name: string) => new QueueMQ(name, { connection: redisOptions }); async function setupBullMQProcessor(queueName: string) { - new Worker( - queueName, - async (job) => { - for (let i = 0; i <= 100; i++) { - await sleep(Math.random()); - await job.updateProgress(i); - await job.log(`Processing job at interval ${i}`); + new Worker( + queueName, + async (job) => { + for (let i = 0; i <= 100; i++) { + await sleep(Math.random()); + await job.updateProgress(i); + await job.log(`Processing job at interval ${i}`); - if (Math.random() * 200 < 1) throw new Error(`Random error ${i}`); - } + if (Math.random() * 200 < 1) throw new Error(`Random error ${i}`); + } - return { jobId: `This is the return value of job (${job.id})` }; - }, - { connection: redisOptions }, - ); + return { jobId: `This is the return value of job (${job.id})` }; + }, + { connection: redisOptions } + ); } -const exampleBullMq = createQueueMQ("BullMQ"); +const exampleBullMq = createQueueMQ('BullMQ'); await setupBullMQProcessor(exampleBullMq.name); -const serverAdapter = new ElysiaAdapter("/ui"); +const serverAdapter = new ElysiaAdapter('/ui'); createBullBoard({ - queues: [new BullMQAdapter(exampleBullMq)], - serverAdapter, + queues: [new BullMQAdapter(exampleBullMq)], + serverAdapter, }); const app = new Elysia() - .use(serverAdapter.registerPlugin()) - .get("/add", async ({ query }) => { - await exampleBullMq.add("Add", { title: query.title }); + .onError(({ error, code, request }) => { + console.error(error, code, request.method, request.url); + }) + .use(serverAdapter.registerPlugin()) + .get('/add', async ({ query }) => { + await exampleBullMq.add('Add', { title: query.title }); - return { ok: true }; - }); + return { ok: true }; + }); app.listen(3000, ({ port, url }) => { - /* eslint-disable no-console */ - console.log(`Running on ${url.hostname}:${port}...`); - console.log(`For the UI of instance1, open http://localhost:${port}/ui`); - console.log("Make sure Redis is running on port 6379 by default"); - console.log("To populate the queue, run:"); - console.log(` curl http://localhost:${port}/add?title=Example`); - /* eslint-enable no-console */ + /* eslint-disable no-console */ + console.log(`Running on ${url.hostname}:${port}...`); + console.log(`For the UI of instance1, open http://localhost:${port}/ui`); + console.log('Make sure Redis is running on port 6379 by default'); + console.log('To populate the queue, run:'); + console.log(` curl http://localhost:${port}/add?title=Example`); + /* eslint-enable no-console */ }); diff --git a/examples/with-elysia/package.json b/examples/with-elysia/package.json index 74628258..c797e93b 100644 --- a/examples/with-elysia/package.json +++ b/examples/with-elysia/package.json @@ -5,14 +5,14 @@ "description": "Example of how to use Elysia server with bull-board", "module": "index.ts", "scripts": { - "start": "bun index.ts", + "dev": "bun --watch index.ts", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "kravetsone", "license": "ISC", "dependencies": { "@bull-board/elysia": "^5.20.1", - "bullmq": "^5.13.2", + "bullmq": "4.8.0", "elysia": "^1.1.24" } } diff --git a/examples/with-elysia/yarn.lock b/examples/with-elysia/yarn.lock index f02c111e..972e1497 100644 --- a/examples/with-elysia/yarn.lock +++ b/examples/with-elysia/yarn.lock @@ -42,270 +42,11 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.32.34.tgz#a1c59d4df30982263cc7aa64c2c853878050838d" integrity sha512-a3Z3ytYl6R/+7ldxx04PO1semkwWlX/8pTqxsPw4quIcIXDFPZhOc1Wx8azWmkU26ccK3mHwcWenn0avNgAKQg== -bullmq@^5.13.2: - version "5.25.6" - resolved "https://registry.yarnpkg.com/bullmq/-/bullmq-5.25.6.tgz#7a7bb38e48556e96cba1a4c6988679ed6e194d06" - integrity sha512-jxpa/DB02V20CqBAgyqpQazT630CJm0r4fky8EchH3mcJAomRtKXLS6tRA0J8tb29BDGlr/LXhlUuZwdBJBSdA== - dependencies: - cron-parser "^4.6.0" - ioredis "^5.4.1" - msgpackr "^1.11.2" - node-abort-controller "^3.1.1" - semver "^7.5.4" - tslib "^2.0.0" - uuid "^9.0.0" - -cluster-key-slot@^1.1.0: - version "1.1.2" - resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz#88ddaa46906e303b5de30d3153b7d9fe0a0c19ac" - integrity sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA== - -cookie@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-1.0.1.tgz#e1a00d20420e0266aff817815640289eef142751" - integrity sha512-Xd8lFX4LM9QEEwxQpF9J9NTUh8pmdJO0cyRJhFiDoLTk2eH8FXlRv2IFGYVadZpqI3j8fhNrSdKCeYPxiAhLXw== - -cron-parser@^4.6.0: - version "4.9.0" - resolved "https://registry.yarnpkg.com/cron-parser/-/cron-parser-4.9.0.tgz#0340694af3e46a0894978c6f52a6dbb5c0f11ad5" - integrity sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q== - dependencies: - luxon "^3.2.1" - -debug@^4.3.4: - version "4.3.5" - resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.5.tgz#e83444eceb9fedd4a1da56d671ae2446a01a6e1e" - integrity sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg== - dependencies: - ms "2.1.2" - -denque@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" - integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== - -detect-libc@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" - integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== - -elysia@^1.1.24: - version "1.1.24" - resolved "https://registry.yarnpkg.com/elysia/-/elysia-1.1.24.tgz#093eeb60c8338e4e14bae33e3718b54682dbcabe" - integrity sha512-viJOb+PADrxJn7ntlQfoXsLuVgHNS09gn9dj2yroHnwqheN0hZp81WCGRQXkvh4kW5zGISX50/eqAcoNDpdL/g== - dependencies: - "@sinclair/typebox" "0.32.34" - cookie "^1.0.1" - fast-decode-uri-component "^1.0.1" - openapi-types "^12.1.3" - -fast-decode-uri-component@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz#46f8b6c22b30ff7a81357d4f59abfae938202543" - integrity sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg== - -ioredis@^5.4.1: - version "5.4.1" - resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-5.4.1.tgz#1c56b70b759f01465913887375ed809134296f40" - integrity sha512-2YZsvl7jopIa1gaePkeMtd9rAcSjOOjPtpcLlOeusyO+XH2SK5ZcT+UCrElPP+WVIInh2TzeI4XW9ENaSLVVHA== - dependencies: - "@ioredis/commands" "^1.1.1" - cluster-key-slot "^1.1.0" - debug "^4.3.4" - denque "^2.1.0" - lodash.defaults "^4.2.0" - lodash.isarguments "^3.1.0" - redis-errors "^1.2.0" - redis-parser "^3.0.0" - standard-as-callback "^2.1.0" - -lodash.defaults@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" - integrity sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ== - -lodash.isarguments@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" - integrity sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg== - -luxon@^3.2.1: - version "3.4.4" - resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.4.4.tgz#cf20dc27dc532ba41a169c43fdcc0063601577af" - integrity sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA== - -ms@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" - integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== - -msgpackr-extract@^3.0.2: - version "3.0.3" - resolved "https://registry.yarnpkg.com/msgpackr-extract/-/msgpackr-extract-3.0.3.tgz#e9d87023de39ce714872f9e9504e3c1996d61012" - integrity sha512-P0efT1C9jIdVRefqjzOQ9Xml57zpOXnIuS+csaB4MdZbTdmGDLo8XhzBG1N7aO11gKDDkJvBLULeFTo46wwreA== - dependencies: - node-gyp-build-optional-packages "5.2.2" - optionalDependencies: - "@msgpackr-extract/msgpackr-extract-darwin-arm64" "3.0.3" - "@msgpackr-extract/msgpackr-extract-darwin-x64" "3.0.3" - "@msgpackr-extract/msgpackr-extract-linux-arm" "3.0.3" - "@msgpackr-extract/msgpackr-extract-linux-arm64" "3.0.3" - "@msgpackr-extract/msgpackr-extract-linux-x64" "3.0.3" - "@msgpackr-extract/msgpackr-extract-win32-x64" "3.0.3" - -msgpackr@^1.11.2: - version "1.11.2" - resolved "https://registry.yarnpkg.com/msgpackr/-/msgpackr-1.11.2.tgz#4463b7f7d68f2e24865c395664973562ad24473d" - integrity sha512-F9UngXRlPyWCDEASDpTf6c9uNhGPTqnTeLVt7bN+bU1eajoR/8V9ys2BRaV5C/e5ihE6sJ9uPIKaYt6bFuO32g== - optionalDependencies: - msgpackr-extract "^3.0.2" - -node-abort-controller@^3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548" - integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== - -node-gyp-build-optional-packages@5.2.2: - version "5.2.2" - resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz#522f50c2d53134d7f3a76cd7255de4ab6c96a3a4" - integrity sha512-s+w+rBWnpTMwSFbaE0UXsRlg7hU4FjekKU4eyAih5T8nJuNZT1nNsskXpxmeqSK9UzkBl6UgRlnKc8hz8IEqOw== - dependencies: - detect-libc "^2.0.1" - -openapi-types@^12.1.3: - version "12.1.3" - resolved "https://registry.yarnpkg.com/openapi-types/-/openapi-types-12.1.3.tgz#471995eb26c4b97b7bd356aacf7b91b73e777dd3" - integrity sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw== - -redis-errors@^1.0.0, redis-errors@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad" - integrity sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w== - -redis-parser@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-3.0.0.tgz#b66d828cdcafe6b4b8a428a7def4c6bcac31c8b4" - integrity sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A== - dependencies: - redis-errors "^1.0.0" - -semver@^7.5.4: - version "7.6.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.2.tgz#1e3b34759f896e8f14d6134732ce798aeb0c6e13" - integrity sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w== - -standard-as-callback@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.1.0.tgz#8953fc05359868a77b5b9739a665c5977bb7df45" - integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A== - -tslib@^2.0.0: - version "2.6.3" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" - integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== - -uuid@^9.0.0: - version "9.0.1" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" - integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@bull-board/api@5.20.1": - version "5.20.1" - resolved "https://registry.yarnpkg.com/@bull-board/api/-/api-5.20.1.tgz#826567731aeea8ce006aa6f5ea0d1d7cc2f5a7a7" - integrity sha512-45aDhnOzWRrtUUAKHxdClSnLIus5f8BK3ATzb2IwI/BRgOi1lWTe1YG266hVqDdWXsUDxKzf75DAANKfAoEsRA== - dependencies: - redis-info "^3.0.8" - -"@bull-board/elysia@../../packages/elysia": - version "5.20.1" - dependencies: - "@bull-board/api" "5.20.1" - "@bull-board/ui" "5.20.1" - "@elysiajs/static" "^1.0.3" - ejs "^3.1.10" - -"@bull-board/ui@5.20.1": - version "5.20.1" - resolved "https://registry.yarnpkg.com/@bull-board/ui/-/ui-5.20.1.tgz#bf05cd6e1c1e7010baf49b4f0353c03a81cc44f3" - integrity sha512-RzNinC4FKHNuxzkIRsCL+n9iO5RxmF5YM7byCuuv1/UeFjtCtsLHFi6TI9ZgJsXETA2Uxq9Mg7ppncojUjrINw== - dependencies: - "@bull-board/api" "5.20.1" - -"@elysiajs/static@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@elysiajs/static/-/static-1.0.3.tgz#0175a14762aecf1e0250b7bd961616e645cbafa3" - integrity sha512-+oMDfqRC8OFgzsrHQBUjlMHTUqYAyFpq3HPaHochgs9a+i/SBKfX6Ow4kepBIOMTlf43knw3wfHu6sEVsXzLRw== - dependencies: - node-cache "^5.1.2" - -"@ioredis/commands@^1.1.1": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@ioredis/commands/-/commands-1.2.0.tgz#6d61b3097470af1fdbbe622795b8921d42018e11" - integrity sha512-Sx1pU8EM64o2BrqNpEO1CNLtKQwyhuXuqyfH7oGKCk+1a33d2r5saW8zNwm3j6BTExtjrv2BxTgzzkMwts6vGg== - -"@msgpackr-extract/msgpackr-extract-darwin-arm64@3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.3.tgz#9edec61b22c3082018a79f6d1c30289ddf3d9d11" - integrity sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw== - -"@msgpackr-extract/msgpackr-extract-darwin-x64@3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-darwin-x64/-/msgpackr-extract-darwin-x64-3.0.3.tgz#33677a275204898ad8acbf62734fc4dc0b6a4855" - integrity sha512-mdzd3AVzYKuUmiWOQ8GNhl64/IoFGol569zNRdkLReh6LRLHOXxU4U8eq0JwaD8iFHdVGqSy4IjFL4reoWCDFw== - -"@msgpackr-extract/msgpackr-extract-linux-arm64@3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-arm64/-/msgpackr-extract-linux-arm64-3.0.3.tgz#19edf7cdc2e7063ee328403c1d895a86dd28f4bb" - integrity sha512-YxQL+ax0XqBJDZiKimS2XQaf+2wDGVa1enVRGzEvLLVFeqa5kx2bWbtcSXgsxjQB7nRqqIGFIcLteF/sHeVtQg== - -"@msgpackr-extract/msgpackr-extract-linux-arm@3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-arm/-/msgpackr-extract-linux-arm-3.0.3.tgz#94fb0543ba2e28766c3fc439cabbe0440ae70159" - integrity sha512-fg0uy/dG/nZEXfYilKoRe7yALaNmHoYeIoJuJ7KJ+YyU2bvY8vPv27f7UKhGRpY6euFYqEVhxCFZgAUNQBM3nw== - -"@msgpackr-extract/msgpackr-extract-linux-x64@3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-linux-x64/-/msgpackr-extract-linux-x64-3.0.3.tgz#4a0609ab5fe44d07c9c60a11e4484d3c38bbd6e3" - integrity sha512-cvwNfbP07pKUfq1uH+S6KJ7dT9K8WOE4ZiAcsrSes+UY55E/0jLYc+vq+DO7jlmqRb5zAggExKm0H7O/CBaesg== - -"@msgpackr-extract/msgpackr-extract-win32-x64@3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.3.tgz#0aa5502d547b57abfc4ac492de68e2006e417242" - integrity sha512-x0fWaQtYp4E6sktbsdAqnehxDgEc/VwM7uLsRCYWaiGu0ykYdZPiS8zCWdnjHwyiumousxfBm4SO31eXqwEZhQ== - -"@sinclair/typebox@^0.32.15": - version "0.32.32" - resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.32.32.tgz#e12172fe394e7adc868c62354f4f677e3196630e" - integrity sha512-m+A3zFSI87TCtoz6vQCSnd+t/kDKL78JmzhKYkON+7SnHSa+794qraIVpm6ozFGK+5svnVOt1LJ7BUEhGkIvgg== - -ansi-styles@^4.1.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" - integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== - dependencies: - color-convert "^2.0.1" - -async@^3.2.3: - version "3.2.5" - resolved "https://registry.yarnpkg.com/async/-/async-3.2.5.tgz#ebd52a8fdaf7a2289a24df399f8d8485c8a46b66" - integrity sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg== - balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== -brace-expansion@^1.1.7: - version "1.1.11" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" - integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== - dependencies: - balanced-match "^1.0.0" - concat-map "0.0.1" - brace-expansion@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" @@ -313,10 +54,10 @@ brace-expansion@^2.0.1: dependencies: balanced-match "^1.0.0" -bullmq@^4.6.0: - version "4.17.0" - resolved "https://registry.yarnpkg.com/bullmq/-/bullmq-4.17.0.tgz#f8f61bea80fb72ab690c1e926de0464f3222f1ea" - integrity sha512-URnHgB01rlCP8RTpmW3kFnvv3vdd2aI1OcBMYQwnqODxGiJUlz9MibDVXE83mq7ee1eS1IvD9lMQqGszX6E5Pw== +bullmq@4.8.0: + version "4.8.0" + resolved "https://registry.yarnpkg.com/bullmq/-/bullmq-4.8.0.tgz#da1b00284cbc9d16e54b2996beb8dead9c2bf186" + integrity sha512-M5NPxrzHQ53yeRSH3j52dOu0U6Lssdhumet9CJ9LzTh2GNbhad9VPQunaariEmPmK0zCFF2uf08PVWtRbXnQkQ== dependencies: cron-parser "^4.6.0" glob "^8.0.3" @@ -328,45 +69,15 @@ bullmq@^4.6.0: tslib "^2.0.0" uuid "^9.0.0" -chalk@^4.0.2: - version "4.1.2" - resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" - integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== - dependencies: - ansi-styles "^4.1.0" - supports-color "^7.1.0" - -clone@2.x: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== - cluster-key-slot@^1.1.0: version "1.1.2" resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.2.tgz#88ddaa46906e303b5de30d3153b7d9fe0a0c19ac" integrity sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA== -color-convert@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" - integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== - dependencies: - color-name "~1.1.4" - -color-name@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" - integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== - -concat-map@0.0.1: - version "0.0.1" - resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== - -cookie@^0.6.0: - version "0.6.0" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.6.0.tgz#2798b04b071b0ecbff0dbb62a505a8efa4e19051" - integrity sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw== +cookie@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-1.0.1.tgz#e1a00d20420e0266aff817815640289eef142751" + integrity sha512-Xd8lFX4LM9QEEwxQpF9J9NTUh8pmdJO0cyRJhFiDoLTk2eH8FXlRv2IFGYVadZpqI3j8fhNrSdKCeYPxiAhLXw== cron-parser@^4.6.0: version "4.9.0" @@ -392,49 +103,21 @@ detect-libc@^2.0.1: resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.3.tgz#f0cd503b40f9939b894697d19ad50895e30cf700" integrity sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw== -ejs@^3.1.10: - version "3.1.10" - resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b" - integrity sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA== - dependencies: - jake "^10.8.5" - -elysia@^1.0.22: - version "1.0.23" - resolved "https://registry.yarnpkg.com/elysia/-/elysia-1.0.23.tgz#6ace54f28c4018219734dd4feef27cd38bd65a65" - integrity sha512-484cI3C9bHGMVHuYxvz2qXMOonVix+1AyD1LI0Mgyh+XVDIL4nKqksW/rsyIs7wkfFbt0bz5XbxaOblqBwiXSQ== +elysia@^1.1.24: + version "1.1.24" + resolved "https://registry.yarnpkg.com/elysia/-/elysia-1.1.24.tgz#093eeb60c8338e4e14bae33e3718b54682dbcabe" + integrity sha512-viJOb+PADrxJn7ntlQfoXsLuVgHNS09gn9dj2yroHnwqheN0hZp81WCGRQXkvh4kW5zGISX50/eqAcoNDpdL/g== dependencies: - "@sinclair/typebox" "^0.32.15" - cookie "^0.6.0" - eventemitter3 "^5.0.1" + "@sinclair/typebox" "0.32.34" + cookie "^1.0.1" fast-decode-uri-component "^1.0.1" - fast-querystring "^1.1.2" openapi-types "^12.1.3" -eventemitter3@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-5.0.1.tgz#53f5ffd0a492ac800721bb42c66b841de96423c4" - integrity sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA== - fast-decode-uri-component@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/fast-decode-uri-component/-/fast-decode-uri-component-1.0.1.tgz#46f8b6c22b30ff7a81357d4f59abfae938202543" integrity sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg== -fast-querystring@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/fast-querystring/-/fast-querystring-1.1.2.tgz#a6d24937b4fc6f791b4ee31dcb6f53aeafb89f53" - integrity sha512-g6KuKWmFXc0fID8WWH0jit4g0AGBoJhCkJMb1RmbsSEUNvQ+ZC8D6CUZ+GtF8nMzSPXnhiePyyqqipzNNEnHjg== - dependencies: - fast-decode-uri-component "^1.0.1" - -filelist@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.4.tgz#f78978a1e944775ff9e62e744424f215e58352b5" - integrity sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q== - dependencies: - minimatch "^5.0.1" - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -451,11 +134,6 @@ glob@^8.0.3: minimatch "^5.0.1" once "^1.3.0" -has-flag@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" - integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== - inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -484,16 +162,6 @@ ioredis@^5.3.2: redis-parser "^3.0.0" standard-as-callback "^2.1.0" -jake@^10.8.5: - version "10.9.1" - resolved "https://registry.yarnpkg.com/jake/-/jake-10.9.1.tgz#8dc96b7fcc41cb19aa502af506da4e1d56f5e62b" - integrity sha512-61btcOHNnLnsOdtLgA5efqQWjnSi/vow5HbI7HMdKKWqvrKR1bLK3BPlJn9gcSaP2ewuamUSMB5XEy76KUIS2w== - dependencies: - async "^3.2.3" - chalk "^4.0.2" - filelist "^1.0.4" - minimatch "^3.1.2" - lodash.defaults@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c" @@ -504,7 +172,7 @@ lodash.isarguments@^3.1.0: resolved "https://registry.yarnpkg.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a" integrity sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg== -lodash@^4.17.11, lodash@^4.17.21: +lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -514,13 +182,6 @@ luxon@^3.2.1: resolved "https://registry.yarnpkg.com/luxon/-/luxon-3.4.4.tgz#cf20dc27dc532ba41a169c43fdcc0063601577af" integrity sha512-zobTr7akeGHnv7eBOXcRgMeCP6+uyYsczwmeRCauvpvaAltgNyTbLH/+VaEAPUeWBT+1GuNmz4wC/6jtQzbbVA== -minimatch@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - minimatch@^5.0.1: version "5.1.6" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" @@ -559,13 +220,6 @@ node-abort-controller@^3.1.1: resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548" integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== -node-cache@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/node-cache/-/node-cache-5.1.2.tgz#f264dc2ccad0a780e76253a694e9fd0ed19c398d" - integrity sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg== - dependencies: - clone "2.x" - node-gyp-build-optional-packages@5.2.2: version "5.2.2" resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz#522f50c2d53134d7f3a76cd7255de4ab6c96a3a4" @@ -590,13 +244,6 @@ redis-errors@^1.0.0, redis-errors@^1.2.0: resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad" integrity sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w== -redis-info@^3.0.8: - version "3.1.0" - resolved "https://registry.yarnpkg.com/redis-info/-/redis-info-3.1.0.tgz#5e349c8720e82d27ac84c73136dce0931e10469a" - integrity sha512-ER4L9Sh/vm63DkIE0bkSjxluQlioBiBgf5w1UuldaW/3vPcecdljVDisZhmnCMvsxHNiARTTDDHGg9cGwTfrKg== - dependencies: - lodash "^4.17.11" - redis-parser@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-3.0.0.tgz#b66d828cdcafe6b4b8a428a7def4c6bcac31c8b4" @@ -614,13 +261,6 @@ standard-as-callback@^2.1.0: resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.1.0.tgz#8953fc05359868a77b5b9739a665c5977bb7df45" integrity sha512-qoRRSyROncaz1z0mvYqIE4lCd9p2R90i6GxW3uZv5ucSu8tU7B5HXUP1gG8pVZsYNVaXjk8ClXHPttLyxAL48A== -supports-color@^7.1.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" - integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== - dependencies: - has-flag "^4.0.0" - tslib@^2.0.0: version "2.6.3" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" diff --git a/packages/elysia/package.json b/packages/elysia/package.json index b6fe5d9b..81be4e00 100644 --- a/packages/elysia/package.json +++ b/packages/elysia/package.json @@ -34,13 +34,13 @@ "clean": "rm -rf dist" }, "dependencies": { - "@bull-board/api": "6.3.3", - "@bull-board/ui": "6.3.3", + "@bull-board/api": "6.4.0", + "@bull-board/ui": "6.4.0", "@elysiajs/static": "^1.1.1", "ejs": "^3.1.10" }, "peerDependencies": { - "elysia": "^1.0.22" + "elysia": "^1.1.0" }, "publishConfig": { "access": "public" diff --git a/packages/elysia/src/ElysiaAdapter.ts b/packages/elysia/src/ElysiaAdapter.ts index 8090800f..841f132d 100644 --- a/packages/elysia/src/ElysiaAdapter.ts +++ b/packages/elysia/src/ElysiaAdapter.ts @@ -1,180 +1,169 @@ import type { - AppControllerRoute, - AppViewRoute, - BullBoardQueues, - ControllerHandlerReturnType, - HTTPMethod, - IServerAdapter, - UIConfig, -} from "@bull-board/api/dist/typings/app"; -import staticPlugin from "@elysiajs/static"; -import ejs from "ejs"; -import { Elysia } from "elysia"; + AppControllerRoute, + AppViewRoute, + BullBoardQueues, + ControllerHandlerReturnType, + HTTPMethod, + IServerAdapter, + UIConfig, +} from '@bull-board/api/dist/typings/app'; +import staticPlugin from '@elysiajs/static'; +import ejs from 'ejs'; +import { Elysia } from 'elysia'; export class ElysiaAdapter implements IServerAdapter { - private plugin: Elysia; - private basePath = ""; - - constructor(basePath = "") { - this.basePath = basePath; - this.plugin = new Elysia({ - name: "@bull-board/elysia", - prefix: basePath, - }); - } - - private entryRoute: AppViewRoute | undefined; - private statics: { path: string; route: string } | undefined; - private bullBoardQueues: BullBoardQueues | undefined; - private viewPath: string | undefined; - private uiConfig: UIConfig = {}; - - public setStaticPath( - staticsRoute: string, - staticsPath: string, - ): ElysiaAdapter { - this.statics = { route: staticsRoute, path: staticsPath }; - - return this; - } - - public setViewsPath(viewPath: string): ElysiaAdapter { - this.viewPath = viewPath; - - return this; - } - - public setErrorHandler( - handler: (error: Error) => ControllerHandlerReturnType, - ) { - this.plugin.onError(({ error, set }) => { - const response = handler(error); - set.status = response.status || 500; - - return response.body; - }); - - return this; - } - - public setApiRoutes(routes: AppControllerRoute[]): ElysiaAdapter { - for (const { route, handler, method } of routes) { - const methods = Array.isArray(method) ? method : [method]; - - for (const method of methods) { - this.registerRoute(route, method, handler); - } - } - - return this; - } - - public setEntryRoute(routeDef: AppViewRoute): ElysiaAdapter { - this.entryRoute = routeDef; - - return this; - } - - public setQueues(bullBoardQueues: BullBoardQueues): ElysiaAdapter { - this.bullBoardQueues = bullBoardQueues; - return this; - } - - public setUIConfig(config: UIConfig = {}): ElysiaAdapter { - this.uiConfig = config; - - return this; - } - - public registerPlugin() { - if (!this.statics) { - throw new Error( - `Please call 'setStaticPath' before using 'registerHandlers'`, - ); - } - if (!this.entryRoute) { - throw new Error( - `Please call 'setEntryRoute' before using 'registerHandlers'`, - ); - } - if (!this.viewPath) { - throw new Error( - `Please call 'setViewsPath' before using 'registerHandlers'`, - ); - } - - if (!this.uiConfig) { - throw new Error( - `Please call 'setUIConfig' before using 'registerHandlers'`, - ); - } - - const { method, route, handler } = this.entryRoute; - - const routes = Array.isArray(route) ? route : [route]; - - for (const route of routes) { - this.plugin.route(method.toUpperCase(), route, async () => { - const { name: filename, params } = handler({ - basePath: this.basePath, - uiConfig: this.uiConfig, - }); - - return new Response( - await ejs.renderFile(`${this.viewPath}/${filename}`, params), - { - headers: { - "content-type": "text/html", - }, - }, - ); - }); - } - - this.plugin.use( - staticPlugin({ - prefix: this.statics.route, - assets: this.statics.path, - }), - ); - - return this.plugin.as("plugin"); - } - - private registerRoute( - routeOrRoutes: string | string[], - method: HTTPMethod, - handler: AppControllerRoute["handler"], - ) { - const { bullBoardQueues } = this; - - if (!bullBoardQueues) { - throw new Error( - `Please call 'setQueues' before using 'registerHandlers'`, - ); - } - - const routes = Array.isArray(routeOrRoutes) - ? routeOrRoutes - : [routeOrRoutes]; - - for (const route of routes) { - this.plugin.route( - method.toUpperCase(), - route, - async ({ params, body, query, set }) => { - const response = await handler({ - queues: this.bullBoardQueues as BullBoardQueues, - params, - body: body as Record, - query, - }); - - if(response.status) set.status = response.status; - - return response.body; - }, - ); - } - } + private plugin = new Elysia({ + name: '@bull-board/elysia', + }).as('plugin'); + private basePath = ''; + + constructor(basePath = '') { + if (basePath.length) { + // it shows prefix is "" in types + this.basePath = basePath; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + this.plugin.config.prefix = this.basePath; + } + } + + private entryRoute: AppViewRoute | undefined; + private statics: { path: string; route: string } | undefined; + private bullBoardQueues: BullBoardQueues | undefined; + private viewPath: string | undefined; + private uiConfig: UIConfig = {}; + + public setStaticPath(staticsRoute: string, staticsPath: string): ElysiaAdapter { + this.statics = { route: staticsRoute, path: staticsPath }; + + return this; + } + + public setViewsPath(viewPath: string): ElysiaAdapter { + this.viewPath = viewPath; + + return this; + } + + public setErrorHandler(handler: (error: Error) => ControllerHandlerReturnType) { + this.plugin.onError(({ error, set }) => { + const response = handler(error); + set.status = response.status || 500; + + return response.body; + }); + + return this; + } + + public setApiRoutes(routes: AppControllerRoute[]): ElysiaAdapter { + for (const { route, handler, method } of routes) { + const methods = Array.isArray(method) ? method : [method]; + + for (const method of methods) { + this.registerRoute(route, method, handler); + } + } + + return this; + } + + public setEntryRoute(routeDef: AppViewRoute): ElysiaAdapter { + this.entryRoute = routeDef; + + return this; + } + + public setQueues(bullBoardQueues: BullBoardQueues): ElysiaAdapter { + this.bullBoardQueues = bullBoardQueues; + return this; + } + + public setUIConfig(config: UIConfig = {}): ElysiaAdapter { + this.uiConfig = config; + + return this; + } + + public registerPlugin() { + if (!this.statics) { + throw new Error(`Please call 'setStaticPath' before using 'registerHandlers'`); + } + if (!this.entryRoute) { + throw new Error(`Please call 'setEntryRoute' before using 'registerHandlers'`); + } + if (!this.viewPath) { + throw new Error(`Please call 'setViewsPath' before using 'registerHandlers'`); + } + + if (!this.uiConfig) { + throw new Error(`Please call 'setUIConfig' before using 'registerHandlers'`); + } + + const { method, route, handler } = this.entryRoute; + + const routes = Array.isArray(route) ? route : [route]; + + for (const route of routes) { + this.plugin.route(method.toUpperCase(), route, async () => { + const { name: filename, params } = handler({ + basePath: this.basePath, + uiConfig: this.uiConfig, + }); + + return new Response(await ejs.renderFile(`${this.viewPath}/${filename}`, params), { + headers: { + 'content-type': 'text/html', + }, + }); + }); + } + + const glob = new Bun.Glob(`${this.statics.path}/**/*`); + for (const path of glob.scanSync()) { + this.plugin.get( + // TODO: maybe recode this + path.substring(path.indexOf('dist') + 4).replaceAll('\\', '/'), + () => new Response(Bun.file(path)) + ); + } + + this.plugin.use( + staticPlugin({ + prefix: this.statics.route, + assets: this.statics.path, + }) + ); + + return this.plugin.as('plugin'); + } + + private registerRoute( + routeOrRoutes: string | string[], + method: HTTPMethod, + handler: AppControllerRoute['handler'] + ) { + const { bullBoardQueues } = this; + + if (!bullBoardQueues) { + throw new Error(`Please call 'setQueues' before using 'registerHandlers'`); + } + + const routes = Array.isArray(routeOrRoutes) ? routeOrRoutes : [routeOrRoutes]; + + for (const route of routes) { + this.plugin.route(method.toUpperCase(), route, async ({ params, body, query, set }) => { + const response = await handler({ + queues: this.bullBoardQueues as BullBoardQueues, + params, + body: body as Record, + query, + }); + + if (response.status) set.status = response.status; + + return response.body; + }); + } + } } From b5f71f61dd9a649a4aecc8c11d147b57416a64da Mon Sep 17 00:00:00 2001 From: kravetsone <57632712+kravetsone@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:00:41 +0300 Subject: [PATCH 8/9] chore: remove @elysiajs/static usage (switched to Bun.glob) --- packages/elysia/package.json | 1 - packages/elysia/src/ElysiaAdapter.ts | 7 ------- yarn.lock | 29 +++++----------------------- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/packages/elysia/package.json b/packages/elysia/package.json index 81be4e00..c683ebf6 100644 --- a/packages/elysia/package.json +++ b/packages/elysia/package.json @@ -36,7 +36,6 @@ "dependencies": { "@bull-board/api": "6.4.0", "@bull-board/ui": "6.4.0", - "@elysiajs/static": "^1.1.1", "ejs": "^3.1.10" }, "peerDependencies": { diff --git a/packages/elysia/src/ElysiaAdapter.ts b/packages/elysia/src/ElysiaAdapter.ts index 841f132d..11b22d20 100644 --- a/packages/elysia/src/ElysiaAdapter.ts +++ b/packages/elysia/src/ElysiaAdapter.ts @@ -128,13 +128,6 @@ export class ElysiaAdapter implements IServerAdapter { ); } - this.plugin.use( - staticPlugin({ - prefix: this.statics.route, - assets: this.statics.path, - }) - ); - return this.plugin.as('plugin'); } diff --git a/yarn.lock b/yarn.lock index 91246053..167e57ff 100644 --- a/yarn.lock +++ b/yarn.lock @@ -500,13 +500,6 @@ dependencies: "@jridgewell/trace-mapping" "0.3.9" -"@elysiajs/static@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@elysiajs/static/-/static-1.1.1.tgz#f6ba0406a1e9cd7614aeaad754d6481252513e72" - integrity sha512-H1KqsuNHhHKYKUkPoies0pPQBgbA4qsfre840FKraeF99jz++2P/igrOagp8cWqwFGrHP1V+nwGlGm9U6rZAEg== - dependencies: - node-cache "^5.1.2" - "@eslint-community/eslint-utils@^4.2.0": version "4.4.0" resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" @@ -5003,11 +4996,6 @@ clone-deep@^4.0.1: kind-of "^6.0.2" shallow-clone "^3.0.0" -clone@2.x: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w== - clone@^1.0.2: version "1.0.4" resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" @@ -5863,6 +5851,11 @@ electron-to-chromium@^1.5.28: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.55.tgz#73684752aa2e1aa49cafb355a41386c6637e76a9" integrity sha512-6maZ2ASDOTBtjt9FhqYPRnbvKU5tjG0IN9SztUOWYw2AzNDNpKJYLJmlK0/En4Hs/aiWnB+JZ+gW19PIGszgKg== +electron-to-chromium@^1.5.41: + version "1.5.56" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.56.tgz#3213f369efc3a41091c3b2c05bc0f406108ac1df" + integrity sha512-7lXb9dAvimCFdvUMTyucD4mnIndt/xhRKFAlky0CyFogdnNmdPQNoHI23msF/2V4mpTxMzgMdjK4+YRlFlRQZw== + elysia@^1.1.24: version "1.1.24" resolved "https://registry.yarnpkg.com/elysia/-/elysia-1.1.24.tgz#093eeb60c8338e4e14bae33e3718b54682dbcabe" @@ -5873,11 +5866,6 @@ elysia@^1.1.24: fast-decode-uri-component "^1.0.1" openapi-types "^12.1.3" -electron-to-chromium@^1.5.41: - version "1.5.56" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.56.tgz#3213f369efc3a41091c3b2c05bc0f406108ac1df" - integrity sha512-7lXb9dAvimCFdvUMTyucD4mnIndt/xhRKFAlky0CyFogdnNmdPQNoHI23msF/2V4mpTxMzgMdjK4+YRlFlRQZw== - emittery@^0.13.1: version "0.13.1" resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" @@ -9732,13 +9720,6 @@ node-abort-controller@^3.0.1, node-abort-controller@^3.1.1: resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.1.1.tgz#a94377e964a9a37ac3976d848cb5c765833b8548" integrity sha512-AGK2yQKIjRuqnc6VkX2Xj5d+QW8xZ87pa1UK6yA6ouUyuxfHuMP6umE5QK7UmTeOAymo+Zx1Fxiuw9rVx8taHQ== -node-cache@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/node-cache/-/node-cache-5.1.2.tgz#f264dc2ccad0a780e76253a694e9fd0ed19c398d" - integrity sha512-t1QzWwnk4sjLWaQAS8CHgOJ+RAfmHpxFWmc36IWTiWHQfs0w5JDMBS1b1ZxQteo0vVVuWJvIUKHDkkeK7vIGCg== - dependencies: - clone "2.x" - node-domexception@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" From 9bac57f56495a6ccc9633d9d037cada497a2e048 Mon Sep 17 00:00:00 2001 From: kravetsone <57632712+kravetsone@users.noreply.github.com> Date: Wed, 13 Nov 2024 13:11:25 +0300 Subject: [PATCH 9/9] chore: remove `@elysiajs/static` import and switch to `elysia` at example (in user project shouldnt break types) --- examples/with-elysia/index.ts | 2 +- packages/elysia/src/ElysiaAdapter.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/with-elysia/index.ts b/examples/with-elysia/index.ts index ba6d5526..b658d3cc 100644 --- a/examples/with-elysia/index.ts +++ b/examples/with-elysia/index.ts @@ -2,7 +2,7 @@ import { createBullBoard } from '@bull-board/api'; import { BullMQAdapter } from '@bull-board/api/bullMQAdapter'; import { ElysiaAdapter } from '@bull-board/elysia'; import { Queue as QueueMQ, Worker } from 'bullmq'; -import Elysia from '../../node_modules/elysia'; +import Elysia from 'elysia'; const sleep = (t: number) => new Promise((resolve) => setTimeout(resolve, t * 1000)); diff --git a/packages/elysia/src/ElysiaAdapter.ts b/packages/elysia/src/ElysiaAdapter.ts index 11b22d20..5d260c7e 100644 --- a/packages/elysia/src/ElysiaAdapter.ts +++ b/packages/elysia/src/ElysiaAdapter.ts @@ -7,7 +7,6 @@ import type { IServerAdapter, UIConfig, } from '@bull-board/api/dist/typings/app'; -import staticPlugin from '@elysiajs/static'; import ejs from 'ejs'; import { Elysia } from 'elysia';