@midwayjs/bull-board 3.20.5 → 3.20.6-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/board.manager.d.ts +11 -0
- package/dist/board.manager.js +59 -0
- package/dist/board.middleware.d.ts +1 -4
- package/dist/board.middleware.js +2 -47
- package/dist/configuration.d.ts +1 -0
- package/dist/configuration.js +4 -0
- package/package.json +2 -3
- package/LICENSE +0 -21
package/dist/board.manager.d.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import { IMidwayContainer, MidwayFrameworkService } from '@midwayjs/core';
|
|
1
2
|
import { createBullBoard } from '@bull-board/api';
|
|
2
3
|
import { BaseAdapter } from '@bull-board/api/dist/src/queueAdapters/base';
|
|
4
|
+
import { MidwayAdapter } from './adapter';
|
|
5
|
+
import { BullBoardOption } from './interface';
|
|
3
6
|
export declare class BullBoardManager {
|
|
4
7
|
private bullBoard;
|
|
8
|
+
protected bullBoardConfig: BullBoardOption;
|
|
9
|
+
protected frameworkService: MidwayFrameworkService;
|
|
10
|
+
protected applicationContext: IMidwayContainer;
|
|
11
|
+
private basePath;
|
|
12
|
+
private serverAdapter;
|
|
13
|
+
protected init(): Promise<void>;
|
|
14
|
+
getBasePath(): string;
|
|
15
|
+
getServerAdapter(): MidwayAdapter;
|
|
5
16
|
setBullBoard(bullBoard: ReturnType<typeof createBullBoard>): void;
|
|
6
17
|
getBullBoardOrigin(): ReturnType<typeof createBullBoard>;
|
|
7
18
|
addQueue(queue: BaseAdapter): void;
|
package/dist/board.manager.js
CHANGED
|
@@ -5,10 +5,51 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
8
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
12
|
exports.BullBoardManager = void 0;
|
|
10
13
|
const core_1 = require("@midwayjs/core");
|
|
14
|
+
const api_1 = require("@bull-board/api");
|
|
15
|
+
const bullAdapter_1 = require("@bull-board/api/bullAdapter");
|
|
16
|
+
const bullMQAdapter_1 = require("@bull-board/api/bullMQAdapter");
|
|
17
|
+
const adapter_1 = require("./adapter");
|
|
11
18
|
let BullBoardManager = class BullBoardManager {
|
|
19
|
+
async init() {
|
|
20
|
+
let framework = this.frameworkService.getFramework('bull');
|
|
21
|
+
if (!framework) {
|
|
22
|
+
framework = this.frameworkService.getFramework('bullmq');
|
|
23
|
+
}
|
|
24
|
+
if (!framework) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const queueList = framework.getQueueList();
|
|
28
|
+
const wrapQueues = queueList.map(queue => {
|
|
29
|
+
if (this.applicationContext.hasNamespace('bull')) {
|
|
30
|
+
return new bullAdapter_1.BullAdapter(queue);
|
|
31
|
+
}
|
|
32
|
+
else if (this.applicationContext.hasNamespace('bullmq')) {
|
|
33
|
+
return new bullMQAdapter_1.BullMQAdapter(queue);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
this.basePath = this.bullBoardConfig.basePath;
|
|
37
|
+
this.serverAdapter = new adapter_1.MidwayAdapter();
|
|
38
|
+
this.bullBoard = (0, api_1.createBullBoard)({
|
|
39
|
+
queues: wrapQueues,
|
|
40
|
+
serverAdapter: this.serverAdapter,
|
|
41
|
+
options: {
|
|
42
|
+
uiConfig: this.bullBoardConfig.uiConfig,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
this.serverAdapter.setBasePath(this.basePath);
|
|
46
|
+
}
|
|
47
|
+
getBasePath() {
|
|
48
|
+
return this.basePath;
|
|
49
|
+
}
|
|
50
|
+
getServerAdapter() {
|
|
51
|
+
return this.serverAdapter;
|
|
52
|
+
}
|
|
12
53
|
setBullBoard(bullBoard) {
|
|
13
54
|
this.bullBoard = bullBoard;
|
|
14
55
|
}
|
|
@@ -28,6 +69,24 @@ let BullBoardManager = class BullBoardManager {
|
|
|
28
69
|
this.bullBoard.setQueues(newBullQueues);
|
|
29
70
|
}
|
|
30
71
|
};
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, core_1.Config)('bullBoard'),
|
|
74
|
+
__metadata("design:type", Object)
|
|
75
|
+
], BullBoardManager.prototype, "bullBoardConfig", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, core_1.Inject)(),
|
|
78
|
+
__metadata("design:type", core_1.MidwayFrameworkService)
|
|
79
|
+
], BullBoardManager.prototype, "frameworkService", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, core_1.ApplicationContext)(),
|
|
82
|
+
__metadata("design:type", Object)
|
|
83
|
+
], BullBoardManager.prototype, "applicationContext", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, core_1.Init)(),
|
|
86
|
+
__metadata("design:type", Function),
|
|
87
|
+
__metadata("design:paramtypes", []),
|
|
88
|
+
__metadata("design:returntype", Promise)
|
|
89
|
+
], BullBoardManager.prototype, "init", null);
|
|
31
90
|
BullBoardManager = __decorate([
|
|
32
91
|
(0, core_1.Singleton)()
|
|
33
92
|
], BullBoardManager);
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { IMiddleware, IMidwayApplication, IMidwayContext, NextFunction
|
|
1
|
+
import { IMiddleware, IMidwayApplication, IMidwayContext, NextFunction } from '@midwayjs/core';
|
|
2
2
|
import { BullBoardOption } from './interface';
|
|
3
3
|
import { BullBoardManager } from './board.manager';
|
|
4
4
|
export declare class BoardMiddleware implements IMiddleware<IMidwayContext, NextFunction, unknown> {
|
|
5
|
-
protected frameworkService: MidwayFrameworkService;
|
|
6
5
|
protected bullBoardConfig: BullBoardOption;
|
|
7
6
|
protected bullBoardManager: BullBoardManager;
|
|
8
|
-
protected applicationContext: IMidwayContainer;
|
|
9
7
|
private basePath;
|
|
10
8
|
private serverAdapter;
|
|
11
|
-
protected init(): Promise<void>;
|
|
12
9
|
resolve(app: IMidwayApplication): (req: any, res: any, next: NextFunction) => Promise<any>;
|
|
13
10
|
static getName(): string;
|
|
14
11
|
}
|
package/dist/board.middleware.js
CHANGED
|
@@ -12,10 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.BoardMiddleware = void 0;
|
|
13
13
|
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const path_1 = require("path");
|
|
15
|
-
const api_1 = require("@bull-board/api");
|
|
16
|
-
const bullAdapter_1 = require("@bull-board/api/bullAdapter");
|
|
17
|
-
const bullMQAdapter_1 = require("@bull-board/api/bullMQAdapter");
|
|
18
|
-
const adapter_1 = require("./adapter");
|
|
19
15
|
const board_manager_1 = require("./board.manager");
|
|
20
16
|
const MIME_MAP = {
|
|
21
17
|
'.html': 'text/html',
|
|
@@ -36,36 +32,9 @@ const MIME_MAP = {
|
|
|
36
32
|
'.otf': 'application/x-font-opentype',
|
|
37
33
|
};
|
|
38
34
|
let BoardMiddleware = class BoardMiddleware {
|
|
39
|
-
async init() {
|
|
40
|
-
let framework = this.frameworkService.getFramework('bull');
|
|
41
|
-
if (!framework) {
|
|
42
|
-
framework = this.frameworkService.getFramework('bullmq');
|
|
43
|
-
}
|
|
44
|
-
if (!framework) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const queueList = framework.getQueueList();
|
|
48
|
-
const wrapQueues = queueList.map(queue => {
|
|
49
|
-
if (this.applicationContext.hasNamespace('bull')) {
|
|
50
|
-
return new bullAdapter_1.BullAdapter(queue);
|
|
51
|
-
}
|
|
52
|
-
else if (this.applicationContext.hasNamespace('bullmq')) {
|
|
53
|
-
return new bullMQAdapter_1.BullMQAdapter(queue);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
this.basePath = this.bullBoardConfig.basePath;
|
|
57
|
-
this.serverAdapter = new adapter_1.MidwayAdapter();
|
|
58
|
-
const bullBoard = (0, api_1.createBullBoard)({
|
|
59
|
-
queues: wrapQueues,
|
|
60
|
-
serverAdapter: this.serverAdapter,
|
|
61
|
-
options: {
|
|
62
|
-
uiConfig: this.bullBoardConfig.uiConfig,
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
this.serverAdapter.setBasePath(this.basePath);
|
|
66
|
-
this.bullBoardManager.setBullBoard(bullBoard);
|
|
67
|
-
}
|
|
68
35
|
resolve(app) {
|
|
36
|
+
this.basePath = this.bullBoardManager.getBasePath();
|
|
37
|
+
this.serverAdapter = this.bullBoardManager.getServerAdapter();
|
|
69
38
|
if (app.getFrameworkType() === core_1.MidwayFrameworkType.WEB_EXPRESS) {
|
|
70
39
|
return async (req, res, next) => {
|
|
71
40
|
const pathname = req.path;
|
|
@@ -151,10 +120,6 @@ let BoardMiddleware = class BoardMiddleware {
|
|
|
151
120
|
return 'bull-board-ui';
|
|
152
121
|
}
|
|
153
122
|
};
|
|
154
|
-
__decorate([
|
|
155
|
-
(0, core_1.Inject)(),
|
|
156
|
-
__metadata("design:type", core_1.MidwayFrameworkService)
|
|
157
|
-
], BoardMiddleware.prototype, "frameworkService", void 0);
|
|
158
123
|
__decorate([
|
|
159
124
|
(0, core_1.Config)('bullBoard'),
|
|
160
125
|
__metadata("design:type", Object)
|
|
@@ -163,16 +128,6 @@ __decorate([
|
|
|
163
128
|
(0, core_1.Inject)(),
|
|
164
129
|
__metadata("design:type", board_manager_1.BullBoardManager)
|
|
165
130
|
], BoardMiddleware.prototype, "bullBoardManager", void 0);
|
|
166
|
-
__decorate([
|
|
167
|
-
(0, core_1.ApplicationContext)(),
|
|
168
|
-
__metadata("design:type", Object)
|
|
169
|
-
], BoardMiddleware.prototype, "applicationContext", void 0);
|
|
170
|
-
__decorate([
|
|
171
|
-
(0, core_1.Init)(),
|
|
172
|
-
__metadata("design:type", Function),
|
|
173
|
-
__metadata("design:paramtypes", []),
|
|
174
|
-
__metadata("design:returntype", Promise)
|
|
175
|
-
], BoardMiddleware.prototype, "init", null);
|
|
176
131
|
BoardMiddleware = __decorate([
|
|
177
132
|
(0, core_1.Provide)(),
|
|
178
133
|
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
|
package/dist/configuration.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ export declare class BullBoardConfiguration {
|
|
|
3
3
|
applicationManager: MidwayApplicationManager;
|
|
4
4
|
configService: MidwayConfigService;
|
|
5
5
|
onReady(container: IMidwayContainer): Promise<void>;
|
|
6
|
+
onServerReady(container: IMidwayContainer): Promise<void>;
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=configuration.d.ts.map
|
package/dist/configuration.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.BullBoardConfiguration = void 0;
|
|
13
13
|
const core_1 = require("@midwayjs/core");
|
|
14
14
|
const board_middleware_1 = require("./board.middleware");
|
|
15
|
+
const board_manager_1 = require("./board.manager");
|
|
15
16
|
let BullBoardConfiguration = class BullBoardConfiguration {
|
|
16
17
|
async onReady(container) {
|
|
17
18
|
const apps = this.applicationManager.getApplications([
|
|
@@ -28,6 +29,9 @@ let BullBoardConfiguration = class BullBoardConfiguration {
|
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
31
|
}
|
|
32
|
+
async onServerReady(container) {
|
|
33
|
+
await container.getAsync(board_manager_1.BullBoardManager);
|
|
34
|
+
}
|
|
31
35
|
};
|
|
32
36
|
__decorate([
|
|
33
37
|
(0, core_1.Inject)(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midwayjs/bull-board",
|
|
3
|
-
"version": "3.20.
|
|
3
|
+
"version": "3.20.6-beta.1",
|
|
4
4
|
"description": "midway component for bull",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -39,6 +39,5 @@
|
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=12"
|
|
42
|
-
}
|
|
43
|
-
"gitHead": "7ce57281bd3ef5d18dc50b47ff9bffb8a27c071e"
|
|
42
|
+
}
|
|
44
43
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2013 - Now midwayjs
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|