@be-link/flow-cli-nodejs 0.0.26 → 0.0.30
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
|
};
|
|
@@ -38,18 +15,13 @@ const flowAxios = axios_1.default.create();
|
|
|
38
15
|
retryCondition(error) {
|
|
39
16
|
return error.response != null && error.response.status === 502;
|
|
40
17
|
},
|
|
41
|
-
retryDelay: (retryCount
|
|
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
|
}
|
|
@@ -10,6 +10,7 @@ declare class FlowCoreService extends BaseService implements Service.FlowCoreCon
|
|
|
10
10
|
addOrderChangeFlow(param: Service.Request.IAddOrderChangeFlowReq): Promise<Service.Entity.ChangeFlowEntity>;
|
|
11
11
|
addOrderNormalChangeFlow(param: Service.Request.IAddOrderNormalChangeFlowReq): Promise<void>;
|
|
12
12
|
listChangeFlowRecordByOrderId(param: Service.Request.IListChangeFlowRecordByOrderIdReq): Promise<Service.Response.IListChangeFlowRecordByOrderIdRsp[]>;
|
|
13
|
+
getHotelOrderChangeSwitch(): Promise<Service.Response.IGetHotelOrderChangeSwitchRsp>;
|
|
13
14
|
protected prefixUrl: string;
|
|
14
15
|
}
|
|
15
16
|
declare const flowCoreService: FlowCoreService;
|
|
@@ -37,6 +37,9 @@ class FlowCoreService extends service_1.default {
|
|
|
37
37
|
listChangeFlowRecordByOrderId(param) {
|
|
38
38
|
return (0, http_1.callApi)(this.getApiUrl(this.listChangeFlowRecordByOrderId), param);
|
|
39
39
|
}
|
|
40
|
+
getHotelOrderChangeSwitch() {
|
|
41
|
+
return (0, http_1.callApi)(this.getApiUrl(this.getHotelOrderChangeSwitch));
|
|
42
|
+
}
|
|
40
43
|
}
|
|
41
44
|
const flowCoreService = new FlowCoreService();
|
|
42
45
|
exports.default = flowCoreService;
|
|
@@ -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;
|
|
@@ -109,6 +114,9 @@ export declare namespace Service {
|
|
|
109
114
|
orderId: string;
|
|
110
115
|
recordList: IListChangeFlowRecordRsp[];
|
|
111
116
|
}
|
|
117
|
+
interface IGetHotelOrderChangeSwitchRsp {
|
|
118
|
+
hotelOrderChange: boolean;
|
|
119
|
+
}
|
|
112
120
|
}
|
|
113
121
|
interface FlowCoreController {
|
|
114
122
|
queryOrderNumBySupplierIds(req: Service.Request.QueryFlowOrderIdsBySupplierIdsReq): Promise<Service.Response.IQueryOrderNumBySupplierIdsRsp[]>;
|
|
@@ -135,6 +143,8 @@ export declare namespace Service {
|
|
|
135
143
|
* @path /core/list-change-flow-record
|
|
136
144
|
*/
|
|
137
145
|
listChangeFlowRecord(param: Service.Request.IListChangeFlowRecordReq): Promise<Service.Response.IChangeFlowRecordRsp[]>;
|
|
146
|
+
/** 查询酒店订单变更功能开关(与 Redis 远程配置同源) */
|
|
147
|
+
getHotelOrderChangeSwitch(): Promise<Service.Response.IGetHotelOrderChangeSwitchRsp>;
|
|
138
148
|
/**
|
|
139
149
|
* 根据逆向id查询变更流
|
|
140
150
|
* @param param
|