@clairejs/server 3.25.4 → 3.26.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 +10 -0
- package/dist/http/file-upload/FileUploadHandler.d.ts +4 -2
- package/dist/http/file-upload/FileUploadHandler.js +13 -24
- package/dist/job/AbstractJobScheduler.js +1 -1
- package/dist/system/ClaireServer.js +4 -5
- package/package.json +4 -4
- package/dist/common/constants.d.ts +0 -1
- package/dist/common/constants.js +0 -7
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AbstractFileService } from "../../services/AbstractFileService";
|
|
2
2
|
import { AbstractFileUploadHandler } from "./AbstractFileUploadHandler";
|
|
3
3
|
export declare class FileUploadHandler extends AbstractFileUploadHandler {
|
|
4
|
-
readonly fileService
|
|
5
|
-
|
|
4
|
+
private readonly fileService;
|
|
5
|
+
private readonly prefix;
|
|
6
|
+
constructor(fileService: AbstractFileService, prefix?: string);
|
|
7
|
+
protected getPath(uri: string): string;
|
|
6
8
|
moveFile(fromURI: string, toURI: string): Promise<void>;
|
|
7
9
|
copyFile(fromURI: string, toURI: string): Promise<void>;
|
|
8
10
|
removeFile(uri: string): Promise<void>;
|
|
@@ -1,41 +1,30 @@
|
|
|
1
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
-
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;
|
|
5
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { Injectable } from "@clairejs/core";
|
|
11
|
-
import { AbstractFileService } from "../../services/AbstractFileService";
|
|
12
1
|
import { AbstractFileUploadHandler } from "./AbstractFileUploadHandler";
|
|
13
|
-
|
|
2
|
+
export class FileUploadHandler extends AbstractFileUploadHandler {
|
|
14
3
|
fileService;
|
|
15
|
-
|
|
4
|
+
prefix;
|
|
5
|
+
constructor(fileService, prefix = "") {
|
|
16
6
|
super();
|
|
17
7
|
this.fileService = fileService;
|
|
8
|
+
this.prefix = prefix;
|
|
9
|
+
}
|
|
10
|
+
getPath(uri) {
|
|
11
|
+
return `${this.prefix}${uri}`;
|
|
18
12
|
}
|
|
19
13
|
async moveFile(fromURI, toURI) {
|
|
20
|
-
await this.fileService.moveObject([{ fromURI, toURI }]);
|
|
14
|
+
await this.fileService.moveObject([{ fromURI: this.getPath(fromURI), toURI: this.getPath(toURI) }]);
|
|
21
15
|
}
|
|
22
16
|
async copyFile(fromURI, toURI) {
|
|
23
|
-
await this.fileService.copyObject([{ fromURI, toURI }]);
|
|
17
|
+
await this.fileService.copyObject([{ fromURI: this.getPath(fromURI), toURI: this.getPath(toURI) }]);
|
|
24
18
|
}
|
|
25
19
|
async removeFile(uri) {
|
|
26
|
-
await this.fileService.removeObject([uri]);
|
|
20
|
+
await this.fileService.removeObject([this.getPath(uri)]);
|
|
27
21
|
}
|
|
28
22
|
async resolvePublicUrl(uri) {
|
|
29
|
-
const result = await this.fileService.getAccessUrls([uri], true);
|
|
23
|
+
const result = await this.fileService.getAccessUrls([this.getPath(uri)], true);
|
|
30
24
|
return result[0];
|
|
31
25
|
}
|
|
32
26
|
async resolvePrivateUrl(uri) {
|
|
33
|
-
const result = await this.fileService.getAccessUrls([uri], false);
|
|
27
|
+
const result = await this.fileService.getAccessUrls([this.getPath(uri)], false);
|
|
34
28
|
return result[0];
|
|
35
29
|
}
|
|
36
|
-
}
|
|
37
|
-
FileUploadHandler = __decorate([
|
|
38
|
-
Injectable(),
|
|
39
|
-
__metadata("design:paramtypes", [AbstractFileService])
|
|
40
|
-
], FileUploadHandler);
|
|
41
|
-
export { FileUploadHandler };
|
|
30
|
+
}
|
|
@@ -118,7 +118,7 @@ export class AbstractJobScheduler {
|
|
|
118
118
|
const tx = await this.db.createTransaction();
|
|
119
119
|
if (!jobHandler) {
|
|
120
120
|
this.logger.info(`Disable job with id: ${job.id} as handler is not found`);
|
|
121
|
-
await this.disableJob(job.id
|
|
121
|
+
await this.disableJob(job.id, tx);
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
124
124
|
const update = {
|
|
@@ -8,7 +8,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { AbstractLogger, ClaireApp, LogContext, getGlobalStore } from "@clairejs/core";
|
|
11
|
-
import { ExitCode } from "../common/constants";
|
|
12
11
|
let ClaireServer = class ClaireServer extends ClaireApp {
|
|
13
12
|
logger;
|
|
14
13
|
httpRequestHandler;
|
|
@@ -43,11 +42,11 @@ let ClaireServer = class ClaireServer extends ClaireApp {
|
|
|
43
42
|
this.logger.debug(`Setting up exception handlers`);
|
|
44
43
|
process.on("SIGTERM", () => {
|
|
45
44
|
this.logger.warn("SIGTERM interrupt signal");
|
|
46
|
-
return this.stop(
|
|
45
|
+
return this.stop();
|
|
47
46
|
});
|
|
48
47
|
process.on("SIGINT", () => {
|
|
49
48
|
this.logger.warn("SIGINT interrupt signal");
|
|
50
|
-
return this.stop(
|
|
49
|
+
return this.stop();
|
|
51
50
|
});
|
|
52
51
|
process.on("uncaughtException", (err) => {
|
|
53
52
|
this.logger.error("uncaughtException", err.name, err.stack);
|
|
@@ -57,10 +56,10 @@ let ClaireServer = class ClaireServer extends ClaireApp {
|
|
|
57
56
|
});
|
|
58
57
|
this.booted = true;
|
|
59
58
|
}
|
|
60
|
-
stop(
|
|
59
|
+
stop() {
|
|
61
60
|
this.logger.debug("Server is shutting down");
|
|
62
61
|
this.exit();
|
|
63
|
-
process.exit(
|
|
62
|
+
process.exit(0);
|
|
64
63
|
}
|
|
65
64
|
};
|
|
66
65
|
ClaireServer = __decorate([
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clairejs/server",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.26.0",
|
|
4
4
|
"description": "Claire server NodeJs framework written in Typescript.",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"ws": "^7.5.5"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@clairejs/client": "^3.5.
|
|
37
|
-
"@clairejs/core": "^3.
|
|
38
|
-
"@clairejs/orm": "^3.
|
|
36
|
+
"@clairejs/client": "^3.5.1",
|
|
37
|
+
"@clairejs/core": "^3.9.0",
|
|
38
|
+
"@clairejs/orm": "^3.17.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/cookie-parser": "^1.4.3",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|