@midwayjs/bull-board 3.0.0
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/README.md +9 -0
- package/dist/configuration.d.ts +12 -0
- package/dist/configuration.js +78 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -0
- package/index.d.ts +12 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as bull from '@midwayjs/bull';
|
|
2
|
+
import { MidwayApplicationManager } from '@midwayjs/core';
|
|
3
|
+
export declare class BullBoardConfiguration {
|
|
4
|
+
framework: bull.Framework;
|
|
5
|
+
applicationManager: MidwayApplicationManager;
|
|
6
|
+
bullBoardConfig: {
|
|
7
|
+
basePath?: string;
|
|
8
|
+
adapterOptions?: any;
|
|
9
|
+
};
|
|
10
|
+
onReady(): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
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
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BullBoardConfiguration = void 0;
|
|
13
|
+
const decorator_1 = require("@midwayjs/decorator");
|
|
14
|
+
const bull = require("@midwayjs/bull");
|
|
15
|
+
const core_1 = require("@midwayjs/core");
|
|
16
|
+
const api_1 = require("@bull-board/api");
|
|
17
|
+
const bullAdapter_1 = require("@bull-board/api/bullAdapter");
|
|
18
|
+
const express_1 = require("@bull-board/express");
|
|
19
|
+
const koa_1 = require("@bull-board/koa");
|
|
20
|
+
let BullBoardConfiguration = class BullBoardConfiguration {
|
|
21
|
+
async onReady() {
|
|
22
|
+
const queueList = this.framework.getQueueList();
|
|
23
|
+
const wrapQueues = queueList.map(queue => new bullAdapter_1.BullAdapter(queue));
|
|
24
|
+
const basePath = this.bullBoardConfig.basePath;
|
|
25
|
+
const expressApp = this.applicationManager.getApplication('express');
|
|
26
|
+
if (expressApp) {
|
|
27
|
+
const serverAdapter = new express_1.ExpressAdapter();
|
|
28
|
+
(0, api_1.createBullBoard)({
|
|
29
|
+
queues: wrapQueues,
|
|
30
|
+
serverAdapter,
|
|
31
|
+
});
|
|
32
|
+
serverAdapter.setBasePath(basePath);
|
|
33
|
+
expressApp['originUse'](basePath, serverAdapter.getRouter());
|
|
34
|
+
}
|
|
35
|
+
const apps = this.applicationManager.getApplications(['egg', 'koa']);
|
|
36
|
+
for (const app of apps) {
|
|
37
|
+
const serverAdapter = new koa_1.KoaAdapter();
|
|
38
|
+
(0, api_1.createBullBoard)({
|
|
39
|
+
queues: wrapQueues,
|
|
40
|
+
serverAdapter,
|
|
41
|
+
});
|
|
42
|
+
serverAdapter.setBasePath(basePath);
|
|
43
|
+
await app.useMiddleware(serverAdapter.registerPlugin());
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, decorator_1.Inject)(),
|
|
49
|
+
__metadata("design:type", bull.Framework)
|
|
50
|
+
], BullBoardConfiguration.prototype, "framework", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, decorator_1.Inject)(),
|
|
53
|
+
__metadata("design:type", core_1.MidwayApplicationManager)
|
|
54
|
+
], BullBoardConfiguration.prototype, "applicationManager", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, decorator_1.Config)('bullBoard'),
|
|
57
|
+
__metadata("design:type", Object)
|
|
58
|
+
], BullBoardConfiguration.prototype, "bullBoardConfig", void 0);
|
|
59
|
+
BullBoardConfiguration = __decorate([
|
|
60
|
+
(0, decorator_1.Configuration)({
|
|
61
|
+
namespace: 'bull-board',
|
|
62
|
+
imports: [bull],
|
|
63
|
+
importConfigs: [
|
|
64
|
+
{
|
|
65
|
+
default: {
|
|
66
|
+
bullBoard: {
|
|
67
|
+
basePath: 'ui',
|
|
68
|
+
adapterOptions: {
|
|
69
|
+
readOnlyMode: false,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
})
|
|
76
|
+
], BullBoardConfiguration);
|
|
77
|
+
exports.BullBoardConfiguration = BullBoardConfiguration;
|
|
78
|
+
//# sourceMappingURL=configuration.js.map
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Configuration = void 0;
|
|
4
|
+
var configuration_1 = require("./configuration");
|
|
5
|
+
Object.defineProperty(exports, "Configuration", { enumerable: true, get: function () { return configuration_1.BullBoardConfiguration; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { QueueAdapterOptions } from '@bull-board/api/dist/typings/app';
|
|
2
|
+
export * from './dist/index';
|
|
3
|
+
|
|
4
|
+
declare module '@midwayjs/core/dist/interface' {
|
|
5
|
+
// eslint-disable-next-line
|
|
6
|
+
interface MidwayConfig {
|
|
7
|
+
bullBoard?: {
|
|
8
|
+
basePath?: string;
|
|
9
|
+
adapterOptions?: QueueAdapterOptions;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@midwayjs/bull-board",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "midway component for bull",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"typings": "index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
|
|
10
|
+
"cov": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand --coverage --forceExit"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"midway",
|
|
14
|
+
"IoC",
|
|
15
|
+
"bull",
|
|
16
|
+
"bull-ui",
|
|
17
|
+
"plugin"
|
|
18
|
+
],
|
|
19
|
+
"author": "",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist/**/*.js",
|
|
22
|
+
"dist/**/*.d.ts",
|
|
23
|
+
"index.d.ts"
|
|
24
|
+
],
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@midwayjs/core": "^3.4.13",
|
|
28
|
+
"@midwayjs/decorator": "^3.4.11",
|
|
29
|
+
"@midwayjs/mock": "^3.4.13"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@bull-board/api": "4.3.1",
|
|
33
|
+
"@bull-board/express": "4.3.1",
|
|
34
|
+
"@bull-board/koa": "4.3.1",
|
|
35
|
+
"@midwayjs/bull": "^3.0.3"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=12"
|
|
39
|
+
}
|
|
40
|
+
}
|