@yolo-croket-dev/core 1.8.7-beta.8 → 1.8.7

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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npm run lint)"
5
+ ],
6
+ "deny": [],
7
+ "ask": []
8
+ }
9
+ }
@@ -1,7 +1,6 @@
1
1
  import { HttpException } from '@nestjs/common';
2
2
  import { ErrAction } from '../interfaces/exception';
3
- import { MsaException } from '../interfaces/msa-exception';
4
- export declare class BadRequest extends HttpException implements MsaException {
3
+ export declare class BadRequest extends HttpException {
5
4
  subMessage: string | null;
6
5
  errType: string | null;
7
6
  errMessage: string | null;
@@ -1,7 +1,6 @@
1
1
  import { HttpException } from '@nestjs/common';
2
2
  import { ErrAction } from '../interfaces/exception';
3
- import { MsaException } from '../interfaces/msa-exception';
4
- export declare class Conflict extends HttpException implements MsaException {
3
+ export declare class Conflict extends HttpException {
5
4
  subMessage: string | null;
6
5
  errType: string | null;
7
6
  errMessage: string | null;
@@ -1,16 +1,13 @@
1
1
  import { HttpException } from '@nestjs/common';
2
- import { ErrAction } from '../interfaces/exception';
3
- import { MsaException } from '../interfaces/msa-exception';
4
2
  /**
5
3
  * Forbidden 지원
6
4
  * Type O
7
5
  * ErrAction X
8
6
  */
9
- export declare class Forbidden extends HttpException implements MsaException {
7
+ export declare class Forbidden extends HttpException {
10
8
  subMessage: string | null;
11
9
  errType: string | null;
12
10
  errMessage: string | null;
13
- errAction: ErrAction | null;
14
11
  /** 해당 에러시 재시도 여부 */
15
12
  isRetry?: boolean;
16
13
  constructor(errType: string, errMessage?: string, isRetry?: boolean);
@@ -15,12 +15,10 @@ class Forbidden extends common_1.HttpException {
15
15
  // new
16
16
  this.errType = null;
17
17
  this.errMessage = null;
18
- this.errAction = null;
19
18
  this.subMessage = errMessage || null;
20
19
  // new
21
20
  this.errType = errType || null;
22
21
  this.errMessage = errMessage || null;
23
- this.errAction = null;
24
22
  this.isRetry = isRetry;
25
23
  }
26
24
  }
@@ -1,7 +1,6 @@
1
1
  import { HttpException } from '@nestjs/common';
2
2
  import { ErrAction } from '../interfaces/exception';
3
- import { MsaException } from '../interfaces/msa-exception';
4
- export declare class Gone extends HttpException implements MsaException {
3
+ export declare class Gone extends HttpException {
5
4
  subMessage: string | null;
6
5
  errType: string | null;
7
6
  errMessage: string | null;
@@ -1,7 +1,6 @@
1
1
  import { HttpException } from '@nestjs/common';
2
2
  import { ErrAction } from '../interfaces/exception';
3
- import { MsaException } from '../interfaces/msa-exception';
4
- export declare class InternalServerError extends HttpException implements MsaException {
3
+ export declare class InternalServerError extends HttpException {
5
4
  subMessage: string | null;
6
5
  errType: string | null;
7
6
  errMessage: string | null;
@@ -1,7 +1,6 @@
1
1
  import { HttpException } from '@nestjs/common';
2
2
  import { ErrAction } from '../interfaces/exception';
3
- import { MsaException } from '../interfaces/msa-exception';
4
- export declare class MethodNotAllowed extends HttpException implements MsaException {
3
+ export declare class MethodNotAllowed extends HttpException {
5
4
  subMessage: string | null;
6
5
  errType: string | null;
7
6
  errMessage: string | null;
@@ -1,7 +1,6 @@
1
1
  import { HttpException } from '@nestjs/common';
2
2
  import { ErrAction } from '../interfaces/exception';
3
- import { MsaException } from '../interfaces/msa-exception';
4
- export declare class NotAcceptable extends HttpException implements MsaException {
3
+ export declare class NotAcceptable extends HttpException {
5
4
  subMessage: string | null;
6
5
  errType: string | null;
7
6
  errMessage: string | null;
@@ -1,7 +1,6 @@
1
1
  import { HttpException } from '@nestjs/common';
2
2
  import { ErrAction } from '../interfaces/exception';
3
- import { MsaException } from '../interfaces/msa-exception';
4
- export declare class NotFound extends HttpException implements MsaException {
3
+ export declare class NotFound extends HttpException {
5
4
  subMessage: string | null;
6
5
  errType: string | null;
7
6
  errMessage: string | null;
@@ -1,9 +1,6 @@
1
1
  import { HttpException } from '@nestjs/common';
2
2
  import { ErrAction } from '../interfaces/exception';
3
- import { MsaException } from '../interfaces/msa-exception';
4
- export declare class ServerPauseException extends HttpException implements MsaException {
5
- errType: string | null;
6
- errMessage: string | null;
3
+ export declare class ServerPauseException extends HttpException {
7
4
  errAction: ErrAction | null;
8
5
  constructor(serverPauseTitle: string, serverPauseMessage: string);
9
6
  }
@@ -6,11 +6,7 @@ const exception_1 = require("../interfaces/exception");
6
6
  class ServerPauseException extends common_1.HttpException {
7
7
  constructor(serverPauseTitle, serverPauseMessage) {
8
8
  super('SERVER_PAUSE_EXCEPTION', common_1.HttpStatus.SERVICE_UNAVAILABLE);
9
- this.errType = null;
10
- this.errMessage = null;
11
9
  this.errAction = null;
12
- this.errType = 'SERVER_PAUSE_EXCEPTION';
13
- this.errMessage = serverPauseMessage;
14
10
  this.errAction = {
15
11
  type: exception_1.ErrActionTypeEnum.SERVER_PAUSE,
16
12
  serverPauseTitle,
@@ -1,14 +1,12 @@
1
1
  import { HttpException } from '@nestjs/common';
2
2
  import { ErrAction } from '../interfaces/exception';
3
- import { MsaException } from '../interfaces/msa-exception';
4
3
  /**
5
4
  * UnAuthorized 지원
6
5
  * Type X
7
6
  * ErrAction X
8
7
  */
9
- export declare class UnAuthorized extends HttpException implements MsaException {
8
+ export declare class UnAuthorized extends HttpException {
10
9
  subMessage: string | null;
11
- errType: string | null;
12
10
  errMessage: string | null;
13
11
  errAction: ErrAction | null;
14
12
  constructor(errMessage?: string, errAction?: ErrAction);
@@ -13,12 +13,10 @@ class UnAuthorized extends common_1.HttpException {
13
13
  // legacy
14
14
  this.subMessage = null;
15
15
  // new
16
- this.errType = null;
17
16
  this.errMessage = null;
18
17
  this.errAction = null;
19
18
  this.subMessage = errMessage || null;
20
19
  // new
21
- this.errType = 'USER_AUTHENTICATION_FAIL';
22
20
  this.errMessage = errMessage || null;
23
21
  this.errAction = errAction || null;
24
22
  }
@@ -5,5 +5,3 @@ export * from './rewrite-file-value.function';
5
5
  export * from './amqp-call-manager.function';
6
6
  export * from './extract-redis-url.function';
7
7
  export * from './abort';
8
- export * from './uncaught-exception-handler';
9
- export * from './unhandled-rejection-handler';
@@ -21,5 +21,3 @@ __exportStar(require("./rewrite-file-value.function"), exports);
21
21
  __exportStar(require("./amqp-call-manager.function"), exports);
22
22
  __exportStar(require("./extract-redis-url.function"), exports);
23
23
  __exportStar(require("./abort"), exports);
24
- __exportStar(require("./uncaught-exception-handler"), exports);
25
- __exportStar(require("./unhandled-rejection-handler"), exports);
package/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from './exceptions';
2
2
  export * from './interceptors';
3
3
  export * from './interfaces';
4
- export * from './functions';
package/index.js CHANGED
@@ -17,4 +17,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./exceptions"), exports);
18
18
  __exportStar(require("./interceptors"), exports);
19
19
  __exportStar(require("./interfaces"), exports);
20
- __exportStar(require("./functions"), exports);
@@ -110,7 +110,9 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
110
110
  const currentSpan = dd_trace_1.default.scope().active();
111
111
  let loggingSpan = null;
112
112
  if (currentSpan) {
113
- loggingSpan = dd_trace_1.default.startSpan(`logging-service-interceptor-${content.pattern}`, { childOf: currentSpan.context() });
113
+ loggingSpan = dd_trace_1.default.startSpan(`logging-service-interceptor-${content.pattern}`, {
114
+ childOf: currentSpan.context(),
115
+ });
114
116
  }
115
117
  if (loggingSpan) {
116
118
  loggingSpan.setTag('traceId', traceId);
@@ -149,9 +151,9 @@ let LoggingServiceInterceptor = class LoggingServiceInterceptor {
149
151
  msaLogger.printExceptionFliterService({
150
152
  traceId,
151
153
  errInfo: {
152
- errType: error.subMessage ? error.message : error.name,
153
- message: error.subMessage ? error.subMessage : error.message,
154
+ errType: error.message,
154
155
  status: error.status,
156
+ message: error.subMessage,
155
157
  stack: error.stack,
156
158
  },
157
159
  messageBrokerInfo: {
@@ -2,4 +2,3 @@ export * from './http';
2
2
  export * from './decorator';
3
3
  export * from './exception';
4
4
  export * from './amqp';
5
- export * from './msa-exception';
@@ -18,4 +18,3 @@ __exportStar(require("./http"), exports);
18
18
  __exportStar(require("./decorator"), exports);
19
19
  __exportStar(require("./exception"), exports);
20
20
  __exportStar(require("./amqp"), exports);
21
- __exportStar(require("./msa-exception"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-croket-dev/core",
3
- "version": "1.8.7-beta.8",
3
+ "version": "1.8.7",
4
4
  "author": "Yolo Co., Ltd.",
5
5
  "description": "Yolo commonization module",
6
6
  "main": "index.js",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@yolo-croket-dev/logger": "^1.0.15",
24
- "@yolo-croket-dev/msa-logger": "^3.4.2",
24
+ "@yolo-croket-dev/msa-logger": "^3.3.1",
25
25
  "@yolo-croket-dev/redis": "^1.0.25",
26
26
  "axios": "^1.1.3",
27
27
  "dd-trace": "^5.46.0",
@@ -1,13 +0,0 @@
1
- /**
2
- * @author jun
3
- * @description uncaughtException 핸들러 - 에러 로깅 및 모니터링
4
- * @process
5
- * 1. 에러 로그 기록 (MsaLogger, Datadog)
6
- * 2. 개발팀에서 로그 확인 후 즉시 대응
7
- *
8
- * @note
9
- * - uncaughtException 발생 시 즉시 로그를 기록하여 모니터링
10
- * - 개발팀에서 알림을 받고 바로 대응 예정
11
- * - MsaLogger 실패 시에도 console.error로 fallback 처리
12
- */
13
- export declare function uncaughtExceptionHandler(err: any): void;
@@ -1,62 +0,0 @@
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.uncaughtExceptionHandler = void 0;
27
- /* eslint-disable @typescript-eslint/no-explicit-any */
28
- const msa_logger_1 = __importStar(require("@yolo-croket-dev/msa-logger"));
29
- const msaLogger = new msa_logger_1.default(msa_logger_1.ServerTypeEnum.GATEWAY);
30
- /**
31
- * @author jun
32
- * @description uncaughtException 핸들러 - 에러 로깅 및 모니터링
33
- * @process
34
- * 1. 에러 로그 기록 (MsaLogger, Datadog)
35
- * 2. 개발팀에서 로그 확인 후 즉시 대응
36
- *
37
- * @note
38
- * - uncaughtException 발생 시 즉시 로그를 기록하여 모니터링
39
- * - 개발팀에서 알림을 받고 바로 대응 예정
40
- * - MsaLogger 실패 시에도 console.error로 fallback 처리
41
- */
42
- function uncaughtExceptionHandler(err) {
43
- try {
44
- msaLogger.error('uncaughtException', {
45
- traceId: 'uncaughtException',
46
- errInfo: {
47
- errType: err.name || 'Error',
48
- status: err.status || 500,
49
- message: err.message,
50
- stack: err.stack,
51
- },
52
- });
53
- }
54
- catch (logError) {
55
- // MsaLogger 실패 시 최후의 수단
56
- // eslint-disable-next-line no-console
57
- console.error('Failed to log uncaughtException:', logError);
58
- // eslint-disable-next-line no-console
59
- console.error('Original error:', err);
60
- }
61
- }
62
- exports.uncaughtExceptionHandler = uncaughtExceptionHandler;
@@ -1,13 +0,0 @@
1
- /**
2
- * @author jun
3
- * @description unhandledRejection 핸들러 - 에러 로깅 및 모니터링
4
- * @process
5
- * 1. Promise rejection 에러 로그 기록
6
- * 2. 개발팀에서 로그 확인 후 즉시 대응
7
- *
8
- * @note
9
- * - unhandledRejection 발생 시 즉시 로그를 기록하여 모니터링
10
- * - 개발팀에서 알림을 받고 바로 대응 예정
11
- * - MsaLogger 실패 시에도 console.error로 fallback 처리
12
- */
13
- export declare function unhandledRejectionHandler(err: any): void;
@@ -1,62 +0,0 @@
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.unhandledRejectionHandler = void 0;
27
- /* eslint-disable @typescript-eslint/no-explicit-any */
28
- const msa_logger_1 = __importStar(require("@yolo-croket-dev/msa-logger"));
29
- const msaLogger = new msa_logger_1.default(msa_logger_1.ServerTypeEnum.SERVICE);
30
- /**
31
- * @author jun
32
- * @description unhandledRejection 핸들러 - 에러 로깅 및 모니터링
33
- * @process
34
- * 1. Promise rejection 에러 로그 기록
35
- * 2. 개발팀에서 로그 확인 후 즉시 대응
36
- *
37
- * @note
38
- * - unhandledRejection 발생 시 즉시 로그를 기록하여 모니터링
39
- * - 개발팀에서 알림을 받고 바로 대응 예정
40
- * - MsaLogger 실패 시에도 console.error로 fallback 처리
41
- */
42
- function unhandledRejectionHandler(err) {
43
- try {
44
- msaLogger.error('unhandledRejection', {
45
- traceId: 'unhandledRejection',
46
- errInfo: {
47
- errType: (err === null || err === void 0 ? void 0 : err.name) || 'UnhandledRejection',
48
- status: (err === null || err === void 0 ? void 0 : err.status) || 500,
49
- message: (err === null || err === void 0 ? void 0 : err.message) || String(err),
50
- stack: err === null || err === void 0 ? void 0 : err.stack,
51
- },
52
- });
53
- }
54
- catch (logError) {
55
- // MsaLogger 실패 시 최후의 수단
56
- // eslint-disable-next-line no-console
57
- console.error('Failed to log unhandledRejection:', logError);
58
- // eslint-disable-next-line no-console
59
- console.error('Original error:', err);
60
- }
61
- }
62
- exports.unhandledRejectionHandler = unhandledRejectionHandler;
@@ -1,25 +0,0 @@
1
- import { HttpException } from '@nestjs/common';
2
- import { ErrAction } from './exception';
3
- /**
4
- * @author jun
5
- * @description MSA 아키텍처에서 사용하는 공통 예외 인터페이스
6
- * @process 커스텀 예외 클래스들이 구현하여 일관된 에러 처리 가능
7
- */
8
- export interface MsaException {
9
- /** 에러 유형 코드 */
10
- errType: string | null;
11
- /** 에러 메시지 */
12
- errMessage: string | null;
13
- /** 클라이언트 액션 정보 */
14
- errAction: ErrAction | null;
15
- /** 재시도 가능 여부 */
16
- isRetry?: boolean;
17
- }
18
- /** HttpException과 MsaException을 결합한 타입 */
19
- export type MsaHttpException = MsaException & HttpException;
20
- /**
21
- * @description MsaException 타입 가드
22
- * @param error 검사할 에러 객체
23
- * @returns MsaHttpException 타입 여부
24
- */
25
- export declare function isMsaException(error: unknown): error is MsaHttpException;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isMsaException = void 0;
4
- const common_1 = require("@nestjs/common");
5
- /**
6
- * @description MsaException 타입 가드
7
- * @param error 검사할 에러 객체
8
- * @returns MsaHttpException 타입 여부
9
- */
10
- function isMsaException(error) {
11
- if (!error || typeof error !== 'object') {
12
- return false;
13
- }
14
- const err = error;
15
- return ('errType' in err
16
- && 'errMessage' in err
17
- && 'errAction' in err
18
- && error instanceof common_1.HttpException);
19
- }
20
- exports.isMsaException = isMsaException;