@be-link/shield-for-tcb-node-sdk 0.0.5 → 0.0.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/utils/http.js +4 -4
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@be-link/shield-for-tcb-node-sdk",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "ShieldForTCB Node.js SDK",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
7
  "keywords": [
8
8
  "shield",
9
9
  "tcb",
package/utils/http.js CHANGED
@@ -56,8 +56,8 @@ const axios_retry_1 = __importDefault(require("axios-retry"));
56
56
  async function callApi(url, request, options) {
57
57
  const requestId = (0, uuid_1.v4)();
58
58
  try {
59
- console.info(`准备发起SHIELD-FOR-TCB请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
60
- const response = await axios_1.default.post(url, request, {
59
+ console.info(`准备发起shield-for-tcb请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
60
+ const response = await axios_1.default.post(url, request || {}, {
61
61
  headers: { 'x-request-id': requestId, 'content-type': 'application/json' },
62
62
  });
63
63
  const responseData = response.data;
@@ -71,7 +71,7 @@ async function callApi(url, request, options) {
71
71
  if (axiosError.response) {
72
72
  const response = axiosError.response;
73
73
  const data = response.data;
74
- console.error(`SHIELD 异常: ${axiosError.message},requestId: ${requestId}`);
74
+ console.error(`shield-for-tcb 异常: ${axiosError.message}, requestId: ${requestId}`);
75
75
  console.info('响应信息', data.message);
76
76
  console.error('异常堆栈', JSON.stringify(error.stack));
77
77
  throw new Error(data.errorType + ' - ' + data.message);
@@ -95,7 +95,7 @@ async function callApi(url, request, options) {
95
95
  catch (error) {
96
96
  console.info(`error: ${JSON.stringify(error)}`);
97
97
  }
98
- console.error(`SHIELD 未知异常: ${axiosError.message}`, error.stack);
98
+ console.error(`shield-for-tcb 未知异常: ${axiosError.message}`, error.stack);
99
99
  throw error;
100
100
  }
101
101
  }