@yolo-croket-dev/core 1.4.49 → 1.4.50

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.
@@ -117,7 +117,7 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
117
117
  }));
118
118
  }
119
119
  };
120
- LoggingServiceInterceptor = __decorate([
120
+ exports.LoggingServiceInterceptor = LoggingServiceInterceptor;
121
+ exports.LoggingServiceInterceptor = LoggingServiceInterceptor = __decorate([
121
122
  (0, common_1.Injectable)()
122
123
  ], LoggingServiceInterceptor);
123
- exports.LoggingServiceInterceptor = LoggingServiceInterceptor;
@@ -6,6 +6,5 @@ export declare class RPCInterceptor implements NestInterceptor {
6
6
  constructor(reflector: Reflector);
7
7
  private maxLengthOverShorten;
8
8
  private updateMaxLengthArrayShorten;
9
- private keyCutter;
10
9
  intercept(context: ExecutionContext, next: CallHandler): Promise<Observable<unknown>>;
11
10
  }
@@ -8,9 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.RPCInterceptor = void 0;
16
13
  /* eslint-disable no-param-reassign */
@@ -18,11 +15,10 @@ const common_1 = require("@nestjs/common");
18
15
  const core_1 = require("@nestjs/core");
19
16
  const rxjs_1 = require("rxjs");
20
17
  const operators_1 = require("rxjs/operators");
21
- const logger_1 = __importDefault(require("@yolo-croket-dev/logger"));
18
+ // import Logger from '@yolo-croket-dev/logger';
22
19
  const functions_1 = require("../functions");
23
20
  const exceptions_1 = require("../exceptions");
24
- const logger = logger_1.default.createLogger('RPCInterceptor');
25
- const MAX_CUT_LENGTH = 500;
21
+ // const MAX_CUT_LENGTH = 500;
26
22
  const MAX_LENGTH = 300;
27
23
  let RPCInterceptor = class RPCInterceptor {
28
24
  constructor(reflector) {
@@ -83,36 +79,32 @@ let RPCInterceptor = class RPCInterceptor {
83
79
  }
84
80
  return obj;
85
81
  }
86
- keyCutter(data) {
87
- try {
88
- if (data) {
89
- data = JSON.parse(data);
90
- }
91
- else {
92
- return data;
93
- }
94
- }
95
- catch (err) {
96
- return data;
97
- }
98
- for (const key of Object.keys(data)) {
99
- const type = typeof data[key];
100
- if (type === 'string') {
101
- if (data[key].length > MAX_CUT_LENGTH) {
102
- data[key] = `${data[key].slice(0, MAX_CUT_LENGTH)}...`;
103
- }
104
- }
105
- else if (type === 'object') {
106
- if (data[key] === null) {
107
- data[key] = null;
108
- }
109
- else {
110
- data[key] = this.keyCutter(data[key]);
111
- }
112
- }
113
- }
114
- return data;
115
- }
82
+ // private keyCutter(data: string) {
83
+ // try {
84
+ // if (data) {
85
+ // data = JSON.parse(data);
86
+ // } else {
87
+ // return data;
88
+ // }
89
+ // } catch (err) {
90
+ // return data;
91
+ // }
92
+ // for (const key of Object.keys(data)) {
93
+ // const type = typeof data[key as any];
94
+ // if (type === 'string') {
95
+ // if (data[key as any].length > MAX_CUT_LENGTH) {
96
+ // (data[key as any] as any) = `${data[key as any].slice(0, MAX_CUT_LENGTH)}...`;
97
+ // }
98
+ // } else if (type === 'object') {
99
+ // if (data[key as any] === null) {
100
+ // (data[key as any] as any) = null;
101
+ // } else {
102
+ // (data[key as any] as any) = this.keyCutter(data[key as any]);
103
+ // }
104
+ // }
105
+ // }
106
+ // return data;
107
+ // }
116
108
  async intercept(context, next) {
117
109
  var _a;
118
110
  const options = this.reflector.get('rpcInterceptorScope', context.getHandler());
@@ -123,16 +115,16 @@ let RPCInterceptor = class RPCInterceptor {
123
115
  const message = rmq.getMessage();
124
116
  const now = Date.now();
125
117
  const content = JSON.parse(message.content.toString());
126
- const traceId = content.data.param ? content.data.param.traceId : null;
118
+ // const traceId = content.data.param ? content.data.param.traceId : null;
127
119
  const isInternal = content.data.param ? content.data.param.isInternal : false;
128
120
  const isAdmin = content.data.param ? content.data.param.isAdmin : false;
129
- const method = content.pattern;
121
+ // const method = content.pattern;
130
122
  const reDeliveryCount = Number(message.properties.headers['x-delivery-count']) || 0; /** 몇번 재전달되었는지 */
131
123
  const staticRetryCount = Number(options === null || options === void 0 ? void 0 : options.messageRetryCount) || 0; /** 최대 재시도 갯수 */
132
- const logParam = {
133
- traceId,
134
- method,
135
- };
124
+ // const logParam = {
125
+ // traceId,
126
+ // method,
127
+ // };
136
128
  if (!staticRetryCount && reDeliveryCount > 0) {
137
129
  channel.nack(message, false, false); /** 아마도 기본 30분 타임아웃이 지나고 새로 들어오면 발생할 예정, DLQ로 이동 */
138
130
  message.properties.replyTo = undefined; /** replyTo가 존재하면 sendToQueue가 호출되므로, 삭제해주기 */
@@ -190,11 +182,11 @@ let RPCInterceptor = class RPCInterceptor {
190
182
  const messageContent = message.content.toString();
191
183
  /** 파일 객체 처리 */
192
184
  (0, functions_1.reWriteFileValue)((_a = messageContent === null || messageContent === void 0 ? void 0 : messageContent.data) === null || _a === void 0 ? void 0 : _a.file);
193
- logger.debug(`<= (error:${traceId}): ${JSON.stringify(sendMessage.toString())}`, {
194
- ...logParam,
195
- duration,
196
- isError: true,
197
- });
185
+ // logger.debug(`<= (error:${traceId}): ${JSON.stringify(sendMessage.toString())}`, {
186
+ // ...logParam,
187
+ // duration,
188
+ // isError: true,
189
+ // });
198
190
  if (!noAck && !isAck) {
199
191
  channel.ack(message);
200
192
  }
@@ -226,10 +218,10 @@ let RPCInterceptor = class RPCInterceptor {
226
218
  if (content.data.payload.file) {
227
219
  content.data.payload.file = `${content.data.payload.file.slice(0, 30)}...`;
228
220
  }
229
- logger.debug(`=> (${traceId}): ${JSON.stringify(this.keyCutter(JSON.stringify(content)))}`);
221
+ // logger.debug(`=> (${traceId}): ${JSON.stringify(this.keyCutter(JSON.stringify(content)))}`);
230
222
  }
231
223
  else {
232
- logger.debug(`=> (${traceId}): ${JSON.stringify(this.keyCutter(JSON.stringify(content)))}`);
224
+ // logger.debug(`=> (${traceId}): ${JSON.stringify(this.keyCutter(JSON.stringify(content)))}`);
233
225
  }
234
226
  // eslint-disable-next-line consistent-return
235
227
  return next
@@ -237,12 +229,12 @@ let RPCInterceptor = class RPCInterceptor {
237
229
  .pipe((0, operators_1.tap)({
238
230
  next: async (val) => {
239
231
  val.isError = false;
240
- const duration = Date.now() - now;
241
- logger.debug(`<= (success:${traceId}): ${val.message}`, {
242
- ...logParam,
243
- duration,
244
- isError: val.isError,
245
- });
232
+ // const duration = Date.now() - now;
233
+ // logger.debug(`<= (success:${traceId}): ${val.message}`, {
234
+ // ...logParam,
235
+ // duration,
236
+ // isError: val.isError,
237
+ // });
246
238
  /** 만약 응답데이터중 isRequeue가 true라면, 다시 재처리 하도록 함 */
247
239
  if (val.data && val.data.isRequeue) {
248
240
  channel.nack(message, false, true);
@@ -256,8 +248,8 @@ let RPCInterceptor = class RPCInterceptor {
256
248
  }));
257
249
  }
258
250
  };
259
- RPCInterceptor = __decorate([
251
+ exports.RPCInterceptor = RPCInterceptor;
252
+ exports.RPCInterceptor = RPCInterceptor = __decorate([
260
253
  (0, common_1.Injectable)(),
261
254
  __metadata("design:paramtypes", [core_1.Reflector])
262
255
  ], RPCInterceptor);
263
- exports.RPCInterceptor = RPCInterceptor;
@@ -18,9 +18,10 @@ 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 = exports.ErrActionTypeEnum || (exports.ErrActionTypeEnum = {}));
21
+ })(ErrActionTypeEnum || (exports.ErrActionTypeEnum = ErrActionTypeEnum = {}));
22
22
  class ErrAction {
23
23
  }
24
+ exports.ErrAction = ErrAction;
24
25
  __decorate([
25
26
  (0, swagger_1.ApiProperty)({
26
27
  description: '액션 타입',
@@ -57,9 +58,9 @@ __decorate([
57
58
  }),
58
59
  __metadata("design:type", String)
59
60
  ], ErrAction.prototype, "webViewUrl", void 0);
60
- exports.ErrAction = ErrAction;
61
61
  class ErrInfo {
62
62
  }
63
+ exports.ErrInfo = ErrInfo;
63
64
  __decorate([
64
65
  (0, swagger_1.ApiProperty)({
65
66
  description: '에러 종류 식별자',
@@ -81,4 +82,3 @@ __decorate([
81
82
  }),
82
83
  __metadata("design:type", ErrAction)
83
84
  ], ErrInfo.prototype, "action", void 0);
84
- exports.ErrInfo = ErrInfo;
@@ -15,10 +15,10 @@ const redisProvider = {
15
15
  };
16
16
  let RedisModule = class RedisModule {
17
17
  };
18
- RedisModule = __decorate([
18
+ exports.RedisModule = RedisModule;
19
+ exports.RedisModule = RedisModule = __decorate([
19
20
  (0, common_1.Module)({
20
21
  providers: [redisProvider],
21
22
  exports: [redisProvider],
22
23
  })
23
24
  ], 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.49",
3
+ "version": "1.4.50",
4
4
  "author": "Yolo Co., Ltd.",
5
5
  "description": "Yolo commonization module",
6
6
  "main": "index.js",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "@nestjs/common": "^8.2.3",
18
18
  "@nestjs/microservices": "9.0.8",
19
- "@yolo-croket-dev/logger": "^1.0.13",
19
+ "@yolo-croket-dev/logger": "^1.0.15",
20
20
  "@yolo-croket-dev/redis": "^1.0.22",
21
21
  "@yolo-croket-dev/swagger": "^0.0.7",
22
22
  "axios": "^1.1.3",
@@ -31,8 +31,8 @@ let ValidationPipe = class ValidationPipe {
31
31
  return value;
32
32
  }
33
33
  };
34
- ValidationPipe = __decorate([
34
+ exports.ValidationPipe = ValidationPipe;
35
+ exports.ValidationPipe = ValidationPipe = __decorate([
35
36
  (0, common_1.Injectable)(),
36
37
  __metadata("design:paramtypes", [Object])
37
38
  ], ValidationPipe);
38
- exports.ValidationPipe = ValidationPipe;