@yolo-croket-dev/core 1.7.35 → 1.7.36

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.
@@ -1,4 +1,10 @@
1
1
  /// <reference types="node" />
2
+ interface RequestContext {
3
+ abortSignal: AbortSignal;
4
+ requestId: string;
5
+ createdAt: number;
6
+ parentContext?: RequestContext;
7
+ }
2
8
  export declare class AbortContext {
3
9
  private static asyncLocalStorage;
4
10
  private static contextCounter;
@@ -9,7 +15,7 @@ export declare class AbortContext {
9
15
  abortSignal: AbortSignal;
10
16
  requestId: string;
11
17
  } | null;
12
- static endContext(): void;
18
+ static endContext(context?: RequestContext): void;
13
19
  /**
14
20
  * 컨텍스트가 유효한지 확인
15
21
  */
@@ -19,3 +25,4 @@ export declare class AbortContext {
19
25
  */
20
26
  static getDebugInfo(): any;
21
27
  }
28
+ export {};
@@ -33,9 +33,13 @@ class AbortContext {
33
33
  return null;
34
34
  }
35
35
  // 컨텍스트 종료
36
- static endContext() {
37
- const context = this.asyncLocalStorage.getStore();
38
- if (context) {
36
+ static endContext(context) {
37
+ const selectContext = context || this.asyncLocalStorage.getStore();
38
+ if (selectContext) {
39
+ // parent context가 있으면 전부 종료
40
+ if (selectContext.parentContext) {
41
+ this.endContext(selectContext.parentContext);
42
+ }
39
43
  this.asyncLocalStorage.disable();
40
44
  }
41
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yolo-croket-dev/core",
3
- "version": "1.7.35",
3
+ "version": "1.7.36",
4
4
  "author": "Yolo Co., Ltd.",
5
5
  "description": "Yolo commonization module",
6
6
  "main": "index.js",