sales-frontend-api 0.0.20 → 0.0.21
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/dist/client.cjs +125 -97
- package/dist/client.cjs.map +1 -1
- package/dist/client.d.cts +10 -4
- package/dist/client.d.ts +10 -4
- package/dist/client.js +125 -97
- package/dist/client.js.map +1 -1
- package/dist/header.types-duHbFvO0.d.cts +11 -0
- package/dist/header.types-duHbFvO0.d.ts +11 -0
- package/dist/http-client-axios-Cz6Oo35g.d.cts +43 -0
- package/dist/http-client-axios-D4Ub9Xlb.d.ts +43 -0
- package/dist/method.cjs +130 -104
- package/dist/method.cjs.map +1 -1
- package/dist/method.d.cts +13 -11
- package/dist/method.d.ts +13 -11
- package/dist/method.js +130 -104
- package/dist/method.js.map +1 -1
- package/dist/server.cjs +4533 -489
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +121 -73
- package/dist/server.d.ts +121 -73
- package/dist/server.js +4527 -484
- package/dist/server.js.map +1 -1
- package/package.json +11 -31
- package/dist/common.cjs +0 -209
- package/dist/common.cjs.map +0 -1
- package/dist/common.d.cts +0 -34
- package/dist/common.d.ts +0 -34
- package/dist/common.js +0 -200
- package/dist/common.js.map +0 -1
- package/dist/csr-http-client-axios-DleS1Lqf.d.cts +0 -14
- package/dist/csr-http-client-axios-c1CKhjCe.d.ts +0 -14
- package/dist/error-handler-DCenPKx5.d.cts +0 -133
- package/dist/error-handler-DCenPKx5.d.ts +0 -133
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sales-frontend-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/
|
|
7
|
-
"types": "dist/
|
|
6
|
+
"main": "./dist/client.js",
|
|
7
|
+
"types": "dist/client.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
13
|
"import": {
|
|
14
|
-
"types": "./dist/
|
|
15
|
-
"default": "./dist/
|
|
14
|
+
"types": "./dist/client.d.ts",
|
|
15
|
+
"default": "./dist/client.js"
|
|
16
16
|
},
|
|
17
17
|
"require": {
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"default": "./dist/
|
|
18
|
+
"types": "./dist/client.d.ts",
|
|
19
|
+
"default": "./dist/client.cjs.js"
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"./server": {
|
|
@@ -29,26 +29,6 @@
|
|
|
29
29
|
"default": "./dist/server.cjs.js"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
-
"./client": {
|
|
33
|
-
"import": {
|
|
34
|
-
"types": "./dist/client.d.ts",
|
|
35
|
-
"default": "./dist/client.js"
|
|
36
|
-
},
|
|
37
|
-
"require": {
|
|
38
|
-
"types": "./dist/client.d.ts",
|
|
39
|
-
"default": "./dist/client.cjs.js"
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
"./common": {
|
|
43
|
-
"import": {
|
|
44
|
-
"types": "./dist/common.d.ts",
|
|
45
|
-
"default": "./dist/common.js"
|
|
46
|
-
},
|
|
47
|
-
"require": {
|
|
48
|
-
"types": "./dist/common.d.ts",
|
|
49
|
-
"default": "./dist/common.cjs.js"
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
32
|
"./method": {
|
|
53
33
|
"import": {
|
|
54
34
|
"types": "./dist/method.d.ts",
|
|
@@ -68,10 +48,10 @@
|
|
|
68
48
|
"@types/react": "19.1.0",
|
|
69
49
|
"react": "^19.1.0",
|
|
70
50
|
"eslint-config-sales-frontend-eslint-config-v8": "^0.0.6",
|
|
71
|
-
"sales-frontend-design-system": "0.0.
|
|
72
|
-
"sales-frontend-
|
|
51
|
+
"sales-frontend-design-system": "0.0.46",
|
|
52
|
+
"sales-frontend-bridge": "0.0.13",
|
|
73
53
|
"sales-frontend-stores": "0.0.2",
|
|
74
|
-
"sales-frontend-
|
|
54
|
+
"sales-frontend-typescript-config": "0.0.2"
|
|
75
55
|
},
|
|
76
56
|
"dependencies": {
|
|
77
57
|
"@tanstack/react-query": "^5.81.2",
|
|
@@ -79,7 +59,7 @@
|
|
|
79
59
|
},
|
|
80
60
|
"peerDependencies": {
|
|
81
61
|
"sales-frontend-bridge": "0.0.13",
|
|
82
|
-
"sales-frontend-design-system": "0.0.
|
|
62
|
+
"sales-frontend-design-system": "0.0.46",
|
|
83
63
|
"sales-frontend-stores": "0.0.2"
|
|
84
64
|
},
|
|
85
65
|
"scripts": {
|
package/dist/common.cjs
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var axios = require('axios');
|
|
4
|
-
|
|
5
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
-
|
|
7
|
-
var axios__default = /*#__PURE__*/_interopDefault(axios);
|
|
8
|
-
|
|
9
|
-
var __defProp = Object.defineProperty;
|
|
10
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
12
|
-
|
|
13
|
-
// src/http-client/abstract-http-client.ts
|
|
14
|
-
var AbstractHttpClient = class {
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// src/http-client/custom-error.ts
|
|
18
|
-
var CustomError = class extends Error {
|
|
19
|
-
constructor({
|
|
20
|
-
elapsedTime,
|
|
21
|
-
errorCode,
|
|
22
|
-
errorMsg,
|
|
23
|
-
returnCode,
|
|
24
|
-
returnData,
|
|
25
|
-
returnMsg,
|
|
26
|
-
error,
|
|
27
|
-
config,
|
|
28
|
-
requestData
|
|
29
|
-
}) {
|
|
30
|
-
super();
|
|
31
|
-
__publicField(this, "elapsedTime");
|
|
32
|
-
__publicField(this, "errorCode");
|
|
33
|
-
__publicField(this, "errorMsg");
|
|
34
|
-
__publicField(this, "returnCode");
|
|
35
|
-
__publicField(this, "returnData");
|
|
36
|
-
__publicField(this, "returnMsg");
|
|
37
|
-
__publicField(this, "error");
|
|
38
|
-
__publicField(this, "config");
|
|
39
|
-
__publicField(this, "requestData");
|
|
40
|
-
this.elapsedTime = elapsedTime;
|
|
41
|
-
this.errorCode = errorCode;
|
|
42
|
-
this.errorMsg = errorMsg;
|
|
43
|
-
this.returnCode = returnCode;
|
|
44
|
-
this.returnData = returnData;
|
|
45
|
-
this.returnMsg = returnMsg;
|
|
46
|
-
this.error = error;
|
|
47
|
-
this.config = config;
|
|
48
|
-
this.requestData = requestData;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// src/http-client/axios/error-handler.ts
|
|
53
|
-
var ErrorHandler = class {
|
|
54
|
-
constructor() {
|
|
55
|
-
__publicField(this, "localThrow");
|
|
56
|
-
/** 개별처리 + 글로벌처리 모두 사용할경우 : true , 개별처리만 사용할 경우 : false */
|
|
57
|
-
__publicField(this, "globalCheck");
|
|
58
|
-
this.globalCheck = true;
|
|
59
|
-
}
|
|
60
|
-
setGlobalCheck(global) {
|
|
61
|
-
this.globalCheck = !!global;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* csr용 에러 throw
|
|
65
|
-
* 에러코드에 맞는 ClientError에러 객체를 throw 및 Sentry 리포팅 영역
|
|
66
|
-
* @todo 에러 응답에 data가 없다면 , config.data(=payload) 를 에러로그로 넣는건 어떨까요?
|
|
67
|
-
*/
|
|
68
|
-
globalThrow(error, config) {
|
|
69
|
-
const { response, request, code } = error;
|
|
70
|
-
if (response) {
|
|
71
|
-
const { data, status, statusText } = response;
|
|
72
|
-
const err = new CustomError({
|
|
73
|
-
elapsedTime: "",
|
|
74
|
-
errorCode: code || "",
|
|
75
|
-
errorMsg: "",
|
|
76
|
-
requestData: config.data,
|
|
77
|
-
returnData: data,
|
|
78
|
-
returnCode: status,
|
|
79
|
-
returnMsg: statusText,
|
|
80
|
-
error,
|
|
81
|
-
config
|
|
82
|
-
});
|
|
83
|
-
if (status >= 400 && status < 500) {
|
|
84
|
-
if (status === 401) {
|
|
85
|
-
err.errorMsg = "\uC778\uC99D \uC2E4\uD328";
|
|
86
|
-
return err;
|
|
87
|
-
}
|
|
88
|
-
if (status === 403) {
|
|
89
|
-
err.errorMsg = "\uAD8C\uD55C \uC5C6\uC74C: \uC811\uADFC \uAC70\uBD80";
|
|
90
|
-
return err;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (status >= 500 && status < 600) {
|
|
94
|
-
err.errorMsg = `\uC11C\uBC84 \uC624\uB958 \uBC1C\uC0DD: ${status}`;
|
|
95
|
-
return err;
|
|
96
|
-
}
|
|
97
|
-
err.errorMsg = `\uC54C \uC218 \uC5C6\uB294 \uC624\uB958 \uCF54\uB4DC: ${status}`;
|
|
98
|
-
return err;
|
|
99
|
-
} else if (request) {
|
|
100
|
-
return new CustomError({
|
|
101
|
-
elapsedTime: "",
|
|
102
|
-
errorCode: code || "",
|
|
103
|
-
errorMsg: "\uC694\uCCAD\uC774 \uC774\uB8E8\uC5B4 \uC84C\uC73C\uB098 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.",
|
|
104
|
-
requestData: config.data,
|
|
105
|
-
returnData: "",
|
|
106
|
-
returnCode: 0,
|
|
107
|
-
returnMsg: "",
|
|
108
|
-
error,
|
|
109
|
-
config
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
setLocalHandler(func) {
|
|
114
|
-
this.localThrow = func;
|
|
115
|
-
}
|
|
116
|
-
do(error, config) {
|
|
117
|
-
const { dialog } = config;
|
|
118
|
-
if (!dialog) {
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
this.localThrow && this.localThrow(error, config);
|
|
122
|
-
if (this.globalCheck) {
|
|
123
|
-
this.globalThrow(error, config);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
var HttpClientAxios = class extends AbstractHttpClient {
|
|
128
|
-
constructor(config) {
|
|
129
|
-
super();
|
|
130
|
-
/**
|
|
131
|
-
* API연동 실패시, 공통 에러 핸들러
|
|
132
|
-
* extends된 런타임 동작환경에 맞는 SSR,CSR 방식으로 에러핸들링처리
|
|
133
|
-
*/
|
|
134
|
-
__publicField(this, "errorHandler");
|
|
135
|
-
/**
|
|
136
|
-
* AxiosRequestConfig 를 확장한 interface
|
|
137
|
-
* axios create시 기본설정값 및 기타 필요한 정보들을 추가 가능
|
|
138
|
-
*/
|
|
139
|
-
__publicField(this, "config");
|
|
140
|
-
/**
|
|
141
|
-
* axios의 request interceptor 동작시, 헤더에 주입될 헤더의 key,value
|
|
142
|
-
*/
|
|
143
|
-
__publicField(this, "headers");
|
|
144
|
-
/**
|
|
145
|
-
* api연동을 수행할 실제 객체(axios, fetch 등의 다른 라이브러리로 교체가능한 영역)
|
|
146
|
-
* 현재 버전에서는 axios를 사용하여 구현됨.
|
|
147
|
-
*/
|
|
148
|
-
__publicField(this, "api");
|
|
149
|
-
if (!this.headers) {
|
|
150
|
-
this.headers = {};
|
|
151
|
-
}
|
|
152
|
-
this.config = config;
|
|
153
|
-
this.errorHandler = null;
|
|
154
|
-
this.api = axios__default.default.create({
|
|
155
|
-
baseURL: "\uC804\uCCB4\uACF5\uD1B5URL\uC774 \uC788\uC73C\uBA74 \uC14B\uD305",
|
|
156
|
-
withCredentials: true,
|
|
157
|
-
...config
|
|
158
|
-
});
|
|
159
|
-
this.api.interceptors.request.use(async (config2) => {
|
|
160
|
-
const headerEntries = Object.entries(this.headers);
|
|
161
|
-
headerEntries.forEach(([key, value]) => {
|
|
162
|
-
config2.headers.set(key, value);
|
|
163
|
-
});
|
|
164
|
-
return config2;
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
async put(url, data, config) {
|
|
168
|
-
try {
|
|
169
|
-
const res = await this.api.put(url, data, config);
|
|
170
|
-
return res;
|
|
171
|
-
} catch (e) {
|
|
172
|
-
throw this.errorHandler && this.errorHandler(e);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
async get(url, config) {
|
|
176
|
-
try {
|
|
177
|
-
const res = await this.api.get(url, config);
|
|
178
|
-
return res;
|
|
179
|
-
} catch (e) {
|
|
180
|
-
throw this.errorHandler && this.errorHandler(e);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
async delete(url, config) {
|
|
184
|
-
try {
|
|
185
|
-
const res = await this.api.delete(url, config);
|
|
186
|
-
return res;
|
|
187
|
-
} catch (e) {
|
|
188
|
-
throw this.errorHandler && this.errorHandler(e);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
async post(url, data, config) {
|
|
192
|
-
try {
|
|
193
|
-
const res = await this.api.post(url, data, config);
|
|
194
|
-
return res;
|
|
195
|
-
} catch (e) {
|
|
196
|
-
throw this.errorHandler && this.errorHandler(e);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
setHeader(key, value) {
|
|
200
|
-
this.headers[key] = value;
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
exports.AbstractHttpClient = AbstractHttpClient;
|
|
205
|
-
exports.CustomError = CustomError;
|
|
206
|
-
exports.ErrorHandler = ErrorHandler;
|
|
207
|
-
exports.HttpClientAxios = HttpClientAxios;
|
|
208
|
-
//# sourceMappingURL=common.cjs.map
|
|
209
|
-
//# sourceMappingURL=common.cjs.map
|
package/dist/common.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/http-client/abstract-http-client.ts","../src/http-client/custom-error.ts","../src/http-client/axios/error-handler.ts","../src/http-client/axios/http-client-axios.ts"],"names":["axios","config"],"mappings":";;;;;;;;;;;;;AAGO,IAAe,qBAAf,MAAuE;AAW9E;;;ACCa,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;AAChD;AACF,EAEA,MAAM,MAA+C,CAAA,GAAA,EAAa,MAAgC,EAAA;AAChG,IAAI,IAAA;AACF,MAAA,MAAM,MAAM,MAAM,IAAA,CAAK,GAAI,CAAA,MAAA,CAAgB,KAAK,MAAM,CAAA;AAEtD,MAAO,OAAA,GAAA;AAAA,aACA,CAAQ,EAAA;AACf,MAAA,MAAM,IAAK,CAAA,YAAA,IAAgB,IAAK,CAAA,YAAA,CAAa,CAAC,CAAA;AAAA;AAChD;AACF,EAEA,MAAM,IAAA,CAA6C,GAAa,EAAA,IAAA,EAAU,MAAgC,EAAA;AACxG,IAAI,IAAA;AACF,MAAA,MAAM,MAAM,MAAM,IAAA,CAAK,IAAI,IAAc,CAAA,GAAA,EAAK,MAAM,MAAM,CAAA;AAE1D,MAAO,OAAA,GAAA;AAAA,aACA,CAAQ,EAAA;AACf,MAAA,MAAM,IAAK,CAAA,YAAA,IAAgB,IAAK,CAAA,YAAA,CAAa,CAAC,CAAA;AAAA;AAChD;AACF,EAEA,SAAA,CAAU,KAAa,KAAe,EAAA;AACpC,IAAK,IAAA,CAAA,OAAA,CAAQ,GAAG,CAAI,GAAA,KAAA;AAAA;AAExB","file":"common.cjs","sourcesContent":["/**\n * HttpClientFetch, HttpClientAxios 에서 공통\n */\nexport abstract class AbstractHttpClient<configType, InstanceType, errorType> {\n protected abstract config: configType;\n protected abstract headers: Record<string, string>;\n protected abstract api: InstanceType;\n protected abstract errorHandler: null | ((e: errorType) => void);\n\n abstract put<dataType>(url: string, data?: any, config?: configType): Promise<dataType | undefined>;\n abstract get<dataType>(url: string, config?: configType): Promise<dataType | undefined>;\n abstract post<dataType>(url: string, data?: any, config?: configType): Promise<dataType | undefined>;\n abstract delete<dataType>(url: string, config?: configType): Promise<dataType | undefined>;\n abstract setHeader(key: string, value: string): void;\n}\n","/**\n * 디버깅시 필요한 정보들을 에러객체에 저장\n * @todo sentry로 전달할 에러내용들\n */\nexport interface errorParams {\n elapsedTime: string;\n errorCode: string;\n errorMsg: string;\n returnCode: number;\n returnData: unknown;\n returnMsg: string;\n error: unknown;\n config: unknown;\n requestData: unknown;\n}\nexport class CustomError extends Error {\n elapsedTime: string;\n errorCode: string;\n errorMsg: string;\n returnCode: number;\n returnData: unknown;\n returnMsg: string;\n error: unknown;\n config: unknown;\n requestData: unknown;\n constructor({\n elapsedTime,\n errorCode,\n errorMsg,\n returnCode,\n returnData,\n returnMsg,\n error,\n config,\n requestData\n }: errorParams) {\n super();\n this.elapsedTime = elapsedTime;\n this.errorCode = errorCode;\n this.errorMsg = errorMsg;\n this.returnCode = returnCode;\n this.returnData = returnData;\n this.returnMsg = returnMsg;\n this.error = error;\n this.config = config;\n this.requestData = requestData;\n }\n}\n","import { CustomError } from '../custom-error';\n\nimport type { customConfig } from './types';\nimport type { AxiosError } from 'axios';\n// import * as Sentry from '@hanwhalife/shared-libs/sentry';\n\nexport type errorHandler = (response: AxiosError, config: customConfig) => void;\nexport abstract class ErrorHandler {\n protected localThrow?: errorHandler;\n\n /** 개별처리 + 글로벌처리 모두 사용할경우 : true , 개별처리만 사용할 경우 : false */\n protected globalCheck: boolean;\n\n constructor() {\n /**\n * 에러핸들링 개별처리 + 글로벌처리 모두 사용으로 기본셋팅\n */\n this.globalCheck = true;\n }\n setGlobalCheck(global: boolean) {\n this.globalCheck = !!global;\n }\n /**\n * csr용 에러 throw\n * 에러코드에 맞는 ClientError에러 객체를 throw 및 Sentry 리포팅 영역\n * @todo 에러 응답에 data가 없다면 , config.data(=payload) 를 에러로그로 넣는건 어떨까요?\n */\n private globalThrow(error: AxiosError, config: customConfig) {\n const { response, request, code } = error;\n\n /**\n * 응답이 있는 경우\n */\n if (response) {\n const { data, status, statusText } = response;\n\n const err = new CustomError({\n elapsedTime: '',\n errorCode: code || '',\n errorMsg: '',\n requestData: config.data,\n returnData: data,\n returnCode: status,\n returnMsg: statusText,\n error,\n config\n });\n\n /**\n * 클라이언트 오류\n */\n if (status >= 400 && status < 500) {\n /**\n * 401(Unauthorized)\n */\n if (status === 401) {\n err.errorMsg = '인증 실패';\n\n /**\n * 재발급요청...\n *\n */\n return err;\n }\n\n /**\n * 403(Forbidden)에 대한 추가 처리\n */\n if (status === 403) {\n err.errorMsg = '권한 없음: 접근 거부';\n\n return err;\n }\n }\n\n /**\n * 5xx서버 오류\n */\n if (status >= 500 && status < 600) {\n err.errorMsg = `서버 오류 발생: ${status}`;\n\n return err;\n }\n\n // 그 외 상태 코드\n err.errorMsg = `알 수 없는 오류 코드: ${status}`;\n\n return err;\n } else if (request) {\n /**\n * 요청은 있고, 응답이 없는 경우\n */\n return new CustomError({\n elapsedTime: '',\n errorCode: code || '',\n errorMsg: '요청이 이루어 졌으나 응답을 받지 못했습니다.',\n requestData: config.data,\n returnData: '',\n returnCode: 0,\n returnMsg: '',\n error,\n config\n });\n }\n }\n public setLocalHandler(func: errorHandler) {\n this.localThrow = func;\n }\n\n public do(error: AxiosError, config: customConfig) {\n const { dialog } = config;\n //dialog가 false이면 에러핸들없음.\n if (!dialog) {\n return;\n }\n\n /**\n * 개별에러처리가 정의된 경우 실행\n */\n this.localThrow && this.localThrow(error, config);\n\n /**\n * globalCheck가 true이면 개별에러처리 검증후 이상 없을경우 global 처리로직 이어서 수행\n */\n if (this.globalCheck) {\n this.globalThrow(error, config);\n }\n }\n\n /**\n * 발생한 CustomError 설정값에 따른 에러 처리 추가영역\n * 상속한 server/client 에서 에러 핸들링\n */\n public abstract errorHandler(e: CustomError): void;\n}\n","import axios, { AxiosRequestConfig, AxiosResponse, type AxiosInstance } from 'axios';\n\nimport { AbstractHttpClient } from '../abstract-http-client';\n\nimport type { customConfig } from './types';\n\nexport class HttpClientAxios<errorType extends Error> extends AbstractHttpClient<\n customConfig,\n AxiosInstance,\n errorType\n> {\n /**\n * API연동 실패시, 공통 에러 핸들러\n * extends된 런타임 동작환경에 맞는 SSR,CSR 방식으로 에러핸들링처리\n */\n protected errorHandler: null | ((e: errorType) => void);\n\n /**\n * AxiosRequestConfig 를 확장한 interface\n * axios create시 기본설정값 및 기타 필요한 정보들을 추가 가능\n */\n protected config: customConfig;\n\n /**\n * axios의 request interceptor 동작시, 헤더에 주입될 헤더의 key,value\n */\n protected headers!: Record<string, string>;\n\n /**\n * api연동을 수행할 실제 객체(axios, fetch 등의 다른 라이브러리로 교체가능한 영역)\n * 현재 버전에서는 axios를 사용하여 구현됨.\n */\n protected api: AxiosInstance;\n constructor(config: customConfig) {\n super();\n if (!this.headers) {\n this.headers = {};\n }\n\n this.config = config;\n this.errorHandler = null;\n\n /**\n * api수행객체 최초 생성,\n * 공통으로 적용할 설정값이 있는경우 셋팅\n * @todo baseURL process.env.BaseURL ?\n */\n this.api = axios.create({\n baseURL: '전체공통URL이 있으면 셋팅',\n withCredentials: true,\n ...config\n });\n\n /**\n * @todo 이 부분도 추후 api스펙에따라 부분 셋팅필요.\n * request 헤더,token처리 interceptor 등록\n */\n this.api.interceptors.request.use(async (config) => {\n /**\n * @todo\n * x-channel-[] 공통헤더 추가\n */\n // this.setHeader('x-channel-adfaf', '');\n // this.setHeader('x-channel-adfaf', '');\n // this.setHeader('x-channel-adfaf', '');\n\n /**\n * this.headers설정된 값을 config headers에 주입\n */\n const headerEntries = Object.entries(this.headers);\n headerEntries.forEach(([key, value]) => {\n config.headers.set(key, value);\n });\n\n return config;\n });\n }\n\n async put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>) {\n try {\n const res = await this.api.put<T, R, D>(url, data, config);\n\n return res;\n } catch (e: any) {\n throw this.errorHandler && this.errorHandler(e);\n }\n }\n\n async get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>) {\n try {\n const res = await this.api.get<T, R, D>(url, config);\n\n return res;\n } catch (e: any) {\n throw this.errorHandler && this.errorHandler(e);\n }\n }\n\n async delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>) {\n try {\n const res = await this.api.delete<T, R, D>(url, config);\n\n return res;\n } catch (e: any) {\n throw this.errorHandler && this.errorHandler(e);\n }\n }\n\n async post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>) {\n try {\n const res = await this.api.post<T, R, D>(url, data, config);\n\n return res;\n } catch (e: any) {\n throw this.errorHandler && this.errorHandler(e);\n }\n }\n\n setHeader(key: string, value: string) {\n this.headers[key] = value;\n }\n}\n"]}
|
package/dist/common.d.cts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { C as CustomError } from './error-handler-DCenPKx5.cjs';
|
|
2
|
-
export { A as AbstractHttpClient, E as ErrorHandler, H as HttpClientAxios, a as clientErrorParams, c as customConfig, e as errorHandler, b as errorParams, s as serverErrorParams } from './error-handler-DCenPKx5.cjs';
|
|
3
|
-
import 'axios';
|
|
4
|
-
|
|
5
|
-
interface customConfigFetch {
|
|
6
|
-
headers?: HeadersInit;
|
|
7
|
-
body?: BodyInit;
|
|
8
|
-
baseURL?: string;
|
|
9
|
-
url?: string;
|
|
10
|
-
params?: NonNullable<unknown>;
|
|
11
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
12
|
-
fetchOptions?: RequestInit;
|
|
13
|
-
}
|
|
14
|
-
interface customResponse<dataType = any> {
|
|
15
|
-
config: customConfigFetch;
|
|
16
|
-
response: Response;
|
|
17
|
-
data: dataType;
|
|
18
|
-
}
|
|
19
|
-
type fulfilled<response> = (value: response) => response | Promise<response>;
|
|
20
|
-
type rejected = (error: CustomError) => void;
|
|
21
|
-
interface interceptorResponse<response> {
|
|
22
|
-
onFulfilled: fulfilled<response>;
|
|
23
|
-
onRejected: rejected;
|
|
24
|
-
}
|
|
25
|
-
interface interceptorRequest<config> {
|
|
26
|
-
onFulfilled: fulfilled<config>;
|
|
27
|
-
onRejected: rejected;
|
|
28
|
-
}
|
|
29
|
-
interface interceptors<config, response> {
|
|
30
|
-
request: interceptorRequest<config>[];
|
|
31
|
-
response: interceptorResponse<response>[];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { CustomError, type customConfigFetch, type customResponse, type fulfilled, type interceptors, type rejected };
|
package/dist/common.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { C as CustomError } from './error-handler-DCenPKx5.js';
|
|
2
|
-
export { A as AbstractHttpClient, E as ErrorHandler, H as HttpClientAxios, a as clientErrorParams, c as customConfig, e as errorHandler, b as errorParams, s as serverErrorParams } from './error-handler-DCenPKx5.js';
|
|
3
|
-
import 'axios';
|
|
4
|
-
|
|
5
|
-
interface customConfigFetch {
|
|
6
|
-
headers?: HeadersInit;
|
|
7
|
-
body?: BodyInit;
|
|
8
|
-
baseURL?: string;
|
|
9
|
-
url?: string;
|
|
10
|
-
params?: NonNullable<unknown>;
|
|
11
|
-
method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
12
|
-
fetchOptions?: RequestInit;
|
|
13
|
-
}
|
|
14
|
-
interface customResponse<dataType = any> {
|
|
15
|
-
config: customConfigFetch;
|
|
16
|
-
response: Response;
|
|
17
|
-
data: dataType;
|
|
18
|
-
}
|
|
19
|
-
type fulfilled<response> = (value: response) => response | Promise<response>;
|
|
20
|
-
type rejected = (error: CustomError) => void;
|
|
21
|
-
interface interceptorResponse<response> {
|
|
22
|
-
onFulfilled: fulfilled<response>;
|
|
23
|
-
onRejected: rejected;
|
|
24
|
-
}
|
|
25
|
-
interface interceptorRequest<config> {
|
|
26
|
-
onFulfilled: fulfilled<config>;
|
|
27
|
-
onRejected: rejected;
|
|
28
|
-
}
|
|
29
|
-
interface interceptors<config, response> {
|
|
30
|
-
request: interceptorRequest<config>[];
|
|
31
|
-
response: interceptorResponse<response>[];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { CustomError, type customConfigFetch, type customResponse, type fulfilled, type interceptors, type rejected };
|
package/dist/common.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
6
|
-
|
|
7
|
-
// src/http-client/abstract-http-client.ts
|
|
8
|
-
var AbstractHttpClient = class {
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// src/http-client/custom-error.ts
|
|
12
|
-
var CustomError = class extends Error {
|
|
13
|
-
constructor({
|
|
14
|
-
elapsedTime,
|
|
15
|
-
errorCode,
|
|
16
|
-
errorMsg,
|
|
17
|
-
returnCode,
|
|
18
|
-
returnData,
|
|
19
|
-
returnMsg,
|
|
20
|
-
error,
|
|
21
|
-
config,
|
|
22
|
-
requestData
|
|
23
|
-
}) {
|
|
24
|
-
super();
|
|
25
|
-
__publicField(this, "elapsedTime");
|
|
26
|
-
__publicField(this, "errorCode");
|
|
27
|
-
__publicField(this, "errorMsg");
|
|
28
|
-
__publicField(this, "returnCode");
|
|
29
|
-
__publicField(this, "returnData");
|
|
30
|
-
__publicField(this, "returnMsg");
|
|
31
|
-
__publicField(this, "error");
|
|
32
|
-
__publicField(this, "config");
|
|
33
|
-
__publicField(this, "requestData");
|
|
34
|
-
this.elapsedTime = elapsedTime;
|
|
35
|
-
this.errorCode = errorCode;
|
|
36
|
-
this.errorMsg = errorMsg;
|
|
37
|
-
this.returnCode = returnCode;
|
|
38
|
-
this.returnData = returnData;
|
|
39
|
-
this.returnMsg = returnMsg;
|
|
40
|
-
this.error = error;
|
|
41
|
-
this.config = config;
|
|
42
|
-
this.requestData = requestData;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// src/http-client/axios/error-handler.ts
|
|
47
|
-
var ErrorHandler = class {
|
|
48
|
-
constructor() {
|
|
49
|
-
__publicField(this, "localThrow");
|
|
50
|
-
/** 개별처리 + 글로벌처리 모두 사용할경우 : true , 개별처리만 사용할 경우 : false */
|
|
51
|
-
__publicField(this, "globalCheck");
|
|
52
|
-
this.globalCheck = true;
|
|
53
|
-
}
|
|
54
|
-
setGlobalCheck(global) {
|
|
55
|
-
this.globalCheck = !!global;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* csr용 에러 throw
|
|
59
|
-
* 에러코드에 맞는 ClientError에러 객체를 throw 및 Sentry 리포팅 영역
|
|
60
|
-
* @todo 에러 응답에 data가 없다면 , config.data(=payload) 를 에러로그로 넣는건 어떨까요?
|
|
61
|
-
*/
|
|
62
|
-
globalThrow(error, config) {
|
|
63
|
-
const { response, request, code } = error;
|
|
64
|
-
if (response) {
|
|
65
|
-
const { data, status, statusText } = response;
|
|
66
|
-
const err = new CustomError({
|
|
67
|
-
elapsedTime: "",
|
|
68
|
-
errorCode: code || "",
|
|
69
|
-
errorMsg: "",
|
|
70
|
-
requestData: config.data,
|
|
71
|
-
returnData: data,
|
|
72
|
-
returnCode: status,
|
|
73
|
-
returnMsg: statusText,
|
|
74
|
-
error,
|
|
75
|
-
config
|
|
76
|
-
});
|
|
77
|
-
if (status >= 400 && status < 500) {
|
|
78
|
-
if (status === 401) {
|
|
79
|
-
err.errorMsg = "\uC778\uC99D \uC2E4\uD328";
|
|
80
|
-
return err;
|
|
81
|
-
}
|
|
82
|
-
if (status === 403) {
|
|
83
|
-
err.errorMsg = "\uAD8C\uD55C \uC5C6\uC74C: \uC811\uADFC \uAC70\uBD80";
|
|
84
|
-
return err;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (status >= 500 && status < 600) {
|
|
88
|
-
err.errorMsg = `\uC11C\uBC84 \uC624\uB958 \uBC1C\uC0DD: ${status}`;
|
|
89
|
-
return err;
|
|
90
|
-
}
|
|
91
|
-
err.errorMsg = `\uC54C \uC218 \uC5C6\uB294 \uC624\uB958 \uCF54\uB4DC: ${status}`;
|
|
92
|
-
return err;
|
|
93
|
-
} else if (request) {
|
|
94
|
-
return new CustomError({
|
|
95
|
-
elapsedTime: "",
|
|
96
|
-
errorCode: code || "",
|
|
97
|
-
errorMsg: "\uC694\uCCAD\uC774 \uC774\uB8E8\uC5B4 \uC84C\uC73C\uB098 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.",
|
|
98
|
-
requestData: config.data,
|
|
99
|
-
returnData: "",
|
|
100
|
-
returnCode: 0,
|
|
101
|
-
returnMsg: "",
|
|
102
|
-
error,
|
|
103
|
-
config
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
setLocalHandler(func) {
|
|
108
|
-
this.localThrow = func;
|
|
109
|
-
}
|
|
110
|
-
do(error, config) {
|
|
111
|
-
const { dialog } = config;
|
|
112
|
-
if (!dialog) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
this.localThrow && this.localThrow(error, config);
|
|
116
|
-
if (this.globalCheck) {
|
|
117
|
-
this.globalThrow(error, config);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
var HttpClientAxios = class extends AbstractHttpClient {
|
|
122
|
-
constructor(config) {
|
|
123
|
-
super();
|
|
124
|
-
/**
|
|
125
|
-
* API연동 실패시, 공통 에러 핸들러
|
|
126
|
-
* extends된 런타임 동작환경에 맞는 SSR,CSR 방식으로 에러핸들링처리
|
|
127
|
-
*/
|
|
128
|
-
__publicField(this, "errorHandler");
|
|
129
|
-
/**
|
|
130
|
-
* AxiosRequestConfig 를 확장한 interface
|
|
131
|
-
* axios create시 기본설정값 및 기타 필요한 정보들을 추가 가능
|
|
132
|
-
*/
|
|
133
|
-
__publicField(this, "config");
|
|
134
|
-
/**
|
|
135
|
-
* axios의 request interceptor 동작시, 헤더에 주입될 헤더의 key,value
|
|
136
|
-
*/
|
|
137
|
-
__publicField(this, "headers");
|
|
138
|
-
/**
|
|
139
|
-
* api연동을 수행할 실제 객체(axios, fetch 등의 다른 라이브러리로 교체가능한 영역)
|
|
140
|
-
* 현재 버전에서는 axios를 사용하여 구현됨.
|
|
141
|
-
*/
|
|
142
|
-
__publicField(this, "api");
|
|
143
|
-
if (!this.headers) {
|
|
144
|
-
this.headers = {};
|
|
145
|
-
}
|
|
146
|
-
this.config = config;
|
|
147
|
-
this.errorHandler = null;
|
|
148
|
-
this.api = axios.create({
|
|
149
|
-
baseURL: "\uC804\uCCB4\uACF5\uD1B5URL\uC774 \uC788\uC73C\uBA74 \uC14B\uD305",
|
|
150
|
-
withCredentials: true,
|
|
151
|
-
...config
|
|
152
|
-
});
|
|
153
|
-
this.api.interceptors.request.use(async (config2) => {
|
|
154
|
-
const headerEntries = Object.entries(this.headers);
|
|
155
|
-
headerEntries.forEach(([key, value]) => {
|
|
156
|
-
config2.headers.set(key, value);
|
|
157
|
-
});
|
|
158
|
-
return config2;
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
async put(url, data, config) {
|
|
162
|
-
try {
|
|
163
|
-
const res = await this.api.put(url, data, config);
|
|
164
|
-
return res;
|
|
165
|
-
} catch (e) {
|
|
166
|
-
throw this.errorHandler && this.errorHandler(e);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
async get(url, config) {
|
|
170
|
-
try {
|
|
171
|
-
const res = await this.api.get(url, config);
|
|
172
|
-
return res;
|
|
173
|
-
} catch (e) {
|
|
174
|
-
throw this.errorHandler && this.errorHandler(e);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
async delete(url, config) {
|
|
178
|
-
try {
|
|
179
|
-
const res = await this.api.delete(url, config);
|
|
180
|
-
return res;
|
|
181
|
-
} catch (e) {
|
|
182
|
-
throw this.errorHandler && this.errorHandler(e);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
async post(url, data, config) {
|
|
186
|
-
try {
|
|
187
|
-
const res = await this.api.post(url, data, config);
|
|
188
|
-
return res;
|
|
189
|
-
} catch (e) {
|
|
190
|
-
throw this.errorHandler && this.errorHandler(e);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
setHeader(key, value) {
|
|
194
|
-
this.headers[key] = value;
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
export { AbstractHttpClient, CustomError, ErrorHandler, HttpClientAxios };
|
|
199
|
-
//# sourceMappingURL=common.js.map
|
|
200
|
-
//# sourceMappingURL=common.js.map
|
package/dist/common.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/http-client/abstract-http-client.ts","../src/http-client/custom-error.ts","../src/http-client/axios/error-handler.ts","../src/http-client/axios/http-client-axios.ts"],"names":["config"],"mappings":";;;;;;;AAGO,IAAe,qBAAf,MAAuE;AAW9E;;;ACCa,IAAA,WAAA,GAAN,cAA0B,KAAM,CAAA;AAAA,EAUrC,WAAY,CAAA;AAAA,IACV,WAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACc,EAAA;AACd,IAAM,KAAA,EAAA;AApBR,IAAA,aAAA,CAAA,IAAA,EAAA,aAAA,CAAA;AACA,IAAA,aAAA,CAAA,IAAA,EAAA,WAAA,CAAA;AACA,IAAA,aAAA,CAAA,IAAA,EAAA,UAAA,CAAA;AACA,IAAA,aAAA,CAAA,IAAA,EAAA,YAAA,CAAA;AACA,IAAA,aAAA,CAAA,IAAA,EAAA,YAAA,CAAA;AACA,IAAA,aAAA,CAAA,IAAA,EAAA,WAAA,CAAA;AACA,IAAA,aAAA,CAAA,IAAA,EAAA,OAAA,CAAA;AACA,IAAA,aAAA,CAAA,IAAA,EAAA,QAAA,CAAA;AACA,IAAA,aAAA,CAAA,IAAA,EAAA,aAAA,CAAA;AAaE,IAAA,IAAA,CAAK,WAAc,GAAA,WAAA;AACnB,IAAA,IAAA,CAAK,SAAY,GAAA,SAAA;AACjB,IAAA,IAAA,CAAK,QAAW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*/\nexport abstract class AbstractHttpClient<configType, InstanceType, errorType> {\n protected abstract config: configType;\n protected abstract headers: Record<string, string>;\n protected abstract api: InstanceType;\n protected abstract errorHandler: null | ((e: errorType) => void);\n\n abstract put<dataType>(url: string, data?: any, config?: configType): Promise<dataType | undefined>;\n abstract get<dataType>(url: string, config?: configType): Promise<dataType | undefined>;\n abstract post<dataType>(url: string, data?: any, config?: configType): Promise<dataType | undefined>;\n abstract delete<dataType>(url: string, config?: configType): Promise<dataType | undefined>;\n abstract setHeader(key: string, value: string): void;\n}\n","/**\n * 디버깅시 필요한 정보들을 에러객체에 저장\n * @todo sentry로 전달할 에러내용들\n */\nexport interface errorParams {\n elapsedTime: string;\n errorCode: string;\n errorMsg: string;\n returnCode: number;\n returnData: unknown;\n returnMsg: string;\n error: unknown;\n config: unknown;\n requestData: unknown;\n}\nexport class CustomError extends Error {\n elapsedTime: string;\n errorCode: string;\n errorMsg: string;\n returnCode: number;\n returnData: unknown;\n returnMsg: string;\n error: unknown;\n config: unknown;\n requestData: unknown;\n constructor({\n elapsedTime,\n errorCode,\n errorMsg,\n returnCode,\n returnData,\n returnMsg,\n error,\n config,\n requestData\n }: errorParams) {\n super();\n this.elapsedTime = elapsedTime;\n this.errorCode = errorCode;\n this.errorMsg = errorMsg;\n this.returnCode = returnCode;\n this.returnData = returnData;\n this.returnMsg = returnMsg;\n this.error = error;\n this.config = config;\n this.requestData = requestData;\n }\n}\n","import { CustomError } from '../custom-error';\n\nimport type { customConfig } from './types';\nimport type { AxiosError } from 'axios';\n// import * as Sentry from '@hanwhalife/shared-libs/sentry';\n\nexport type errorHandler = (response: AxiosError, config: customConfig) => void;\nexport abstract class ErrorHandler {\n protected localThrow?: errorHandler;\n\n /** 개별처리 + 글로벌처리 모두 사용할경우 : true , 개별처리만 사용할 경우 : false */\n protected globalCheck: boolean;\n\n constructor() {\n /**\n * 에러핸들링 개별처리 + 글로벌처리 모두 사용으로 기본셋팅\n */\n this.globalCheck = true;\n }\n setGlobalCheck(global: boolean) {\n this.globalCheck = !!global;\n }\n /**\n * csr용 에러 throw\n * 에러코드에 맞는 ClientError에러 객체를 throw 및 Sentry 리포팅 영역\n * @todo 에러 응답에 data가 없다면 , config.data(=payload) 를 에러로그로 넣는건 어떨까요?\n */\n private globalThrow(error: AxiosError, config: customConfig) {\n const { response, request, code } = error;\n\n /**\n * 응답이 있는 경우\n */\n if (response) {\n const { data, status, statusText } = response;\n\n const err = new CustomError({\n elapsedTime: '',\n errorCode: code || '',\n errorMsg: '',\n requestData: config.data,\n returnData: data,\n returnCode: status,\n returnMsg: statusText,\n error,\n config\n });\n\n /**\n * 클라이언트 오류\n */\n if (status >= 400 && status < 500) {\n /**\n * 401(Unauthorized)\n */\n if (status === 401) {\n err.errorMsg = '인증 실패';\n\n /**\n * 재발급요청...\n *\n */\n return err;\n }\n\n /**\n * 403(Forbidden)에 대한 추가 처리\n */\n if (status === 403) {\n err.errorMsg = '권한 없음: 접근 거부';\n\n return err;\n }\n }\n\n /**\n * 5xx서버 오류\n */\n if (status >= 500 && status < 600) {\n err.errorMsg = `서버 오류 발생: ${status}`;\n\n return err;\n }\n\n // 그 외 상태 코드\n err.errorMsg = `알 수 없는 오류 코드: ${status}`;\n\n return err;\n } else if (request) {\n /**\n * 요청은 있고, 응답이 없는 경우\n */\n return new CustomError({\n elapsedTime: '',\n errorCode: code || '',\n errorMsg: '요청이 이루어 졌으나 응답을 받지 못했습니다.',\n requestData: config.data,\n returnData: '',\n returnCode: 0,\n returnMsg: '',\n error,\n config\n });\n }\n }\n public setLocalHandler(func: errorHandler) {\n this.localThrow = func;\n }\n\n public do(error: AxiosError, config: customConfig) {\n const { dialog } = config;\n //dialog가 false이면 에러핸들없음.\n if (!dialog) {\n return;\n }\n\n /**\n * 개별에러처리가 정의된 경우 실행\n */\n this.localThrow && this.localThrow(error, config);\n\n /**\n * globalCheck가 true이면 개별에러처리 검증후 이상 없을경우 global 처리로직 이어서 수행\n */\n if (this.globalCheck) {\n this.globalThrow(error, config);\n }\n }\n\n /**\n * 발생한 CustomError 설정값에 따른 에러 처리 추가영역\n * 상속한 server/client 에서 에러 핸들링\n */\n public abstract errorHandler(e: CustomError): void;\n}\n","import axios, { AxiosRequestConfig, AxiosResponse, type AxiosInstance } from 'axios';\n\nimport { AbstractHttpClient } from '../abstract-http-client';\n\nimport type { customConfig } from './types';\n\nexport class HttpClientAxios<errorType extends Error> extends AbstractHttpClient<\n customConfig,\n AxiosInstance,\n errorType\n> {\n /**\n * API연동 실패시, 공통 에러 핸들러\n * extends된 런타임 동작환경에 맞는 SSR,CSR 방식으로 에러핸들링처리\n */\n protected errorHandler: null | ((e: errorType) => void);\n\n /**\n * AxiosRequestConfig 를 확장한 interface\n * axios create시 기본설정값 및 기타 필요한 정보들을 추가 가능\n */\n protected config: customConfig;\n\n /**\n * axios의 request interceptor 동작시, 헤더에 주입될 헤더의 key,value\n */\n protected headers!: Record<string, string>;\n\n /**\n * api연동을 수행할 실제 객체(axios, fetch 등의 다른 라이브러리로 교체가능한 영역)\n * 현재 버전에서는 axios를 사용하여 구현됨.\n */\n protected api: AxiosInstance;\n constructor(config: customConfig) {\n super();\n if (!this.headers) {\n this.headers = {};\n }\n\n this.config = config;\n this.errorHandler = null;\n\n /**\n * api수행객체 최초 생성,\n * 공통으로 적용할 설정값이 있는경우 셋팅\n * @todo baseURL process.env.BaseURL ?\n */\n this.api = axios.create({\n baseURL: '전체공통URL이 있으면 셋팅',\n withCredentials: true,\n ...config\n });\n\n /**\n * @todo 이 부분도 추후 api스펙에따라 부분 셋팅필요.\n * request 헤더,token처리 interceptor 등록\n */\n this.api.interceptors.request.use(async (config) => {\n /**\n * @todo\n * x-channel-[] 공통헤더 추가\n */\n // this.setHeader('x-channel-adfaf', '');\n // this.setHeader('x-channel-adfaf', '');\n // this.setHeader('x-channel-adfaf', '');\n\n /**\n * this.headers설정된 값을 config headers에 주입\n */\n const headerEntries = Object.entries(this.headers);\n headerEntries.forEach(([key, value]) => {\n config.headers.set(key, value);\n });\n\n return config;\n });\n }\n\n async put<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>) {\n try {\n const res = await this.api.put<T, R, D>(url, data, config);\n\n return res;\n } catch (e: any) {\n throw this.errorHandler && this.errorHandler(e);\n }\n }\n\n async get<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>) {\n try {\n const res = await this.api.get<T, R, D>(url, config);\n\n return res;\n } catch (e: any) {\n throw this.errorHandler && this.errorHandler(e);\n }\n }\n\n async delete<T = any, R = AxiosResponse<T>, D = any>(url: string, config?: AxiosRequestConfig<D>) {\n try {\n const res = await this.api.delete<T, R, D>(url, config);\n\n return res;\n } catch (e: any) {\n throw this.errorHandler && this.errorHandler(e);\n }\n }\n\n async post<T = any, R = AxiosResponse<T>, D = any>(url: string, data?: D, config?: AxiosRequestConfig<D>) {\n try {\n const res = await this.api.post<T, R, D>(url, data, config);\n\n return res;\n } catch (e: any) {\n throw this.errorHandler && this.errorHandler(e);\n }\n }\n\n setHeader(key: string, value: string) {\n this.headers[key] = value;\n }\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { H as HttpClientAxios, C as CustomError, c as customConfig, E as ErrorHandler, e as errorHandler } from './error-handler-DCenPKx5.cjs';
|
|
2
|
-
|
|
3
|
-
declare class CsrHttpClientAxios extends HttpClientAxios<CustomError> {
|
|
4
|
-
private csrErrorHandler;
|
|
5
|
-
constructor(config?: customConfig);
|
|
6
|
-
setCsrErrorHandler(csrErrorHandler: ErrorHandler): void;
|
|
7
|
-
/**
|
|
8
|
-
* API 연동 실패시, 에러핸들러 셋팅 (특정페이지에서만 동작하는 개별 핸들러)
|
|
9
|
-
* @param handler csrErrorHandler
|
|
10
|
-
*/
|
|
11
|
-
setLocalErrorHandler(handler: errorHandler, global?: boolean): void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { CsrHttpClientAxios as C };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { H as HttpClientAxios, C as CustomError, c as customConfig, E as ErrorHandler, e as errorHandler } from './error-handler-DCenPKx5.js';
|
|
2
|
-
|
|
3
|
-
declare class CsrHttpClientAxios extends HttpClientAxios<CustomError> {
|
|
4
|
-
private csrErrorHandler;
|
|
5
|
-
constructor(config?: customConfig);
|
|
6
|
-
setCsrErrorHandler(csrErrorHandler: ErrorHandler): void;
|
|
7
|
-
/**
|
|
8
|
-
* API 연동 실패시, 에러핸들러 셋팅 (특정페이지에서만 동작하는 개별 핸들러)
|
|
9
|
-
* @param handler csrErrorHandler
|
|
10
|
-
*/
|
|
11
|
-
setLocalErrorHandler(handler: errorHandler, global?: boolean): void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { CsrHttpClientAxios as C };
|