@saihu/common 1.1.26 → 1.1.28
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 +211 -1
- package/dist/auth/custom-request.d.ts +3 -0
- package/dist/auth/custom-request.d.ts.map +1 -1
- package/dist/auth/decorators.d.ts +4 -0
- package/dist/auth/decorators.d.ts.map +1 -1
- package/dist/auth/decorators.js +8 -1
- package/dist/auth/guards/permission.guard.d.ts +14 -0
- package/dist/auth/guards/permission.guard.d.ts.map +1 -0
- package/dist/auth/guards/permission.guard.js +98 -0
- package/dist/auth/index.d.ts +4 -2
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +6 -0
- package/dist/consts/common.consts.d.ts +8 -0
- package/dist/consts/common.consts.d.ts.map +1 -0
- package/dist/consts/common.consts.js +10 -0
- package/dist/consts/index.d.ts +2 -0
- package/dist/consts/index.d.ts.map +1 -0
- package/dist/consts/index.js +17 -0
- package/dist/dto/index.d.ts +1 -0
- package/dist/dto/index.d.ts.map +1 -1
- package/dist/dto/index.js +1 -0
- package/dist/dto/operlog.dto.d.ts +17 -0
- package/dist/dto/operlog.dto.d.ts.map +1 -0
- package/dist/dto/operlog.dto.js +2 -0
- package/dist/index.d.ts +8 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/interceptors/index.d.ts +1 -0
- package/dist/interceptors/index.d.ts.map +1 -1
- package/dist/interceptors/index.js +1 -0
- package/dist/interceptors/operlog.interceptor.d.ts +21 -0
- package/dist/interceptors/operlog.interceptor.d.ts.map +1 -0
- package/dist/interceptors/operlog.interceptor.js +142 -0
- package/dist/interfaces/options.interface.d.ts +39 -0
- package/dist/interfaces/options.interface.d.ts.map +1 -0
- package/dist/interfaces/options.interface.js +2 -0
- package/dist/interfaces/service.interface.d.ts +11 -0
- package/dist/interfaces/service.interface.d.ts.map +1 -0
- package/dist/interfaces/service.interface.js +2 -0
- package/dist/saihu-common.module.d.ts +8 -0
- package/dist/saihu-common.module.d.ts.map +1 -0
- package/dist/saihu-common.module.js +101 -0
- package/dist/services/rabbitmq.service.d.ts +18 -0
- package/dist/services/rabbitmq.service.d.ts.map +1 -0
- package/dist/services/rabbitmq.service.js +126 -0
- package/dist/services/redis.service.d.ts +18 -0
- package/dist/services/redis.service.d.ts.map +1 -0
- package/dist/services/redis.service.js +104 -0
- package/dist/util/times.d.ts +2 -0
- package/dist/util/times.d.ts.map +1 -1
- package/dist/util/times.js +8 -0
- package/package.json +5 -1
|
@@ -0,0 +1,142 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var OperlogInterceptor_1;
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.OperlogInterceptor = void 0;
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const core_1 = require("@nestjs/core");
|
|
19
|
+
const operators_1 = require("rxjs/operators");
|
|
20
|
+
const common_consts_1 = require("../consts/common.consts");
|
|
21
|
+
let OperlogInterceptor = OperlogInterceptor_1 = class OperlogInterceptor {
|
|
22
|
+
constructor(reflector, rabbitmqService, options) {
|
|
23
|
+
this.reflector = reflector;
|
|
24
|
+
this.rabbitmqService = rabbitmqService;
|
|
25
|
+
this.options = options;
|
|
26
|
+
this.logger = new common_1.Logger(OperlogInterceptor_1.name);
|
|
27
|
+
this.isEnabled = this.options.useOperlog !== false;
|
|
28
|
+
if (this.options.operlogWhitelist &&
|
|
29
|
+
this.options.operlogWhitelist.length > 0) {
|
|
30
|
+
this.whitelist = this.options.operlogWhitelist;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
this.whitelist = [];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
intercept(context, next) {
|
|
37
|
+
if (!this.isEnabled) {
|
|
38
|
+
return next.handle();
|
|
39
|
+
}
|
|
40
|
+
// 首先检查是否是 HTTP 请求
|
|
41
|
+
if (context.getType() !== "http") {
|
|
42
|
+
return next.handle();
|
|
43
|
+
}
|
|
44
|
+
const startTime = Date.now();
|
|
45
|
+
const httpContext = context.switchToHttp();
|
|
46
|
+
const request = httpContext.getRequest();
|
|
47
|
+
if (!request) {
|
|
48
|
+
return next.handle();
|
|
49
|
+
}
|
|
50
|
+
const response = httpContext.getResponse();
|
|
51
|
+
const user = request.user || null;
|
|
52
|
+
const clientIp = this.getClientIp(request);
|
|
53
|
+
const controllerClass = context.getClass().name;
|
|
54
|
+
const handler = context.getHandler();
|
|
55
|
+
const url = request.url;
|
|
56
|
+
// 检查 URL 是否在白名单中
|
|
57
|
+
if (this.whitelist.length > 0 &&
|
|
58
|
+
this.whitelist.some((item) => url.startsWith(item))) {
|
|
59
|
+
return next.handle();
|
|
60
|
+
}
|
|
61
|
+
const method = request.method;
|
|
62
|
+
const userAgent = request.get("user-agent") || "";
|
|
63
|
+
const requestParams = this.getRequestParams(request);
|
|
64
|
+
const operLog = {
|
|
65
|
+
title: this.options.name,
|
|
66
|
+
method: controllerClass + "." + handler.name,
|
|
67
|
+
request_method: method,
|
|
68
|
+
user_agent: userAgent,
|
|
69
|
+
oper_name: (user === null || user === void 0 ? void 0 : user.name) || (user === null || user === void 0 ? void 0 : user.moniker) || "",
|
|
70
|
+
dept_name: (user === null || user === void 0 ? void 0 : user.dept_id) || "",
|
|
71
|
+
oper_url: url,
|
|
72
|
+
oper_ip: clientIp,
|
|
73
|
+
oper_param: JSON.stringify(requestParams),
|
|
74
|
+
json_result: "",
|
|
75
|
+
status: 0,
|
|
76
|
+
error_msg: "",
|
|
77
|
+
oper_time: startTime,
|
|
78
|
+
cost_time: 0,
|
|
79
|
+
};
|
|
80
|
+
return next.handle().pipe((0, operators_1.tap)((data) => {
|
|
81
|
+
const responseTime = Date.now() - startTime;
|
|
82
|
+
const statusCode = response.statusCode;
|
|
83
|
+
operLog.status = statusCode;
|
|
84
|
+
operLog.cost_time = responseTime;
|
|
85
|
+
operLog.json_result = JSON.stringify(data);
|
|
86
|
+
this.rabbitmqService.publishMessage(operLog);
|
|
87
|
+
}), (0, operators_1.catchError)((err) => {
|
|
88
|
+
operLog.status = 500;
|
|
89
|
+
operLog.error_msg = err.message;
|
|
90
|
+
this.logger.error(`[Request Error] ${JSON.stringify(operLog)}`);
|
|
91
|
+
this.rabbitmqService.publishMessage(operLog);
|
|
92
|
+
throw err;
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
getClientIp(request) {
|
|
96
|
+
try {
|
|
97
|
+
// 尝试从多个可能的头部获取 IP 地址
|
|
98
|
+
const possibleHeaders = ["x-forwarded-for"];
|
|
99
|
+
let clientIp = request.ip ||
|
|
100
|
+
(request.connection ? request.connection.remoteAddress || "" : "");
|
|
101
|
+
// 检查各种可能的头部
|
|
102
|
+
for (const header of possibleHeaders) {
|
|
103
|
+
if (request.headers[header]) {
|
|
104
|
+
clientIp = request.headers[header];
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
// 处理 IP 数组(如 x-forwarded-for: client, proxy1, proxy2)
|
|
109
|
+
if (clientIp && typeof clientIp === "string" && clientIp.includes(",")) {
|
|
110
|
+
clientIp = clientIp.split(",")[0].trim();
|
|
111
|
+
}
|
|
112
|
+
// 移除 IPv6 前缀(如果存在)
|
|
113
|
+
if (clientIp && clientIp.substr(0, 7) === "::ffff:") {
|
|
114
|
+
clientIp = clientIp.substr(7);
|
|
115
|
+
}
|
|
116
|
+
return clientIp;
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
this.logger.error("Failed to get client IP:", error);
|
|
120
|
+
return "";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 获取请求参数
|
|
125
|
+
*/
|
|
126
|
+
getRequestParams(request) {
|
|
127
|
+
const params = {
|
|
128
|
+
query: { ...(request.query || {}) },
|
|
129
|
+
body: { ...(request.body || {}) },
|
|
130
|
+
params: { ...(request.params || {}) },
|
|
131
|
+
};
|
|
132
|
+
// 移除敏感信息
|
|
133
|
+
return params;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
exports.OperlogInterceptor = OperlogInterceptor;
|
|
137
|
+
exports.OperlogInterceptor = OperlogInterceptor = OperlogInterceptor_1 = __decorate([
|
|
138
|
+
(0, common_1.Injectable)(),
|
|
139
|
+
__param(1, (0, common_1.Inject)(common_consts_1.RABBITMQ_SERVICE)),
|
|
140
|
+
__param(2, (0, common_1.Inject)(common_consts_1.COMMON_MODULE_OPTIONS)),
|
|
141
|
+
__metadata("design:paramtypes", [core_1.Reflector, Object, Object])
|
|
142
|
+
], OperlogInterceptor);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Type } from "@nestjs/common";
|
|
2
|
+
export interface CommonModuleOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 模块名称
|
|
5
|
+
*/
|
|
6
|
+
name: string;
|
|
7
|
+
/**
|
|
8
|
+
* 是否开启权限校验
|
|
9
|
+
*/
|
|
10
|
+
usePerms?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 是否开启操作日志
|
|
13
|
+
*/
|
|
14
|
+
useOperlog?: boolean;
|
|
15
|
+
redis?: {
|
|
16
|
+
url: string;
|
|
17
|
+
password: string;
|
|
18
|
+
};
|
|
19
|
+
rabbitmq?: {
|
|
20
|
+
url: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* 操作日志白名单
|
|
24
|
+
*/
|
|
25
|
+
operlogWhitelist?: string[];
|
|
26
|
+
}
|
|
27
|
+
export interface CommonModuleAsyncOptions {
|
|
28
|
+
imports?: any[];
|
|
29
|
+
inject?: any[];
|
|
30
|
+
useFactory: (...args: any[]) => Promise<CommonModuleOptions> | CommonModuleOptions;
|
|
31
|
+
useClass?: Type<any>;
|
|
32
|
+
useExisting?: Type<any>;
|
|
33
|
+
}
|
|
34
|
+
export interface UserPermissions {
|
|
35
|
+
id: string;
|
|
36
|
+
perms: string[];
|
|
37
|
+
roles: string[];
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=options.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/options.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAEtC,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE;QACN,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF,QAAQ,CAAC,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,UAAU,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAAC;IACnF,QAAQ,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,WAAW,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface RedisService {
|
|
2
|
+
get<T>(key: string): Promise<T | null>;
|
|
3
|
+
set(key: string, value: any, ttl?: number): Promise<void>;
|
|
4
|
+
del(key: string): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
export interface RabbitmqService {
|
|
7
|
+
connect(): Promise<void>;
|
|
8
|
+
disconnect(): Promise<void>;
|
|
9
|
+
publishMessage(message: any): Promise<boolean>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=service.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/service.interface.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACvC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAChD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DynamicModule } from "@nestjs/common";
|
|
2
|
+
import { CommonModuleAsyncOptions, CommonModuleOptions } from "./interfaces/options.interface";
|
|
3
|
+
export declare class SaihuCommonModule {
|
|
4
|
+
static forRoot(options: CommonModuleOptions): DynamicModule;
|
|
5
|
+
static forRootAsync(options: CommonModuleAsyncOptions): DynamicModule;
|
|
6
|
+
static withOperlogInterceptor(): DynamicModule;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=saihu-common.module.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saihu-common.module.d.ts","sourceRoot":"","sources":["../src/saihu-common.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAY,MAAM,gBAAgB,CAAC;AAEjE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,gCAAgC,CAAC;AAYxC,qBACa,iBAAiB;IAC5B,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa;IAmC3D,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa;IAgCrE,MAAM,CAAC,sBAAsB,IAAI,aAAa;CAa/C"}
|
|
@@ -0,0 +1,101 @@
|
|
|
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 SaihuCommonModule_1;
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.SaihuCommonModule = void 0;
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const redis_service_1 = require("./services/redis.service");
|
|
13
|
+
const common_consts_1 = require("./consts/common.consts");
|
|
14
|
+
const rabbitmq_service_1 = require("./services/rabbitmq.service");
|
|
15
|
+
const core_1 = require("@nestjs/core");
|
|
16
|
+
const interceptors_1 = require("./interceptors");
|
|
17
|
+
const auth_1 = require("./auth");
|
|
18
|
+
const config_1 = require("@nestjs/config");
|
|
19
|
+
let SaihuCommonModule = SaihuCommonModule_1 = class SaihuCommonModule {
|
|
20
|
+
static forRoot(options) {
|
|
21
|
+
const providers = [
|
|
22
|
+
{
|
|
23
|
+
provide: common_consts_1.COMMON_MODULE_OPTIONS,
|
|
24
|
+
useValue: options,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
provide: common_consts_1.REDIS_SERVICE,
|
|
28
|
+
useClass: redis_service_1.RedisServiceImpl,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
provide: common_consts_1.RABBITMQ_SERVICE,
|
|
32
|
+
useClass: rabbitmq_service_1.RabbitmqServiceImpl,
|
|
33
|
+
},
|
|
34
|
+
auth_1.PermissionGuard,
|
|
35
|
+
];
|
|
36
|
+
const useOperlog = options.useOperlog !== false;
|
|
37
|
+
if (useOperlog) {
|
|
38
|
+
providers.push({
|
|
39
|
+
provide: core_1.APP_INTERCEPTOR,
|
|
40
|
+
useClass: interceptors_1.OperlogInterceptor,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
module: SaihuCommonModule_1,
|
|
45
|
+
providers,
|
|
46
|
+
exports: [
|
|
47
|
+
common_consts_1.COMMON_MODULE_OPTIONS,
|
|
48
|
+
auth_1.PermissionGuard,
|
|
49
|
+
common_consts_1.REDIS_SERVICE,
|
|
50
|
+
common_consts_1.RABBITMQ_SERVICE,
|
|
51
|
+
],
|
|
52
|
+
global: true,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
static forRootAsync(options) {
|
|
56
|
+
const providers = [
|
|
57
|
+
{
|
|
58
|
+
provide: common_consts_1.COMMON_MODULE_OPTIONS,
|
|
59
|
+
useFactory: options.useFactory,
|
|
60
|
+
inject: options.inject || [],
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
provide: common_consts_1.REDIS_SERVICE,
|
|
64
|
+
useClass: redis_service_1.RedisServiceImpl,
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
provide: common_consts_1.RABBITMQ_SERVICE,
|
|
68
|
+
useClass: rabbitmq_service_1.RabbitmqServiceImpl,
|
|
69
|
+
},
|
|
70
|
+
auth_1.PermissionGuard,
|
|
71
|
+
];
|
|
72
|
+
return {
|
|
73
|
+
module: SaihuCommonModule_1,
|
|
74
|
+
imports: [config_1.ConfigModule, ...(options.imports || [])],
|
|
75
|
+
providers,
|
|
76
|
+
exports: [
|
|
77
|
+
common_consts_1.COMMON_MODULE_OPTIONS,
|
|
78
|
+
auth_1.PermissionGuard,
|
|
79
|
+
common_consts_1.REDIS_SERVICE,
|
|
80
|
+
common_consts_1.RABBITMQ_SERVICE,
|
|
81
|
+
],
|
|
82
|
+
global: true, // 设置为全局模块
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
static withOperlogInterceptor() {
|
|
86
|
+
const providers = [];
|
|
87
|
+
providers.push({
|
|
88
|
+
provide: core_1.APP_INTERCEPTOR,
|
|
89
|
+
useClass: interceptors_1.OperlogInterceptor,
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
module: SaihuCommonModule_1,
|
|
93
|
+
providers,
|
|
94
|
+
exports: [],
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
exports.SaihuCommonModule = SaihuCommonModule;
|
|
99
|
+
exports.SaihuCommonModule = SaihuCommonModule = SaihuCommonModule_1 = __decorate([
|
|
100
|
+
(0, common_1.Module)({})
|
|
101
|
+
], SaihuCommonModule);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OnModuleInit, OnModuleDestroy } from "@nestjs/common";
|
|
2
|
+
import { CommonModuleOptions } from "../interfaces/options.interface";
|
|
3
|
+
import { RabbitmqService } from "../interfaces/service.interface";
|
|
4
|
+
export declare class RabbitmqServiceImpl implements RabbitmqService, OnModuleInit, OnModuleDestroy {
|
|
5
|
+
private readonly options;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
private connection;
|
|
8
|
+
private channel;
|
|
9
|
+
private isInitialized;
|
|
10
|
+
private isEnabled;
|
|
11
|
+
constructor(options: CommonModuleOptions);
|
|
12
|
+
onModuleInit(): Promise<void>;
|
|
13
|
+
onModuleDestroy(): Promise<void>;
|
|
14
|
+
connect(): Promise<void>;
|
|
15
|
+
disconnect(): Promise<void>;
|
|
16
|
+
publishMessage(message: any): Promise<boolean>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=rabbitmq.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rabbitmq.service.d.ts","sourceRoot":"","sources":["../../src/services/rabbitmq.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,eAAe,EAGhB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAElE,qBACa,mBACX,YAAW,eAAe,EAAE,YAAY,EAAE,eAAe;IAUvD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAR1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAC/D,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,OAAO,CAA2B;IAC1C,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAU;gBAIR,OAAO,EAAE,mBAAmB;IAKzC,YAAY;IAMZ,eAAe;IAIf,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA6BxB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAY3B,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;CAcrD"}
|
|
@@ -0,0 +1,126 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
|
+
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;
|
|
22
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
|
+
};
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
42
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
43
|
+
};
|
|
44
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
45
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
46
|
+
};
|
|
47
|
+
var RabbitmqServiceImpl_1;
|
|
48
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
+
exports.RabbitmqServiceImpl = void 0;
|
|
50
|
+
const common_1 = require("@nestjs/common");
|
|
51
|
+
const amqp = __importStar(require("amqplib"));
|
|
52
|
+
const common_consts_1 = require("../consts/common.consts");
|
|
53
|
+
let RabbitmqServiceImpl = RabbitmqServiceImpl_1 = class RabbitmqServiceImpl {
|
|
54
|
+
constructor(options) {
|
|
55
|
+
this.options = options;
|
|
56
|
+
this.logger = new common_1.Logger(RabbitmqServiceImpl_1.name);
|
|
57
|
+
this.isInitialized = false;
|
|
58
|
+
this.isEnabled = this.options.useOperlog !== false; // 默认 true
|
|
59
|
+
}
|
|
60
|
+
async onModuleInit() {
|
|
61
|
+
if (this.isEnabled) {
|
|
62
|
+
await this.connect();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async onModuleDestroy() {
|
|
66
|
+
await this.disconnect();
|
|
67
|
+
}
|
|
68
|
+
async connect() {
|
|
69
|
+
if (!this.isEnabled) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
if (this.isInitialized) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
if (!this.options.rabbitmq) {
|
|
77
|
+
this.logger.error("common RabbitMQ options not configured");
|
|
78
|
+
throw new Error("common RabbitMQ options not configured");
|
|
79
|
+
}
|
|
80
|
+
if (!this.options.rabbitmq.url) {
|
|
81
|
+
this.logger.error("common RabbitMQ url not configured");
|
|
82
|
+
throw new Error("common RabbitMQ url not configured");
|
|
83
|
+
}
|
|
84
|
+
const connectionString = this.options.rabbitmq.url;
|
|
85
|
+
this.connection = await amqp.connect(connectionString);
|
|
86
|
+
this.channel = await this.connection.createChannel();
|
|
87
|
+
this.isInitialized = true;
|
|
88
|
+
this.logger.log("common RabbitMQ connected successfully");
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
this.logger.error("commonFailed to connect to RabbitMQ:", error);
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async disconnect() {
|
|
96
|
+
if (!this.isEnabled) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (this.channel) {
|
|
100
|
+
await this.channel.close();
|
|
101
|
+
}
|
|
102
|
+
if (this.connection) {
|
|
103
|
+
await this.connection.close();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
async publishMessage(message) {
|
|
107
|
+
if (!this.channel) {
|
|
108
|
+
this.logger.error("RabbitMQ channel not initialized");
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const messageBuffer = Buffer.from(JSON.stringify(message));
|
|
113
|
+
return this.channel.publish(common_consts_1.OPER_LOG_EXCHANGE, common_consts_1.OPER_LOG_QUEUE, messageBuffer);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
this.logger.error("Failed to publish message to RabbitMQ:", error);
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
exports.RabbitmqServiceImpl = RabbitmqServiceImpl;
|
|
122
|
+
exports.RabbitmqServiceImpl = RabbitmqServiceImpl = RabbitmqServiceImpl_1 = __decorate([
|
|
123
|
+
(0, common_1.Injectable)(),
|
|
124
|
+
__param(0, (0, common_1.Inject)(common_consts_1.COMMON_MODULE_OPTIONS)),
|
|
125
|
+
__metadata("design:paramtypes", [Object])
|
|
126
|
+
], RabbitmqServiceImpl);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OnModuleInit, OnModuleDestroy } from "@nestjs/common";
|
|
2
|
+
import { CommonModuleOptions } from "../interfaces/options.interface";
|
|
3
|
+
import { RedisService } from "../interfaces/service.interface";
|
|
4
|
+
export declare class RedisServiceImpl implements RedisService, OnModuleInit, OnModuleDestroy {
|
|
5
|
+
private readonly commonOptions;
|
|
6
|
+
private readonly logger;
|
|
7
|
+
private redisClient;
|
|
8
|
+
private isInitialized;
|
|
9
|
+
private isEnabled;
|
|
10
|
+
constructor(commonOptions: CommonModuleOptions);
|
|
11
|
+
onModuleInit(): Promise<void>;
|
|
12
|
+
initialize(): Promise<void>;
|
|
13
|
+
get<T>(key: string): Promise<T | null>;
|
|
14
|
+
set(key: string, value: string, ttl?: number): Promise<void>;
|
|
15
|
+
del(key: string): Promise<void>;
|
|
16
|
+
onModuleDestroy(): void;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=redis.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis.service.d.ts","sourceRoot":"","sources":["../../src/services/redis.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,eAAe,EAGhB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,qBACa,gBACX,YAAW,YAAY,EAAE,YAAY,EAAE,eAAe;IASpD,OAAO,CAAC,QAAQ,CAAC,aAAa;IAPhC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqC;IAC5D,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAkB;gBAIhB,aAAa,EAAE,mBAAmB;IAK/C,YAAY;IAIZ,UAAU;IAmCV,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAYtC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW5D,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrC,eAAe;CAMhB"}
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
15
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
16
|
+
};
|
|
17
|
+
var RedisServiceImpl_1;
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.RedisServiceImpl = void 0;
|
|
20
|
+
const common_1 = require("@nestjs/common");
|
|
21
|
+
const ioredis_1 = __importDefault(require("ioredis"));
|
|
22
|
+
const common_consts_1 = require("../consts/common.consts");
|
|
23
|
+
let RedisServiceImpl = RedisServiceImpl_1 = class RedisServiceImpl {
|
|
24
|
+
constructor(commonOptions) {
|
|
25
|
+
this.commonOptions = commonOptions;
|
|
26
|
+
this.logger = new common_1.Logger(RedisServiceImpl_1.name);
|
|
27
|
+
this.isInitialized = false;
|
|
28
|
+
this.isEnabled = false;
|
|
29
|
+
this.isEnabled = commonOptions.usePerms !== false;
|
|
30
|
+
}
|
|
31
|
+
async onModuleInit() {
|
|
32
|
+
await this.initialize();
|
|
33
|
+
}
|
|
34
|
+
async initialize() {
|
|
35
|
+
if (!this.isEnabled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (this.isInitialized) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
if (!this.commonOptions.redis) {
|
|
43
|
+
this.logger.error("common Redis options not found");
|
|
44
|
+
throw new Error("common Redis options not found");
|
|
45
|
+
}
|
|
46
|
+
if (!this.commonOptions.redis.url) {
|
|
47
|
+
this.logger.error("common Redis url not found");
|
|
48
|
+
throw new Error("common Redis url not found");
|
|
49
|
+
}
|
|
50
|
+
if (!this.commonOptions.redis.password) {
|
|
51
|
+
this.logger.error("common Redis password not found");
|
|
52
|
+
throw new Error("common Redis password not found");
|
|
53
|
+
}
|
|
54
|
+
const url = this.commonOptions.redis.url;
|
|
55
|
+
this.logger.log(`common Redis url: ${url}`);
|
|
56
|
+
const password = this.commonOptions.redis.password;
|
|
57
|
+
this.redisClient = new ioredis_1.default(url, {
|
|
58
|
+
password,
|
|
59
|
+
db: common_consts_1.REDIS_AUTH_DB,
|
|
60
|
+
});
|
|
61
|
+
this.logger.log("common Redis connected successfully");
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
this.logger.error("common Failed to connect to Redis:", error);
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async get(key) {
|
|
69
|
+
const value = await this.redisClient.get(key);
|
|
70
|
+
if (!value) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
return JSON.parse(value);
|
|
75
|
+
}
|
|
76
|
+
catch (_a) {
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async set(key, value, ttl) {
|
|
81
|
+
const serializedValue = typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
82
|
+
if (ttl) {
|
|
83
|
+
await this.redisClient.setex(key, ttl, serializedValue);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
await this.redisClient.set(key, serializedValue);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async del(key) {
|
|
90
|
+
await this.redisClient.del(key);
|
|
91
|
+
}
|
|
92
|
+
onModuleDestroy() {
|
|
93
|
+
if (!this.isEnabled) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
this.redisClient.disconnect();
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
exports.RedisServiceImpl = RedisServiceImpl;
|
|
100
|
+
exports.RedisServiceImpl = RedisServiceImpl = RedisServiceImpl_1 = __decorate([
|
|
101
|
+
(0, common_1.Injectable)(),
|
|
102
|
+
__param(0, (0, common_1.Inject)(common_consts_1.COMMON_MODULE_OPTIONS)),
|
|
103
|
+
__metadata("design:paramtypes", [Object])
|
|
104
|
+
], RedisServiceImpl);
|
package/dist/util/times.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare function getDayStart(date: string): Date;
|
|
2
|
+
export declare function getDayEnd(date: string): Date;
|
|
1
3
|
export declare function getCurrentDate(): string;
|
|
2
4
|
export declare function getTomorrowDate(): string;
|
|
3
5
|
export declare function getCurrentChinaTime(): Date;
|
package/dist/util/times.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"times.d.ts","sourceRoot":"","sources":["../../src/util/times.ts"],"names":[],"mappings":"AAQA,wBAAgB,cAAc,WAE7B;AAED,wBAAgB,eAAe,WAE9B;AAED,wBAAgB,mBAAmB,SAMlC;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,MAAM,EACrB,MAAM,GAAE,MAA8B,GACrC,MAAM,CAER;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CASjD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAS/C;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D;
|
|
1
|
+
{"version":3,"file":"times.d.ts","sourceRoot":"","sources":["../../src/util/times.ts"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,QAEvC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,QAErC;AAED,wBAAgB,cAAc,WAE7B;AAED,wBAAgB,eAAe,WAE9B;AAED,wBAAgB,mBAAmB,SAMlC;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,wBAAgB,8BAA8B,CAC5C,aAAa,EAAE,MAAM,EACrB,MAAM,GAAE,MAA8B,GACrC,MAAM,CAER;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CASjD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAS/C;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,eAAO,MAAM,cAAc,QAAO,MAOjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,MAOpC,CAAC"}
|
package/dist/util/times.js
CHANGED
|
@@ -4,6 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getCurrentVersion = exports.getNextVersion = void 0;
|
|
7
|
+
exports.getDayStart = getDayStart;
|
|
8
|
+
exports.getDayEnd = getDayEnd;
|
|
7
9
|
exports.getCurrentDate = getCurrentDate;
|
|
8
10
|
exports.getTomorrowDate = getTomorrowDate;
|
|
9
11
|
exports.getCurrentChinaTime = getCurrentChinaTime;
|
|
@@ -19,6 +21,12 @@ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
|
19
21
|
// Enable timezone support
|
|
20
22
|
dayjs_1.default.extend(utc_1.default);
|
|
21
23
|
dayjs_1.default.extend(timezone_1.default);
|
|
24
|
+
function getDayStart(date) {
|
|
25
|
+
return dayjs_1.default.utc(date).startOf('day').toDate();
|
|
26
|
+
}
|
|
27
|
+
function getDayEnd(date) {
|
|
28
|
+
return dayjs_1.default.utc(date).endOf('day').toDate();
|
|
29
|
+
}
|
|
22
30
|
function getCurrentDate() {
|
|
23
31
|
return (0, dayjs_1.default)().tz('Asia/Shanghai').format('YYYY-MM-DD');
|
|
24
32
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saihu/common",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.28",
|
|
4
4
|
"description": "Common utilities for NestJS applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,17 +23,21 @@
|
|
|
23
23
|
"rxjs": "^7.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
+
"@types/amqplib": "^0.10.7",
|
|
26
27
|
"@types/express": "^5.0.1",
|
|
27
28
|
"@types/node": "^22.14.1",
|
|
28
29
|
"typescript": "^5.8.3"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
32
|
+
"@nestjs/config": "^4.0.2",
|
|
31
33
|
"@nestjs/core": "^11.1.1",
|
|
32
34
|
"@nestjs/jwt": "^11.0.0",
|
|
35
|
+
"amqplib": "^0.10.9",
|
|
33
36
|
"class-transformer": "^0.5.1",
|
|
34
37
|
"class-validator": "^0.14.2",
|
|
35
38
|
"dayjs": "^1.11.13",
|
|
36
39
|
"express": "^5.1.0",
|
|
40
|
+
"ioredis": "^5.7.0",
|
|
37
41
|
"pinyin-pro": "^3.26.0"
|
|
38
42
|
}
|
|
39
43
|
}
|