@be-link/ecommerce-client-backend-service-node-sdk 0.1.27 → 0.1.29

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.
@@ -7,8 +7,8 @@ export default abstract class BaseService {
7
7
  /** URL一级路径 */
8
8
  protected abstract prefixUrl: string;
9
9
  /** 子网域名 */
10
- protected readonly natDevHost = "http://client-backend:8090/client-backend";
11
- protected readonly natProdHost = "http://client-backend:8090/client-backend";
10
+ protected readonly natDevHost = "http://192.168.92.0:8090/client-backend";
11
+ protected readonly natProdHost = "http://192.168.41.121:8090/client-backend";
12
12
  /** 公网域名 */
13
13
  protected readonly publicDevHost = "https://ecommerce-dev.wejourney.top/client-backend";
14
14
  protected readonly publicProdHost = "";
@@ -12,8 +12,8 @@ const string_1 = require("../utils/string");
12
12
  class BaseService {
13
13
  constructor() {
14
14
  /** 子网域名 */
15
- this.natDevHost = 'http://client-backend:8090/client-backend';
16
- this.natProdHost = 'http://client-backend:8090/client-backend';
15
+ this.natDevHost = 'http://192.168.92.0:8090/client-backend';
16
+ this.natProdHost = 'http://192.168.41.121:8090/client-backend';
17
17
  /** 公网域名 */
18
18
  this.publicDevHost = 'https://ecommerce-dev.wejourney.top/client-backend';
19
19
  this.publicProdHost = '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@be-link/ecommerce-client-backend-service-node-sdk",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "EcommerceClientBackendService Node.js SDK",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -17,7 +17,8 @@
17
17
  "axios-retry": "4.0.0",
18
18
  "fastify": "5.6.2",
19
19
  "uuid": "9.0.1",
20
- "tsoa": "^6.6.0"
20
+ "tsoa": "^6.6.0",
21
+ "safe-stable-stringify": "^2.4.3"
21
22
  },
22
23
  "scripts": {
23
24
  "build": "rm -rf ./dist && tsc && cp package.json README.md ./dist/ 2>/dev/null || true",
package/utils/http.js CHANGED
@@ -37,6 +37,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.callApi = callApi;
40
+ const safe_stable_stringify_1 = __importDefault(require("safe-stable-stringify"));
40
41
  const axios_1 = __importDefault(require("axios"));
41
42
  const uuid_1 = require("uuid");
42
43
  const axios_retry_1 = __importDefault(require("axios-retry"));
@@ -51,13 +52,13 @@ const request_context_1 = require("@fastify/request-context");
51
52
  return retryCount * 500;
52
53
  },
53
54
  onRetry(retryCount, error, requestConfig) {
54
- console.info(`retryCount: ${retryCount}, onRetry: ${error.message}, requestHeader: ${JSON.stringify(requestConfig.headers)}`);
55
+ console.info(`retryCount: ${retryCount}, onRetry: ${error.message}, requestHeader: ${(0, safe_stable_stringify_1.default)(requestConfig.headers)}`);
55
56
  },
56
57
  });
57
58
  async function callApi(url, request) {
58
59
  const requestId = request_context_1.requestContext.get('requestId') || request_context_1.requestContext.get('traceMessageId') || (0, uuid_1.v4)();
59
60
  try {
60
- console.info(`准备发起ecommerce-client-backend-service请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
61
+ console.info(`准备发起ecommerce-client-backend-service请求[${requestId}]: ${url}, 参数: ${(0, safe_stable_stringify_1.default)(request)}`);
61
62
  const response = await axios_1.default.post(url, request || {}, {
62
63
  headers: { 'x-request-id': requestId },
63
64
  });
@@ -71,7 +72,7 @@ async function callApi(url, request) {
71
72
  const data = response.data;
72
73
  console.error(`ecommerce-client-backend-service 异常: ${axiosError.message},requestId: ${requestId}`);
73
74
  console.info('响应信息', data.message);
74
- console.error('异常堆栈', JSON.stringify(error.stack));
75
+ console.error('异常堆栈', (0, safe_stable_stringify_1.default)(error.stack));
75
76
  throw error;
76
77
  }
77
78
  // 调用dns模块解析url
@@ -82,16 +83,16 @@ async function callApi(url, request) {
82
83
  console.error(err.message);
83
84
  reject(err);
84
85
  }
85
- console.info(`lookup: ${JSON.stringify(lookupRes)}`);
86
+ console.info(`lookup: ${(0, safe_stable_stringify_1.default)(lookupRes)}`);
86
87
  resolve(address);
87
88
  });
88
89
  });
89
90
  try {
90
91
  const address = await dnsPromise;
91
- console.info(`address: ${JSON.stringify(address)}`);
92
+ console.info(`address: ${(0, safe_stable_stringify_1.default)(address)}`);
92
93
  }
93
94
  catch (error) {
94
- console.info(`error: ${JSON.stringify(error)}`);
95
+ console.info(`error: ${(0, safe_stable_stringify_1.default)(error)}`);
95
96
  }
96
97
  console.error(`ecommerce-client-backend-service 未知异常: ${axiosError.message}`, error.stack);
97
98
  throw error;