@diamir/nestjs-maintenance 11.0.2 → 12.0.0-beta.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/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diamir/nestjs-maintenance",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0-beta.0",
|
|
4
4
|
"description": "Nestjs maintenance middleware and lock",
|
|
5
5
|
"author": "Backend <backend@diamir.io>",
|
|
6
|
-
"repository":
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/tailoredmedia/backend-nx-skeleton"
|
|
9
|
+
},
|
|
7
10
|
"license": "ISC",
|
|
8
11
|
"publishConfig": {
|
|
9
12
|
"access": "public"
|
|
@@ -18,11 +21,11 @@
|
|
|
18
21
|
"main": "./src/index.js",
|
|
19
22
|
"dependencies": {},
|
|
20
23
|
"peerDependencies": {
|
|
21
|
-
"@nestjs/common": ">=
|
|
24
|
+
"@nestjs/common": ">= 12.0.0"
|
|
22
25
|
},
|
|
23
26
|
"peerDependenciesMeta": {},
|
|
24
27
|
"engines": {
|
|
25
|
-
"node": ">=
|
|
28
|
+
"node": ">= 22"
|
|
26
29
|
},
|
|
27
30
|
"types": "./src/index.d.ts",
|
|
28
31
|
"type": "commonjs"
|
|
@@ -13,7 +13,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.MaintenanceMiddleware = void 0;
|
|
16
|
-
const
|
|
16
|
+
const decorators_1 = require("./decorators");
|
|
17
17
|
const maintenance_service_1 = require("./maintenance.service");
|
|
18
18
|
let MaintenanceMiddleware = class MaintenanceMiddleware {
|
|
19
19
|
service;
|
|
@@ -29,6 +29,6 @@ let MaintenanceMiddleware = class MaintenanceMiddleware {
|
|
|
29
29
|
};
|
|
30
30
|
exports.MaintenanceMiddleware = MaintenanceMiddleware;
|
|
31
31
|
exports.MaintenanceMiddleware = MaintenanceMiddleware = __decorate([
|
|
32
|
-
__param(0, (0,
|
|
32
|
+
__param(0, (0, decorators_1.InjectMaintenanceService)()),
|
|
33
33
|
__metadata("design:paramtypes", [maintenance_service_1.MaintenanceService])
|
|
34
34
|
], MaintenanceMiddleware);
|
|
@@ -11,25 +11,19 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var MaintenanceService_1;
|
|
15
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
15
|
exports.MaintenanceService = void 0;
|
|
17
16
|
const promises_1 = require("node:fs/promises");
|
|
18
17
|
const node_path_1 = require("node:path");
|
|
19
18
|
const common_1 = require("@nestjs/common");
|
|
20
19
|
let MaintenanceService = class MaintenanceService {
|
|
21
|
-
static { MaintenanceService_1 = this; }
|
|
22
|
-
static instance;
|
|
23
20
|
message;
|
|
24
21
|
logger = new common_1.Logger(this.constructor.name);
|
|
25
22
|
lockfile;
|
|
26
23
|
tasks = [];
|
|
27
24
|
constructor(options) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.lockfile = (0, node_path_1.resolve)(options?.lockfilePath ?? 'maintenance.lock');
|
|
31
|
-
MaintenanceService_1.instance = this;
|
|
32
|
-
}
|
|
25
|
+
this.message = `${options?.application ?? process.env.PACKAGE_NAME ?? 'Application'} is currently down for maintenance`;
|
|
26
|
+
this.lockfile = (0, node_path_1.resolve)(options?.lockfilePath ?? 'maintenance.lock');
|
|
33
27
|
}
|
|
34
28
|
async enable(task = 'unknown-task') {
|
|
35
29
|
this.tasks.push(task);
|
|
@@ -71,7 +65,7 @@ let MaintenanceService = class MaintenanceService {
|
|
|
71
65
|
}
|
|
72
66
|
};
|
|
73
67
|
exports.MaintenanceService = MaintenanceService;
|
|
74
|
-
exports.MaintenanceService = MaintenanceService =
|
|
68
|
+
exports.MaintenanceService = MaintenanceService = __decorate([
|
|
75
69
|
(0, common_1.Injectable)(),
|
|
76
70
|
__param(0, (0, common_1.Optional)()),
|
|
77
71
|
__metadata("design:paramtypes", [Object])
|