mvc-common-toolkit 1.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/dist/index.d.ts +6 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/src/constants.d.ts +11 -0
- package/dist/src/constants.js +17 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/gateways/alibaba-cloud-gateway.d.ts +26 -0
- package/dist/src/gateways/alibaba-cloud-gateway.js +56 -0
- package/dist/src/gateways/alibaba-cloud-gateway.js.map +1 -0
- package/dist/src/gateways/http-audit-gateway.d.ts +21 -0
- package/dist/src/gateways/http-audit-gateway.js +75 -0
- package/dist/src/gateways/http-audit-gateway.js.map +1 -0
- package/dist/src/gateways/index.d.ts +2 -0
- package/dist/src/gateways/index.js +19 -0
- package/dist/src/gateways/index.js.map +1 -0
- package/dist/src/interfaces.d.ts +52 -0
- package/dist/src/interfaces.js +3 -0
- package/dist/src/interfaces.js.map +1 -0
- package/dist/src/models/audit-log.d.ts +77 -0
- package/dist/src/models/audit-log.js +92 -0
- package/dist/src/models/audit-log.js.map +1 -0
- package/dist/src/models/index.d.ts +1 -0
- package/dist/src/models/index.js +18 -0
- package/dist/src/models/index.js.map +1 -0
- package/dist/src/pkg/bcrypt-helper.d.ts +2 -0
- package/dist/src/pkg/bcrypt-helper.js +36 -0
- package/dist/src/pkg/bcrypt-helper.js.map +1 -0
- package/dist/src/pkg/http-request-utils.d.ts +3 -0
- package/dist/src/pkg/http-request-utils.js +27 -0
- package/dist/src/pkg/http-request-utils.js.map +1 -0
- package/dist/src/pkg/index.d.ts +6 -0
- package/dist/src/pkg/index.js +33 -0
- package/dist/src/pkg/index.js.map +1 -0
- package/dist/src/pkg/object-helper.d.ts +1 -0
- package/dist/src/pkg/object-helper.js +14 -0
- package/dist/src/pkg/object-helper.js.map +1 -0
- package/dist/src/pkg/query-helper.d.ts +2 -0
- package/dist/src/pkg/query-helper.js +23 -0
- package/dist/src/pkg/query-helper.js.map +1 -0
- package/dist/src/pkg/string-utils.d.ts +4 -0
- package/dist/src/pkg/string-utils.js +74 -0
- package/dist/src/pkg/string-utils.js.map +1 -0
- package/dist/src/pkg/worksheet.utils.d.ts +24 -0
- package/dist/src/pkg/worksheet.utils.js +105 -0
- package/dist/src/pkg/worksheet.utils.js.map +1 -0
- package/dist/src/services/audit-service.d.ts +7 -0
- package/dist/src/services/audit-service.js +32 -0
- package/dist/src/services/audit-service.js.map +1 -0
- package/dist/src/services/excel.service.d.ts +25 -0
- package/dist/src/services/excel.service.js +95 -0
- package/dist/src/services/excel.service.js.map +1 -0
- package/dist/src/services/index.d.ts +3 -0
- package/dist/src/services/index.js +20 -0
- package/dist/src/services/index.js.map +1 -0
- package/dist/src/services/mailer-service.d.ts +15 -0
- package/dist/src/services/mailer-service.js +44 -0
- package/dist/src/services/mailer-service.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/index.ts +6 -0
- package/package.json +41 -0
- package/tsconfig.json +25 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/gateways"), exports);
|
|
18
|
+
__exportStar(require("./src/models"), exports);
|
|
19
|
+
__exportStar(require("./src/pkg"), exports);
|
|
20
|
+
__exportStar(require("./src/services"), exports);
|
|
21
|
+
__exportStar(require("./src/interfaces"), exports);
|
|
22
|
+
__exportStar(require("./src/constants"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,+CAA6B;AAC7B,4CAA0B;AAC1B,iDAA+B;AAC/B,mDAAiC;AACjC,kDAAgC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APP_ENV = exports.LOG_LEVEL = void 0;
|
|
4
|
+
var LOG_LEVEL;
|
|
5
|
+
(function (LOG_LEVEL) {
|
|
6
|
+
LOG_LEVEL["INFO"] = "info";
|
|
7
|
+
LOG_LEVEL["ERROR"] = "error";
|
|
8
|
+
LOG_LEVEL["DEBUG"] = "debug";
|
|
9
|
+
LOG_LEVEL["FATAL"] = "fatal";
|
|
10
|
+
})(LOG_LEVEL = exports.LOG_LEVEL || (exports.LOG_LEVEL = {}));
|
|
11
|
+
var APP_ENV;
|
|
12
|
+
(function (APP_ENV) {
|
|
13
|
+
APP_ENV["DEVELOPMENT"] = "development";
|
|
14
|
+
APP_ENV["STAGING"] = "staging";
|
|
15
|
+
APP_ENV["PRODUCTION"] = "production";
|
|
16
|
+
})(APP_ENV = exports.APP_ENV || (exports.APP_ENV = {}));
|
|
17
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,4BAAe,CAAA;IACf,4BAAe,CAAA;IACf,4BAAe,CAAA;AACjB,CAAC,EALW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAKpB;AAED,IAAY,OAIX;AAJD,WAAY,OAAO;IACjB,sCAA2B,CAAA;IAC3B,8BAAmB,CAAA;IACnB,oCAAyB,CAAA;AAC3B,CAAC,EAJW,OAAO,GAAP,eAAO,KAAP,eAAO,QAIlB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import OSS from "ali-oss";
|
|
2
|
+
import Core from "@alicloud/pop-core";
|
|
3
|
+
import { CloudStorageClient, STSResponse } from "../interfaces";
|
|
4
|
+
export interface AlibabaCloudGatewayConfig {
|
|
5
|
+
accessKey: string;
|
|
6
|
+
secret: string;
|
|
7
|
+
apiVersion?: string;
|
|
8
|
+
endpoint: string;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
oss: {
|
|
11
|
+
bucketName: string;
|
|
12
|
+
region: string;
|
|
13
|
+
};
|
|
14
|
+
sts: {
|
|
15
|
+
roleArn: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export declare class AlibabaCloudGateway implements CloudStorageClient {
|
|
19
|
+
protected config: AlibabaCloudGatewayConfig;
|
|
20
|
+
protected coreClient: Core;
|
|
21
|
+
protected ossClient: OSS;
|
|
22
|
+
constructor(config: AlibabaCloudGatewayConfig);
|
|
23
|
+
generateTmpCredentials(sessionID: string): Promise<STSResponse["Credentials"]>;
|
|
24
|
+
getObjectReadStream(fileName: string): Promise<OSS.GetStreamResult>;
|
|
25
|
+
writeFileToDestination(fileName: string, destination: string | WritableStream): Promise<OSS.GetObjectResult>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AlibabaCloudGateway = void 0;
|
|
16
|
+
const ali_oss_1 = __importDefault(require("ali-oss"));
|
|
17
|
+
const pop_core_1 = __importDefault(require("@alicloud/pop-core"));
|
|
18
|
+
class AlibabaCloudGateway {
|
|
19
|
+
constructor(config) {
|
|
20
|
+
this.config = config;
|
|
21
|
+
this.coreClient = new pop_core_1.default({
|
|
22
|
+
accessKeyId: config.accessKey,
|
|
23
|
+
accessKeySecret: config.secret,
|
|
24
|
+
apiVersion: config.apiVersion || "2015-04-01",
|
|
25
|
+
endpoint: config.endpoint,
|
|
26
|
+
});
|
|
27
|
+
this.ossClient = new ali_oss_1.default({
|
|
28
|
+
accessKeyId: config.accessKey,
|
|
29
|
+
accessKeySecret: config.secret,
|
|
30
|
+
region: config.oss.region,
|
|
31
|
+
bucket: config.oss.bucketName,
|
|
32
|
+
timeout: config.timeout || 3000,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
generateTmpCredentials(sessionID) {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const requestResponse = yield this.coreClient.request("AssumeRole", {
|
|
38
|
+
RoleArn: this.config.sts.roleArn,
|
|
39
|
+
RoleSessionName: sessionID,
|
|
40
|
+
DurationSeconds: this.config.timeout || 900,
|
|
41
|
+
}, {
|
|
42
|
+
method: "POST",
|
|
43
|
+
contentType: "application/json",
|
|
44
|
+
});
|
|
45
|
+
return requestResponse.Credentials;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
getObjectReadStream(fileName) {
|
|
49
|
+
return this.ossClient.getStream(fileName);
|
|
50
|
+
}
|
|
51
|
+
writeFileToDestination(fileName, destination) {
|
|
52
|
+
return this.ossClient.get(fileName, destination);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.AlibabaCloudGateway = AlibabaCloudGateway;
|
|
56
|
+
//# sourceMappingURL=alibaba-cloud-gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alibaba-cloud-gateway.js","sourceRoot":"","sources":["../../../src/gateways/alibaba-cloud-gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,sDAA0B;AAC1B,kEAAsC;AAmBtC,MAAa,mBAAmB;IAI9B,YAAsB,MAAiC;QAAjC,WAAM,GAAN,MAAM,CAA2B;QACrD,IAAI,CAAC,UAAU,GAAG,IAAI,kBAAI,CAAC;YACzB,WAAW,EAAE,MAAM,CAAC,SAAS;YAC7B,eAAe,EAAE,MAAM,CAAC,MAAM;YAC9B,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,YAAY;YAC7C,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,GAAG,IAAI,iBAAG,CAAC;YACvB,WAAW,EAAE,MAAM,CAAC,SAAS;YAC7B,eAAe,EAAE,MAAM,CAAC,MAAM;YAC9B,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM;YACzB,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU;YAC7B,OAAO,EAAE,MAAM,CAAC,OAAO,IAAI,IAAI;SAChC,CAAC,CAAC;IACL,CAAC;IAEY,sBAAsB,CACjC,SAAiB;;YAEjB,MAAM,eAAe,GAAgB,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAChE,YAAY,EACZ;gBACE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO;gBAChC,eAAe,EAAE,SAAS;gBAC1B,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,GAAG;aAC5C,EACD;gBACE,MAAM,EAAE,MAAM;gBACd,WAAW,EAAE,kBAAkB;aAChC,CACF,CAAC;YAEF,OAAO,eAAe,CAAC,WAAW,CAAC;QACrC,CAAC;KAAA;IAEM,mBAAmB,CAAC,QAAgB;QACzC,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAEM,sBAAsB,CAC3B,QAAgB,EAChB,WAAoC;QAEpC,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACnD,CAAC;CACF;AAlDD,kDAkDC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from "axios";
|
|
2
|
+
import { LOG_LEVEL } from "../constants";
|
|
3
|
+
import { AuditGateway } from "../interfaces";
|
|
4
|
+
export interface HttpAuditGatewayConfig {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
appName?: string;
|
|
7
|
+
auth: {
|
|
8
|
+
username: string;
|
|
9
|
+
password: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare class HttpAuditGateway implements AuditGateway {
|
|
13
|
+
protected config: HttpAuditGatewayConfig;
|
|
14
|
+
protected baseURL: string;
|
|
15
|
+
protected access_token: string;
|
|
16
|
+
constructor(config: HttpAuditGatewayConfig);
|
|
17
|
+
onModuleInit(): Promise<void>;
|
|
18
|
+
publish(logId: string, level: LOG_LEVEL, content: Record<string, any>): Promise<unknown>;
|
|
19
|
+
private auth;
|
|
20
|
+
protected send<T>(logId: string, options: AxiosRequestConfig, is_retry?: boolean, use_access_token?: boolean): Promise<AxiosResponse<T>>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.HttpAuditGateway = void 0;
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
17
|
+
const string_utils_1 = require("../pkg/string-utils");
|
|
18
|
+
class HttpAuditGateway {
|
|
19
|
+
constructor(config) {
|
|
20
|
+
this.config = config;
|
|
21
|
+
if (!config.baseUrl) {
|
|
22
|
+
throw new Error("Missing base url config");
|
|
23
|
+
}
|
|
24
|
+
this.baseURL = config.baseUrl;
|
|
25
|
+
}
|
|
26
|
+
onModuleInit() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
yield this.auth();
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
publish(logId, level, content) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const response = yield this.send(logId, {
|
|
34
|
+
method: "POST",
|
|
35
|
+
url: "/event/create",
|
|
36
|
+
data: Object.assign(Object.assign({}, content), { level }),
|
|
37
|
+
});
|
|
38
|
+
return response === null || response === void 0 ? void 0 : response.data;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
auth(logId = "system") {
|
|
42
|
+
var _a;
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
const authResponse = yield this.send(logId, {
|
|
45
|
+
method: "POST",
|
|
46
|
+
url: "/auth/login",
|
|
47
|
+
data: this.config.auth,
|
|
48
|
+
}, false, false);
|
|
49
|
+
this.access_token = (_a = authResponse === null || authResponse === void 0 ? void 0 : authResponse.data) === null || _a === void 0 ? void 0 : _a.access_token;
|
|
50
|
+
return !!this.access_token;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
send(logId, options, is_retry = false, use_access_token = true) {
|
|
54
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
55
|
+
console.log(`[${logId}] ${is_retry ? "Resend" : "Send"} to Audit Service: ${JSON.stringify(options, string_utils_1.maskFn)}`);
|
|
56
|
+
options.baseURL = this.baseURL;
|
|
57
|
+
if (use_access_token) {
|
|
58
|
+
options.headers = {
|
|
59
|
+
Authorization: `Bearer ${this.access_token}`,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const response = yield axios_1.default.request(options);
|
|
63
|
+
if ((response === null || response === void 0 ? void 0 : response.status) == 401 && use_access_token && !is_retry) {
|
|
64
|
+
console.log(`[${logId}] Retrying...`);
|
|
65
|
+
const isAuthSuccess = yield this.auth(logId);
|
|
66
|
+
if (isAuthSuccess) {
|
|
67
|
+
return this.send(logId, options, true);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return response;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.HttpAuditGateway = HttpAuditGateway;
|
|
75
|
+
//# sourceMappingURL=http-audit-gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-audit-gateway.js","sourceRoot":"","sources":["../../../src/gateways/http-audit-gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kDAAiE;AAIjE,sDAA6C;AAW7C,MAAa,gBAAgB;IAI3B,YAAsB,MAA8B;QAA9B,WAAM,GAAN,MAAM,CAAwB;QAClD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;SAC5C;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAChC,CAAC;IAEK,YAAY;;YAChB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QACpB,CAAC;KAAA;IAEY,OAAO,CAClB,KAAa,EACb,KAAgB,EAChB,OAA4B;;YAE5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;gBACtC,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,eAAe;gBACpB,IAAI,kCACC,OAAO,KACV,KAAK,GACN;aACF,CAAC,CAAC;YAEH,OAAO,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,CAAC;QACxB,CAAC;KAAA;IAEa,IAAI,CAAC,KAAK,GAAG,QAAQ;;;YACjC,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,IAAI,CAClC,KAAK,EACL;gBACE,MAAM,EAAE,MAAM;gBACd,GAAG,EAAE,aAAa;gBAClB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI;aACvB,EACD,KAAK,EACL,KAAK,CACN,CAAC;YAEF,IAAI,CAAC,YAAY,GAAG,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,0CAAE,YAAY,CAAC;YAErD,OAAO,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;;KAC5B;IAEe,IAAI,CAClB,KAAa,EACb,OAA2B,EAC3B,QAAQ,GAAG,KAAK,EAChB,gBAAgB,GAAG,IAAI;;YAEvB,OAAO,CAAC,GAAG,CACT,IAAI,KAAK,KACP,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MACxB,sBAAsB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,qBAAM,CAAC,EAAE,CACxD,CAAC;YAEF,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;YAC/B,IAAI,gBAAgB,EAAE;gBACpB,OAAO,CAAC,OAAO,GAAG;oBAChB,aAAa,EAAE,UAAU,IAAI,CAAC,YAAY,EAAE;iBAC7C,CAAC;aACH;YAED,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAG9C,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,KAAI,GAAG,IAAI,gBAAgB,IAAI,CAAC,QAAQ,EAAE;gBAC5D,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC;gBAEtC,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAE7C,IAAI,aAAa,EAAE;oBACjB,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;iBACxC;aACF;YAED,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF;AApFD,4CAoFC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./alibaba-cloud-gateway"), exports);
|
|
18
|
+
__exportStar(require("./http-audit-gateway"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gateways/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,uDAAqC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Borders, CellValue, Style } from "exceljs";
|
|
2
|
+
import { LOG_LEVEL } from "./constants";
|
|
3
|
+
export interface CloudStorageClient {
|
|
4
|
+
generateTmpCredentials(sessionId: string): Promise<any>;
|
|
5
|
+
getObjectReadStream(fileName: string): Promise<any>;
|
|
6
|
+
}
|
|
7
|
+
export interface ISort {
|
|
8
|
+
columnName: string;
|
|
9
|
+
direction: "ASC" | "DESC";
|
|
10
|
+
}
|
|
11
|
+
export interface EmailSender {
|
|
12
|
+
send(mailOptions: SendMailOptions): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export interface SendMailOptions {
|
|
15
|
+
from?: string;
|
|
16
|
+
to?: string | string[];
|
|
17
|
+
cc?: string | string[];
|
|
18
|
+
bcc?: string | string[];
|
|
19
|
+
subject: string;
|
|
20
|
+
text?: string;
|
|
21
|
+
html?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ICellOptions {
|
|
24
|
+
style?: Partial<Style>;
|
|
25
|
+
border?: Partial<Borders>;
|
|
26
|
+
}
|
|
27
|
+
export interface ICellData {
|
|
28
|
+
value: CellValue;
|
|
29
|
+
options?: ICellOptions;
|
|
30
|
+
}
|
|
31
|
+
export interface STSResponse {
|
|
32
|
+
RequestId: string;
|
|
33
|
+
AssumedRoleUser: any;
|
|
34
|
+
Credentials: {
|
|
35
|
+
SecurityToken: string;
|
|
36
|
+
AccessKeyId: string;
|
|
37
|
+
AccessKeySecret: string;
|
|
38
|
+
Expiration: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export interface AuditGateway {
|
|
42
|
+
publish(logId: string, level: LOG_LEVEL, content: any): Promise<any>;
|
|
43
|
+
}
|
|
44
|
+
export interface OperationResult<T = any> {
|
|
45
|
+
success: boolean;
|
|
46
|
+
data?: T;
|
|
47
|
+
message?: string;
|
|
48
|
+
code?: string;
|
|
49
|
+
httpCode?: number;
|
|
50
|
+
metadata?: any;
|
|
51
|
+
action?: string;
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { LOG_LEVEL } from "../constants";
|
|
2
|
+
export type LogObject = ErrorLog | InfoLog | DebugLog;
|
|
3
|
+
export interface LogObjectData {
|
|
4
|
+
logId: string;
|
|
5
|
+
userId?: string;
|
|
6
|
+
level: LOG_LEVEL;
|
|
7
|
+
action: string;
|
|
8
|
+
message?: any;
|
|
9
|
+
payload?: any;
|
|
10
|
+
metadata?: any;
|
|
11
|
+
}
|
|
12
|
+
export declare abstract class BaseLog {
|
|
13
|
+
logId: string;
|
|
14
|
+
userId: string;
|
|
15
|
+
level: LOG_LEVEL;
|
|
16
|
+
action: string;
|
|
17
|
+
message?: any;
|
|
18
|
+
payload?: any;
|
|
19
|
+
metadata?: any;
|
|
20
|
+
constructor(data: Omit<LogObjectData, "level">);
|
|
21
|
+
abstract toJSON(): Record<string, any>;
|
|
22
|
+
}
|
|
23
|
+
export declare class ErrorLog extends BaseLog {
|
|
24
|
+
constructor(data: Omit<LogObjectData, "level">);
|
|
25
|
+
toJSON(): {
|
|
26
|
+
logId: string;
|
|
27
|
+
userId: string;
|
|
28
|
+
level: LOG_LEVEL;
|
|
29
|
+
action: string;
|
|
30
|
+
message: any;
|
|
31
|
+
metadata: any;
|
|
32
|
+
payload: any;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare class FatalLog extends BaseLog {
|
|
36
|
+
constructor(data: Omit<LogObjectData, "level">);
|
|
37
|
+
toJSON(): {
|
|
38
|
+
logId: string;
|
|
39
|
+
userId: string;
|
|
40
|
+
level: LOG_LEVEL;
|
|
41
|
+
action: string;
|
|
42
|
+
message: any;
|
|
43
|
+
metadata: any;
|
|
44
|
+
payload: any;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export declare class InfoLog extends BaseLog {
|
|
48
|
+
constructor(data: Omit<LogObjectData, "level">);
|
|
49
|
+
toJSON(): {
|
|
50
|
+
logId: string;
|
|
51
|
+
userId: string;
|
|
52
|
+
level: LOG_LEVEL;
|
|
53
|
+
action: string;
|
|
54
|
+
message: any;
|
|
55
|
+
metadata: any;
|
|
56
|
+
payload: any;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export declare class DebugLog extends BaseLog {
|
|
60
|
+
parentLogId?: string;
|
|
61
|
+
parentLogType?: LOG_LEVEL;
|
|
62
|
+
constructor(data: Omit<LogObjectData, "level"> & {
|
|
63
|
+
parentLogId?: string;
|
|
64
|
+
parentLogType?: LOG_LEVEL;
|
|
65
|
+
});
|
|
66
|
+
toJSON(): {
|
|
67
|
+
logId: string;
|
|
68
|
+
userId: string;
|
|
69
|
+
level: LOG_LEVEL;
|
|
70
|
+
action: string;
|
|
71
|
+
message: any;
|
|
72
|
+
metadata: any;
|
|
73
|
+
payload: any;
|
|
74
|
+
parentLogId: string;
|
|
75
|
+
parentLogType: LOG_LEVEL;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DebugLog = exports.InfoLog = exports.FatalLog = exports.ErrorLog = exports.BaseLog = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
class BaseLog {
|
|
6
|
+
constructor(data) {
|
|
7
|
+
this.logId = data.logId;
|
|
8
|
+
this.userId = data.userId;
|
|
9
|
+
this.action = data.action;
|
|
10
|
+
this.message = data.message;
|
|
11
|
+
this.metadata = data.metadata;
|
|
12
|
+
this.payload = data.payload;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.BaseLog = BaseLog;
|
|
16
|
+
class ErrorLog extends BaseLog {
|
|
17
|
+
constructor(data) {
|
|
18
|
+
super(data);
|
|
19
|
+
this.level = constants_1.LOG_LEVEL.ERROR;
|
|
20
|
+
}
|
|
21
|
+
toJSON() {
|
|
22
|
+
return {
|
|
23
|
+
logId: this.logId,
|
|
24
|
+
userId: this.userId,
|
|
25
|
+
level: this.level,
|
|
26
|
+
action: this.action,
|
|
27
|
+
message: this.message,
|
|
28
|
+
metadata: this.metadata,
|
|
29
|
+
payload: this.payload,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.ErrorLog = ErrorLog;
|
|
34
|
+
class FatalLog extends BaseLog {
|
|
35
|
+
constructor(data) {
|
|
36
|
+
super(data);
|
|
37
|
+
this.level = constants_1.LOG_LEVEL.FATAL;
|
|
38
|
+
}
|
|
39
|
+
toJSON() {
|
|
40
|
+
return {
|
|
41
|
+
logId: this.logId,
|
|
42
|
+
userId: this.userId,
|
|
43
|
+
level: this.level,
|
|
44
|
+
action: this.action,
|
|
45
|
+
message: this.message,
|
|
46
|
+
metadata: this.metadata,
|
|
47
|
+
payload: this.payload,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.FatalLog = FatalLog;
|
|
52
|
+
class InfoLog extends BaseLog {
|
|
53
|
+
constructor(data) {
|
|
54
|
+
super(data);
|
|
55
|
+
this.level = constants_1.LOG_LEVEL.INFO;
|
|
56
|
+
}
|
|
57
|
+
toJSON() {
|
|
58
|
+
return {
|
|
59
|
+
logId: this.logId,
|
|
60
|
+
userId: this.userId,
|
|
61
|
+
level: this.level,
|
|
62
|
+
action: this.action,
|
|
63
|
+
message: this.message,
|
|
64
|
+
metadata: this.metadata,
|
|
65
|
+
payload: this.payload,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.InfoLog = InfoLog;
|
|
70
|
+
class DebugLog extends BaseLog {
|
|
71
|
+
constructor(data) {
|
|
72
|
+
super(data);
|
|
73
|
+
this.level = constants_1.LOG_LEVEL.DEBUG;
|
|
74
|
+
this.parentLogId = data.parentLogId;
|
|
75
|
+
this.parentLogType = data.parentLogType;
|
|
76
|
+
}
|
|
77
|
+
toJSON() {
|
|
78
|
+
return {
|
|
79
|
+
logId: this.logId,
|
|
80
|
+
userId: this.userId,
|
|
81
|
+
level: this.level,
|
|
82
|
+
action: this.action,
|
|
83
|
+
message: this.message,
|
|
84
|
+
metadata: this.metadata,
|
|
85
|
+
payload: this.payload,
|
|
86
|
+
parentLogId: this.parentLogId,
|
|
87
|
+
parentLogType: this.parentLogType,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.DebugLog = DebugLog;
|
|
92
|
+
//# sourceMappingURL=audit-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-log.js","sourceRoot":"","sources":["../../../src/models/audit-log.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./audit-log";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./audit-log"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.compare = exports.hash = void 0;
|
|
27
|
+
const bcrypt = __importStar(require("bcrypt"));
|
|
28
|
+
function hash(data, salt) {
|
|
29
|
+
return bcrypt.hash(data, salt || 12);
|
|
30
|
+
}
|
|
31
|
+
exports.hash = hash;
|
|
32
|
+
function compare(raw, hashed) {
|
|
33
|
+
return bcrypt.compare(raw, hashed);
|
|
34
|
+
}
|
|
35
|
+
exports.compare = compare;
|
|
36
|
+
//# sourceMappingURL=bcrypt-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bcrypt-helper.js","sourceRoot":"","sources":["../../../src/pkg/bcrypt-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAEjC,SAAgB,IAAI,CAAC,IAAY,EAAE,IAAsB;IACvD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;AACvC,CAAC;AAFD,oBAEC;AAED,SAAgB,OAAO,CAAC,GAAW,EAAE,MAAc;IACjD,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;AACrC,CAAC;AAFD,0BAEC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.constructUrlQueryString = void 0;
|
|
4
|
+
function constructUrlQueryString(url, queryStringData, options) {
|
|
5
|
+
if (!queryStringData) {
|
|
6
|
+
return url;
|
|
7
|
+
}
|
|
8
|
+
const encoder = (options === null || options === void 0 ? void 0 : options.encodeUrl)
|
|
9
|
+
? encodeURIComponent
|
|
10
|
+
: (value) => value;
|
|
11
|
+
const rawQueryString = [];
|
|
12
|
+
for (const props in queryStringData) {
|
|
13
|
+
const propValue = queryStringData[props];
|
|
14
|
+
if (propValue === undefined || propValue === null) {
|
|
15
|
+
continue;
|
|
16
|
+
}
|
|
17
|
+
if (typeof propValue === 'object') {
|
|
18
|
+
rawQueryString.push(`${props}=${encoder(JSON.stringify(propValue))}`);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
rawQueryString.push(`${props}=${encoder(propValue)}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return `${url}?${rawQueryString.join('&')}`;
|
|
25
|
+
}
|
|
26
|
+
exports.constructUrlQueryString = constructUrlQueryString;
|
|
27
|
+
//# sourceMappingURL=http-request-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-request-utils.js","sourceRoot":"","sources":["../../../src/pkg/http-request-utils.ts"],"names":[],"mappings":";;;AAAA,SAAgB,uBAAuB,CACrC,GAAW,EACX,eAAoB,EACpB,OAAiC;IAEjC,IAAI,CAAC,eAAe,EAAE;QACpB,OAAO,GAAG,CAAC;KACZ;IAED,MAAM,OAAO,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,SAAS;QAChC,CAAC,CAAC,kBAAkB;QACpB,CAAC,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC;IAE1B,MAAM,cAAc,GAAG,EAAE,CAAC;IAC1B,KAAK,MAAM,KAAK,IAAI,eAAe,EAAE;QACnC,MAAM,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,EAAE;YACjD,SAAS;SACV;QAED,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;YACjC,cAAc,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;SACvE;aAAM;YACL,cAAc,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;SACvD;KACF;IAED,OAAO,GAAG,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC9C,CAAC;AA5BD,0DA4BC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * as bcryptHelper from "./bcrypt-helper";
|
|
2
|
+
export * as httpRequestUtils from "./http-request-utils";
|
|
3
|
+
export * as objectHelper from "./object-helper";
|
|
4
|
+
export * as queryHelper from "./query-helper";
|
|
5
|
+
export * as stringUtils from "./string-utils";
|
|
6
|
+
export * as worksheetUtils from "./worksheet.utils";
|