@yolo-croket-dev/core 1.4.52-jun.15 → 1.4.52-jun.2
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.
|
@@ -30,12 +30,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.LoggingServiceInterceptor = void 0;
|
|
33
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
34
33
|
/* eslint-disable no-param-reassign */
|
|
35
34
|
const common_1 = require("@nestjs/common");
|
|
36
35
|
const msa_logger_1 = __importStar(require("@yolo-croket-dev/msa-logger"));
|
|
37
36
|
const operators_1 = require("rxjs/operators");
|
|
38
|
-
const { SERVER_NAME } = process.env;
|
|
39
37
|
const msaLogger = new msa_logger_1.default(msa_logger_1.ServerTypeEnum.SERVICE);
|
|
40
38
|
const MAX_CUT_LENGTH = 500;
|
|
41
39
|
let LoggingServiceInterceptor = class LoggingServiceInterceptor {
|
|
@@ -70,25 +68,18 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
|
|
|
70
68
|
return data;
|
|
71
69
|
}
|
|
72
70
|
intercept(context, next) {
|
|
73
|
-
var _a;
|
|
74
71
|
const now = Date.now();
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
const originalMessage = rmqContext.getMessage();
|
|
72
|
+
const args = context.getArgs();
|
|
73
|
+
const rmq = args[1];
|
|
78
74
|
const ctx = context.switchToHttp();
|
|
79
75
|
const request = ctx.getRequest();
|
|
80
|
-
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
// console.log('originalMessage.properties.headers', originalMessage.properties.headers);
|
|
84
|
-
const originalcontent = originalMessage.content;
|
|
85
|
-
const content = JSON.parse(originalcontent.toString());
|
|
76
|
+
const message = rmq.getMessage();
|
|
77
|
+
// const now = Date.now();
|
|
78
|
+
const content = JSON.parse(message.content.toString());
|
|
86
79
|
const traceId = content.data.param ? content.data.param.traceId : '-';
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
console.log('hi@', content);
|
|
91
|
-
originalMessage.content = Buffer.from(JSON.stringify(content));
|
|
80
|
+
console.log('intercept 시작 request', request);
|
|
81
|
+
console.log('intercept 시작 message', message);
|
|
82
|
+
console.log('intercept 시작 content', content);
|
|
92
83
|
msaLogger.printInputInterceptorService({
|
|
93
84
|
traceId,
|
|
94
85
|
messageBrokerInfo: {
|
|
@@ -96,7 +87,6 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
|
|
|
96
87
|
payload: JSON.stringify(this.keyCutter(JSON.stringify(request.payload))),
|
|
97
88
|
},
|
|
98
89
|
paramInfo: request.param,
|
|
99
|
-
traceInfo: { from },
|
|
100
90
|
});
|
|
101
91
|
return next.handle()
|
|
102
92
|
.pipe((0, operators_1.tap)(() => {
|
|
@@ -107,11 +97,6 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
|
|
|
107
97
|
status: 200,
|
|
108
98
|
ms: elapsed,
|
|
109
99
|
},
|
|
110
|
-
messageBrokerInfo: {
|
|
111
|
-
messagePatten: content.pattern,
|
|
112
|
-
payload: JSON.stringify(this.keyCutter(JSON.stringify(request.payload))),
|
|
113
|
-
},
|
|
114
|
-
traceInfo: { from },
|
|
115
100
|
});
|
|
116
101
|
})).pipe((0, operators_1.catchError)((error) => {
|
|
117
102
|
msaLogger.printExceptionFliterService({
|
|
@@ -122,11 +107,6 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
|
|
|
122
107
|
message: error.subMessage,
|
|
123
108
|
stack: error.stack,
|
|
124
109
|
},
|
|
125
|
-
messageBrokerInfo: {
|
|
126
|
-
messagePatten: content.pattern,
|
|
127
|
-
payload: JSON.stringify(this.keyCutter(JSON.stringify(request.payload))),
|
|
128
|
-
},
|
|
129
|
-
traceInfo: { from },
|
|
130
110
|
});
|
|
131
111
|
const elapsed = Date.now() - now;
|
|
132
112
|
msaLogger.printOutService({
|
|
@@ -135,17 +115,12 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
|
|
|
135
115
|
status: error.status,
|
|
136
116
|
ms: elapsed,
|
|
137
117
|
},
|
|
138
|
-
messageBrokerInfo: {
|
|
139
|
-
messagePatten: content.pattern,
|
|
140
|
-
payload: JSON.stringify(this.keyCutter(JSON.stringify(request.payload))),
|
|
141
|
-
},
|
|
142
|
-
traceInfo: { from },
|
|
143
118
|
});
|
|
144
119
|
throw error;
|
|
145
120
|
}));
|
|
146
121
|
}
|
|
147
122
|
};
|
|
148
|
-
|
|
149
|
-
exports.LoggingServiceInterceptor = LoggingServiceInterceptor = __decorate([
|
|
123
|
+
LoggingServiceInterceptor = __decorate([
|
|
150
124
|
(0, common_1.Injectable)()
|
|
151
125
|
], LoggingServiceInterceptor);
|
|
126
|
+
exports.LoggingServiceInterceptor = LoggingServiceInterceptor;
|
|
@@ -10,7 +10,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.RPCInterceptor = void 0;
|
|
13
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
14
13
|
/* eslint-disable no-param-reassign */
|
|
15
14
|
const common_1 = require("@nestjs/common");
|
|
16
15
|
const core_1 = require("@nestjs/core");
|
|
@@ -166,10 +165,7 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
166
165
|
errMessage,
|
|
167
166
|
errAction,
|
|
168
167
|
};
|
|
169
|
-
if (!Number.isNaN(staticRetryCount)
|
|
170
|
-
&& staticRetryCount
|
|
171
|
-
&& err.isRetry !== false) {
|
|
172
|
-
/** 재시도 로직이 필요한 경우, 0보다 커야 정의된것. 기본값이 0, isRetry값이 false로 정의된 에러가 아니라면 전부 재시도 */
|
|
168
|
+
if (!Number.isNaN(staticRetryCount) && staticRetryCount && err.isRetry !== false) { /** 재시도 로직이 필요한 경우, 0보다 커야 정의된것. 기본값이 0, isRetry값이 false로 정의된 에러가 아니라면 전부 재시도 */
|
|
173
169
|
if (reDeliveryCount <= (staticRetryCount - 1)) { /** 재시도 횟수가 있고, 재시도 횟수보다 적을 경우, 0부터 카운팅 되므로 -1 */
|
|
174
170
|
channel.nack(message, false, true);
|
|
175
171
|
message.properties.replyTo = undefined; /** replyTo가 존재하면 sendToQueue가 호출되므로, 삭제해주기 */
|
|
@@ -260,8 +256,8 @@ let RPCInterceptor = class RPCInterceptor {
|
|
|
260
256
|
}));
|
|
261
257
|
}
|
|
262
258
|
};
|
|
263
|
-
|
|
264
|
-
exports.RPCInterceptor = RPCInterceptor = __decorate([
|
|
259
|
+
RPCInterceptor = __decorate([
|
|
265
260
|
(0, common_1.Injectable)(),
|
|
266
261
|
__metadata("design:paramtypes", [core_1.Reflector])
|
|
267
262
|
], RPCInterceptor);
|
|
263
|
+
exports.RPCInterceptor = RPCInterceptor;
|
package/interfaces/exception.js
CHANGED
|
@@ -18,10 +18,9 @@ var ErrActionTypeEnum;
|
|
|
18
18
|
ErrActionTypeEnum["LEGACY_SHOW_TOAST"] = "LEGACY_SHOW_TOAST";
|
|
19
19
|
ErrActionTypeEnum["FORCE_UPDATE"] = "FORCE_UPDATE";
|
|
20
20
|
ErrActionTypeEnum["UPDATE_ACCESS_TOKEN"] = "UPDATE_ACCESS_TOKEN";
|
|
21
|
-
})(ErrActionTypeEnum
|
|
21
|
+
})(ErrActionTypeEnum = exports.ErrActionTypeEnum || (exports.ErrActionTypeEnum = {}));
|
|
22
22
|
class ErrAction {
|
|
23
23
|
}
|
|
24
|
-
exports.ErrAction = ErrAction;
|
|
25
24
|
__decorate([
|
|
26
25
|
(0, swagger_1.ApiProperty)({
|
|
27
26
|
description: '액션 타입',
|
|
@@ -58,9 +57,9 @@ __decorate([
|
|
|
58
57
|
}),
|
|
59
58
|
__metadata("design:type", String)
|
|
60
59
|
], ErrAction.prototype, "webViewUrl", void 0);
|
|
60
|
+
exports.ErrAction = ErrAction;
|
|
61
61
|
class ErrInfo {
|
|
62
62
|
}
|
|
63
|
-
exports.ErrInfo = ErrInfo;
|
|
64
63
|
__decorate([
|
|
65
64
|
(0, swagger_1.ApiProperty)({
|
|
66
65
|
description: '에러 종류 식별자',
|
|
@@ -82,3 +81,4 @@ __decorate([
|
|
|
82
81
|
}),
|
|
83
82
|
__metadata("design:type", ErrAction)
|
|
84
83
|
], ErrInfo.prototype, "action", void 0);
|
|
84
|
+
exports.ErrInfo = ErrInfo;
|
package/modules/redis.module.js
CHANGED
|
@@ -15,10 +15,10 @@ const redisProvider = {
|
|
|
15
15
|
};
|
|
16
16
|
let RedisModule = class RedisModule {
|
|
17
17
|
};
|
|
18
|
-
|
|
19
|
-
exports.RedisModule = RedisModule = __decorate([
|
|
18
|
+
RedisModule = __decorate([
|
|
20
19
|
(0, common_1.Module)({
|
|
21
20
|
providers: [redisProvider],
|
|
22
21
|
exports: [redisProvider],
|
|
23
22
|
})
|
|
24
23
|
], RedisModule);
|
|
24
|
+
exports.RedisModule = RedisModule;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yolo-croket-dev/core",
|
|
3
|
-
"version": "1.4.52-jun.
|
|
3
|
+
"version": "1.4.52-jun.2",
|
|
4
4
|
"author": "Yolo Co., Ltd.",
|
|
5
5
|
"description": "Yolo commonization module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"@nestjs/common": "^8.2.3",
|
|
18
18
|
"@nestjs/microservices": "9.0.8",
|
|
19
19
|
"@yolo-croket-dev/logger": "^1.0.15",
|
|
20
|
-
"@yolo-croket-dev/msa-logger": "^2.1.0",
|
|
21
20
|
"@yolo-croket-dev/redis": "^1.0.23",
|
|
22
21
|
"@yolo-croket-dev/swagger": "^0.0.7",
|
|
23
22
|
"axios": "^1.1.3",
|
|
@@ -31,8 +31,8 @@ let ValidationPipe = class ValidationPipe {
|
|
|
31
31
|
return value;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
exports.ValidationPipe = ValidationPipe = __decorate([
|
|
34
|
+
ValidationPipe = __decorate([
|
|
36
35
|
(0, common_1.Injectable)(),
|
|
37
36
|
__metadata("design:paramtypes", [Object])
|
|
38
37
|
], ValidationPipe);
|
|
38
|
+
exports.ValidationPipe = ValidationPipe;
|