From 42151afb4721c8085cc03280c7aacf4299648489 Mon Sep 17 00:00:00 2001 From: Markus Machatschek Date: Mon, 5 Dec 2022 14:26:00 +0100 Subject: [PATCH 1/3] Reexport api functions in server adapters --- README.md | 11 ++++------- example.ts | 5 +---- examples/with-express-auth/index.js | 4 +--- examples/with-express/index.js | 4 +--- examples/with-fastify-auth/basicAuth.js | 4 +--- examples/with-fastify-auth/cookieAuth.js | 4 +--- examples/with-fastify/index.js | 4 +--- examples/with-hapi-auth/index.js | 4 +--- examples/with-hapi/index.js | 4 +--- examples/with-koa/index.js | 4 +--- packages/express/src/index.ts | 3 +++ packages/fastify/src/index.ts | 3 +++ packages/hapi/src/index.ts | 3 +++ packages/koa/src/index.ts | 3 +++ 14 files changed, 25 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 50303b48..6b8d5bdf 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,7 @@ npm i @bull-board/koa const express = require('express'); const Queue = require('bull'); const QueueMQ = require('bullmq'); -const { createBullBoard } = require('@bull-board/api'); -const { BullAdapter } = require('@bull-board/api/bullAdapter'); -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); -const { ExpressAdapter } = require('@bull-board/express'); +const { ExpressAdapter, createBullBoard, BullAdapter, BullMQAdapter } = require('@bull-board/express'); const someQueue = new Queue('someQueueName', { redis: { port: 6379, host: '127.0.0.1', password: 'foobared' }, @@ -160,9 +157,9 @@ If you host your express service on a different path than root (/) ie. https://< ```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 { } = require('@bull-board/api') +const { } = require('@bull-board/api/bullAdapter') +const { ExpressAdapter, createBullBoard, BullAdapter } = require('@bull-board/express') const basePath = '/my-base-path'; diff --git a/example.ts b/example.ts index 9a5b1d4d..25974fec 100644 --- a/example.ts +++ b/example.ts @@ -2,10 +2,7 @@ import * as Bull from 'bull'; import Queue3 from 'bull'; import { Queue as QueueMQ, QueueScheduler, Worker } from 'bullmq'; import express from 'express'; -import { BullMQAdapter } from '@bull-board/api/src/queueAdapters/bullMQ'; -import { BullAdapter } from '@bull-board/api/src/queueAdapters/bull'; -import { createBullBoard } from '@bull-board/api/src'; -import { ExpressAdapter } from '@bull-board/express/src'; +import { ExpressAdapter, createBullBoard, BullMQAdapter, BullAdapter } from '@bull-board/express/src'; const redisOptions = { port: 6379, diff --git a/examples/with-express-auth/index.js b/examples/with-express-auth/index.js index 0cfbf81e..cf435377 100644 --- a/examples/with-express-auth/index.js +++ b/examples/with-express-auth/index.js @@ -1,6 +1,4 @@ -const { createBullBoard } = require('@bull-board/api'); -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); -const { ExpressAdapter } = require('@bull-board/express'); +const { ExpressAdapter, createBullBoard, BullMQAdapter } = require('@bull-board/express'); const { Queue: QueueMQ, Worker, QueueScheduler } = require('bullmq'); const session = require('express-session'); const bodyParser = require('body-parser'); diff --git a/examples/with-express/index.js b/examples/with-express/index.js index 2aa11eff..9b7bd6ab 100644 --- a/examples/with-express/index.js +++ b/examples/with-express/index.js @@ -1,6 +1,4 @@ -const { createBullBoard } = require('@bull-board/api'); -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); -const { ExpressAdapter } = require('@bull-board/express'); +const { ExpressAdapter, createBullBoard, BullMQAdapter } = require('@bull-board/express'); const { Queue: QueueMQ, Worker, QueueScheduler } = require('bullmq'); const express = require('express'); diff --git a/examples/with-fastify-auth/basicAuth.js b/examples/with-fastify-auth/basicAuth.js index 16b7c360..65abf4f3 100644 --- a/examples/with-fastify-auth/basicAuth.js +++ b/examples/with-fastify-auth/basicAuth.js @@ -1,6 +1,4 @@ -const { FastifyAdapter } = require('@bull-board/fastify'); -const { createBullBoard } = require('@bull-board/api'); -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); +const { FastifyAdapter, createBullBoard, BullMQAdapter } = require('@bull-board/fastify'); module.exports.basicAuth = function basicAuth(fastify, { queue }, next) { const authenticate = { realm: 'Bull-Board' }; diff --git a/examples/with-fastify-auth/cookieAuth.js b/examples/with-fastify-auth/cookieAuth.js index fad9c8eb..1902b6b1 100644 --- a/examples/with-fastify-auth/cookieAuth.js +++ b/examples/with-fastify-auth/cookieAuth.js @@ -1,6 +1,4 @@ -const { FastifyAdapter } = require('@bull-board/fastify'); -const { createBullBoard } = require('@bull-board/api'); -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); +const { FastifyAdapter, createBullBoard, BullMQAdapter } = require('@bull-board/fastify'); const pointOfView = require('@fastify/view'); const path = require('path'); diff --git a/examples/with-fastify/index.js b/examples/with-fastify/index.js index b5c9360f..693b268e 100644 --- a/examples/with-fastify/index.js +++ b/examples/with-fastify/index.js @@ -1,6 +1,4 @@ -const { createBullBoard } = require('@bull-board/api'); -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); -const { FastifyAdapter } = require('@bull-board/fastify'); +const { FastifyAdapter, createBullBoard, BullMQAdapter } = require('@bull-board/fastify'); const { Queue: QueueMQ, Worker, QueueScheduler } = require('bullmq'); const fastify = require('fastify'); diff --git a/examples/with-hapi-auth/index.js b/examples/with-hapi-auth/index.js index 9ead6725..7f96a34a 100644 --- a/examples/with-hapi-auth/index.js +++ b/examples/with-hapi-auth/index.js @@ -1,6 +1,4 @@ -const { createBullBoard } = require('@bull-board/api'); -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); -const { HapiAdapter } = require('@bull-board/hapi'); +const { HapiAdapter, createBullBoard, BullMQAdapter } = require('@bull-board/hapi'); const { Queue: QueueMQ, Worker, QueueScheduler } = require('bullmq'); const Hapi = require('@hapi/hapi'); diff --git a/examples/with-hapi/index.js b/examples/with-hapi/index.js index 758b9df1..7cc85db8 100644 --- a/examples/with-hapi/index.js +++ b/examples/with-hapi/index.js @@ -1,6 +1,4 @@ -const { createBullBoard } = require('@bull-board/api'); -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); -const { HapiAdapter } = require('@bull-board/hapi'); +const { HapiAdapter, createBullBoard, BullMQAdapter } = require('@bull-board/hapi'); const { Queue: QueueMQ, Worker, QueueScheduler } = require('bullmq'); const Hapi = require('@hapi/hapi'); diff --git a/examples/with-koa/index.js b/examples/with-koa/index.js index 760a0bed..1570c33c 100644 --- a/examples/with-koa/index.js +++ b/examples/with-koa/index.js @@ -1,6 +1,4 @@ -const { createBullBoard } = require('@bull-board/api'); -const { BullMQAdapter } = require('@bull-board/api/bullMQAdapter'); -const { KoaAdapter } = require('@bull-board/koa'); +const { KoaAdapter, createBullBoard, BullMQAdapter } = require('@bull-board/koa'); const { Queue: QueueMQ, Worker, QueueScheduler } = require('bullmq'); const Koa = require('koa'); const Router = require('koa-router'); diff --git a/packages/express/src/index.ts b/packages/express/src/index.ts index cbdabd3a..008fe96c 100644 --- a/packages/express/src/index.ts +++ b/packages/express/src/index.ts @@ -1 +1,4 @@ +export { createBullBoard } from '@bull-board/api'; +export { BullAdapter } from '@bull-board/api/bullAdapter'; +export { BullMQAdapter } from '@bull-board/api/bullMQAdapter'; export { ExpressAdapter } from './ExpressAdapter'; diff --git a/packages/fastify/src/index.ts b/packages/fastify/src/index.ts index deb83f43..1ef906f7 100644 --- a/packages/fastify/src/index.ts +++ b/packages/fastify/src/index.ts @@ -1 +1,4 @@ export { FastifyAdapter } from './FastifyAdapter'; +export { BullAdapter } from '@bull-board/api/bullAdapter'; +export { BullMQAdapter } from '@bull-board/api/bullMQAdapter'; +export { ExpressAdapter } from './ExpressAdapter'; diff --git a/packages/hapi/src/index.ts b/packages/hapi/src/index.ts index 421c6fcf..8fd5ad58 100644 --- a/packages/hapi/src/index.ts +++ b/packages/hapi/src/index.ts @@ -1 +1,4 @@ export { HapiAdapter } from './HapiAdapter'; +export { BullAdapter } from '@bull-board/api/bullAdapter'; +export { BullMQAdapter } from '@bull-board/api/bullMQAdapter'; +export { ExpressAdapter } from './ExpressAdapter'; diff --git a/packages/koa/src/index.ts b/packages/koa/src/index.ts index 9b713b54..510759fe 100644 --- a/packages/koa/src/index.ts +++ b/packages/koa/src/index.ts @@ -1 +1,4 @@ export { KoaAdapter } from './KoaAdapter'; +export { BullAdapter } from '@bull-board/api/bullAdapter'; +export { BullMQAdapter } from '@bull-board/api/bullMQAdapter'; +export { ExpressAdapter } from './ExpressAdapter'; From 12db86bc55912c132d4f28d4c23468880e8e2ca7 Mon Sep 17 00:00:00 2001 From: Markus Machatschek Date: Mon, 5 Dec 2022 14:35:56 +0100 Subject: [PATCH 2/3] fix exports --- packages/fastify/src/index.ts | 4 ++-- packages/hapi/src/index.ts | 4 ++-- packages/koa/src/index.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/fastify/src/index.ts b/packages/fastify/src/index.ts index 1ef906f7..2020d40e 100644 --- a/packages/fastify/src/index.ts +++ b/packages/fastify/src/index.ts @@ -1,4 +1,4 @@ -export { FastifyAdapter } from './FastifyAdapter'; +export { createBullBoard } from '@bull-board/api'; export { BullAdapter } from '@bull-board/api/bullAdapter'; export { BullMQAdapter } from '@bull-board/api/bullMQAdapter'; -export { ExpressAdapter } from './ExpressAdapter'; +export { FastifyAdapter } from './FastifyAdapter'; diff --git a/packages/hapi/src/index.ts b/packages/hapi/src/index.ts index 8fd5ad58..de870af1 100644 --- a/packages/hapi/src/index.ts +++ b/packages/hapi/src/index.ts @@ -1,4 +1,4 @@ -export { HapiAdapter } from './HapiAdapter'; +export { createBullBoard } from '@bull-board/api'; export { BullAdapter } from '@bull-board/api/bullAdapter'; export { BullMQAdapter } from '@bull-board/api/bullMQAdapter'; -export { ExpressAdapter } from './ExpressAdapter'; +export { HapiAdapter } from './HapiAdapter'; diff --git a/packages/koa/src/index.ts b/packages/koa/src/index.ts index 510759fe..599b0f2c 100644 --- a/packages/koa/src/index.ts +++ b/packages/koa/src/index.ts @@ -1,4 +1,4 @@ -export { KoaAdapter } from './KoaAdapter'; +export { createBullBoard } from '@bull-board/api'; export { BullAdapter } from '@bull-board/api/bullAdapter'; export { BullMQAdapter } from '@bull-board/api/bullMQAdapter'; -export { ExpressAdapter } from './ExpressAdapter'; +export { KoaAdapter } from './KoaAdapter'; From 152c2fcc56d73e92d48b254f0fe3de9b320ab8f5 Mon Sep 17 00:00:00 2001 From: Markus Machatschek Date: Mon, 5 Dec 2022 14:37:28 +0100 Subject: [PATCH 3/3] fix readme --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 6b8d5bdf..ad85dfcd 100644 --- a/README.md +++ b/README.md @@ -157,8 +157,6 @@ If you host your express service on a different path than root (/) ie. https://< ```js const Queue = require('bull') -const { } = require('@bull-board/api') -const { } = require('@bull-board/api/bullAdapter') const { ExpressAdapter, createBullBoard, BullAdapter } = require('@bull-board/express') const basePath = '/my-base-path';