@be-link/flow-cli-nodejs 0.0.25 → 0.0.27

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/flow/http.js CHANGED
@@ -1,27 +1,4 @@
1
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
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
@@ -36,20 +13,15 @@ const flowAxios = axios_1.default.create();
36
13
  (0, axios_retry_1.default)(flowAxios, {
37
14
  retries: 1,
38
15
  retryCondition(error) {
39
- return error.response?.status === 502;
16
+ return error.response != null && error.response.status === 502;
40
17
  },
41
- retryDelay: (retryCount, error) => {
42
- console.info(`retryCount: ${retryCount}, retryDelay: ${retryCount * 500}`);
18
+ retryDelay: (retryCount) => {
43
19
  return retryCount * 500;
44
20
  },
45
- onRetry(retryCount, error, requestConfig) {
46
- console.info(`retryCount: ${retryCount}, onRetry: ${error}, requestHeader: ${JSON.stringify(requestConfig.headers)}`);
47
- },
48
21
  });
49
22
  async function callApi(url, ...request) {
50
23
  const requestId = (0, uuid_1.v4)();
51
24
  try {
52
- console.info(`准备发起FLOW请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
53
25
  const response = await flowAxios.post(url, request[0], {
54
26
  headers: {
55
27
  'X-Request-Id': requestId,
@@ -70,31 +42,8 @@ async function callApi(url, ...request) {
70
42
  if (axiosError.response) {
71
43
  const response = axiosError.response;
72
44
  const data = response.data;
73
- console.error(`FLOW 异常: ${axiosError.message},requestId: ${requestId}`);
74
- console.info('响应信息', data.message);
75
- console.error('异常堆栈', JSON.stringify(error.stack));
76
45
  throw new ErrorClass(data.message || 'FLOW Error', response.status);
77
46
  }
78
- // 调用dns模块解析url
79
- const dns = await Promise.resolve().then(() => __importStar(require('dns')));
80
- const dnsPromise = new Promise((resolve, reject) => {
81
- const lookupRes = dns.lookup(url, (err, address) => {
82
- if (err) {
83
- console.error(err.message);
84
- reject(err);
85
- }
86
- console.info(`lookup: ${JSON.stringify(lookupRes)}`);
87
- resolve(address);
88
- });
89
- });
90
- try {
91
- const address = await dnsPromise;
92
- console.info(`address: ${JSON.stringify(address)}`);
93
- }
94
- catch (error) {
95
- console.info(`error: ${JSON.stringify(error)}`);
96
- }
97
- console.error(`FLOW 未知异常: ${axiosError.message}`, error.stack);
98
47
  throw error;
99
48
  }
100
49
  }
@@ -73,6 +73,8 @@ export declare namespace Service {
73
73
  reasonTypeDetail: string;
74
74
  user: IUser;
75
75
  extraInfo?: any;
76
+ receiverType?: 'HOTEL_SUPPLIER' | 'BUS_SUPPLIER';
77
+ source?: 'MANUAL' | 'SYSTEM';
76
78
  }
77
79
  }
78
80
  namespace Response {
@@ -87,6 +89,9 @@ export declare namespace Service {
87
89
  rejectionDetail: string;
88
90
  attachment: string[];
89
91
  isNotice: boolean;
92
+ receiverType?: string;
93
+ source?: string;
94
+ processedAt?: number;
90
95
  }
91
96
  interface IQueryOrderNumBySupplierIdsRsp {
92
97
  supplierId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@be-link/flow-cli-nodejs",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "流服务Nodejs客户端",
5
5
  "main": "index.js",
6
6
  "repository": {