Skip to content

Commit

Permalink
Merge branch 'pr/kravetsone/1' into add-elysia-adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
kravetsone committed Nov 13, 2024
2 parents a49233e + 9892a50 commit 2936fbd
Show file tree
Hide file tree
Showing 25 changed files with 1,941 additions and 2,157 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@ 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.1](https://github.com/felixmosh/bull-board/compare/v6.4.0...v6.4.1)

- Add elysia adapter [`#769`](https://github.com/felixmosh/bull-board/pull/769)
- chore(deps): bump webpack in the npm_and_yarn group across 1 directory [`#848`](https://github.com/felixmosh/bull-board/pull/848)
- fix: allow usage of bullmq-pro, closes #849 [`#849`](https://github.com/felixmosh/bull-board/issues/849)
- Deps bump [`b00834d`](https://github.com/felixmosh/bull-board/commit/b00834d453257975b65312101f9b6bbe51155637)
- Revert "Add elysia adapter (#769)" [`4b175fa`](https://github.com/felixmosh/bull-board/commit/4b175fae5ce5ce8485e74cacc88d0428e681b7d0)
- feat: remove babel.config & webpack [`0677784`](https://github.com/felixmosh/bull-board/commit/06777841932d253d3adf8b669be3b4f393f9a1cc)

#### [v6.4.0](https://github.com/felixmosh/bull-board/compare/v6.3.3...v6.4.0)

> 12 November 2024
- feat: paused jobs: support edit/duplicate/clean [`#846`](https://github.com/felixmosh/bull-board/pull/846)
- Release 6.4.0 [`b423427`](https://github.com/felixmosh/bull-board/commit/b423427621590e921bd1dd44452e4f4c0123f968)

#### [v6.3.3](https://github.com/felixmosh/bull-board/compare/v6.3.2...v6.3.3)

Expand Down
96 changes: 46 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand All @@ -29,7 +29,6 @@ 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

Expand Down Expand Up @@ -60,12 +59,9 @@ 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
Expand Down Expand Up @@ -108,8 +104,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:

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)
Expand All @@ -118,24 +114,23 @@ 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)
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)
8. [With H3 server using the h3 adapter](https://github.com/felixmosh/bull-board/tree/master/examples/with-h3) (Thanx to @genu)

### Board options

### 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();

Expand All @@ -150,7 +145,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',
Expand All @@ -161,46 +156,45 @@ 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`)
Expand All @@ -218,40 +212,42 @@ 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

If you host your express service on a different path than root (/) ie. https://<server_name>/<sub_path>/, 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

Expand Down
3 changes: 0 additions & 3 deletions examples/with-elysia/README.md

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bull-board/root",
"version": "6.4.0",
"version": "6.4.1",
"private": true,
"description": "Bull queue UI for inspecting jobs",
"keywords": [
Expand Down
4 changes: 2 additions & 2 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bull-board/api",
"version": "6.4.0",
"version": "6.4.1",
"description": "A Dashboard server API built on top of bull or bullmq.",
"keywords": [
"bull",
Expand Down Expand Up @@ -39,7 +39,7 @@
"supertest": "^6.3.3"
},
"peerDependencies": {
"@bull-board/ui": "6.4.0"
"@bull-board/ui": "6.4.1"
},
"publishConfig": {
"access": "public"
Expand Down
5 changes: 3 additions & 2 deletions packages/api/src/queueAdapters/bullMQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ import { BaseAdapter } from './base';

export class BullMQAdapter extends BaseAdapter {
constructor(private queue: Queue, options: Partial<QueueAdapterOptions> = {}) {
super('bullmq', options);
if (!(queue instanceof Queue)) {
const libName = 'bullmq';
super(libName, options);
if (!(queue.metaValues?.version as string).startsWith(libName)) {
throw new Error(`You've used the BullMQ adapter with a non-BullMQ queue.`);
}
}
Expand Down
29 changes: 0 additions & 29 deletions packages/elysia/README.md

This file was deleted.

1 change: 0 additions & 1 deletion packages/elysia/src/index.ts

This file was deleted.

25 changes: 0 additions & 25 deletions packages/elysia/tsconfig.json

This file was deleted.

11 changes: 5 additions & 6 deletions packages/express/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bull-board/express",
"version": "6.4.0",
"version": "6.4.1",
"description": "A Express.js server adapter for Bull-Board dashboard.",
"keywords": [
"bull",
Expand Down Expand Up @@ -28,15 +28,14 @@
"clean": "rm -rf dist"
},
"dependencies": {
"@bull-board/api": "6.4.0",
"@bull-board/ui": "6.4.0",
"@bull-board/api": "6.4.1",
"@bull-board/ui": "6.4.1",
"ejs": "^3.1.10",
"express": "^4.19.2"
"express": "^4.21.1"
},
"devDependencies": {
"@types/ejs": "^3.1.5",
"@types/express": "^4.17.12",
"@types/express-serve-static-core": "^4.17.28"
"@types/express": "^4.17.21"
},
"publishConfig": {
"access": "public"
Expand Down
11 changes: 6 additions & 5 deletions packages/express/src/helpers/wrapAsync.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ParamsDictionary, RequestHandler } from 'express-serve-static-core';
import { NextFunction } from 'express';
import { Request, Response, RequestHandler } from 'express-serve-static-core';

export const wrapAsync = <Params extends ParamsDictionary>(
fn: RequestHandler<Params>
): RequestHandler<Params> => async (req, res, next) =>
Promise.resolve(fn(req, res, next)).catch(next);
export const wrapAsync =
(fn: RequestHandler): RequestHandler =>
async (req: Request, res: Response, next: NextFunction) =>
Promise.resolve(fn(req, res, next)).catch(next);
6 changes: 3 additions & 3 deletions packages/fastify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bull-board/fastify",
"version": "6.4.0",
"version": "6.4.1",
"description": "A Fastify.js server adapter for Bull-Board dashboard.",
"keywords": [
"bull",
Expand Down Expand Up @@ -28,8 +28,8 @@
"clean": "rm -rf dist"
},
"dependencies": {
"@bull-board/api": "6.4.0",
"@bull-board/ui": "6.4.0",
"@bull-board/api": "6.4.1",
"@bull-board/ui": "6.4.1",
"@fastify/static": "^8.0.1",
"@fastify/view": "^10.0.1",
"ejs": "^3.1.10"
Expand Down
Loading

0 comments on commit 2936fbd

Please sign in to comment.