@be-link/pos-cli-nodejs 0.0.147 → 0.0.149
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/package.json +1 -1
- package/pos/http.js +1 -43
- package/types.d.ts +2 -2
package/package.json
CHANGED
package/pos/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
|
};
|
|
@@ -35,7 +12,7 @@ const axios_retry_1 = __importDefault(require("axios-retry"));
|
|
|
35
12
|
(0, axios_retry_1.default)(axios_1.default, {
|
|
36
13
|
retries: 1,
|
|
37
14
|
retryCondition(error) {
|
|
38
|
-
return error.
|
|
15
|
+
return error.message.includes('getaddrinfo ENOTFOUND') || [502, 503].includes(error.response.status);
|
|
39
16
|
},
|
|
40
17
|
retryDelay: (retryCount, error) => {
|
|
41
18
|
console.info(`retryCount: ${retryCount}, retryDelay: ${retryCount * 500}`);
|
|
@@ -72,25 +49,6 @@ async function callApi(url, ...request) {
|
|
|
72
49
|
console.error('异常堆栈', JSON.stringify(error.stack));
|
|
73
50
|
throw new ErrorClass(data.message || 'Pos Error', response.status);
|
|
74
51
|
}
|
|
75
|
-
// 调用dns模块解析url
|
|
76
|
-
const dns = await Promise.resolve().then(() => __importStar(require('dns')));
|
|
77
|
-
const dnsPromise = new Promise((resolve, reject) => {
|
|
78
|
-
const lookupRes = dns.lookup(url, (err, address) => {
|
|
79
|
-
if (err) {
|
|
80
|
-
console.error(err.message);
|
|
81
|
-
reject(err);
|
|
82
|
-
}
|
|
83
|
-
console.info(`lookup: ${JSON.stringify(lookupRes)}`);
|
|
84
|
-
resolve(address);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
try {
|
|
88
|
-
const address = await dnsPromise;
|
|
89
|
-
console.info(`address: ${JSON.stringify(address)}`);
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
console.info(`error: ${JSON.stringify(error)}`);
|
|
93
|
-
}
|
|
94
52
|
console.error(`POS 未知异常: ${axiosError.message}`, error.stack);
|
|
95
53
|
throw error;
|
|
96
54
|
}
|
package/types.d.ts
CHANGED
|
@@ -24,8 +24,8 @@ export interface IPositiveOrder {
|
|
|
24
24
|
originalFee: number;
|
|
25
25
|
/** 快照:订单实付金额(优惠后金额) */
|
|
26
26
|
actuallyPaidFee: number;
|
|
27
|
-
/** 订单剩余金额 *listOrderInvoiceCount
|
|
28
|
-
remainFee: number
|
|
27
|
+
/** 订单剩余金额 *listOrderInvoiceCount */
|
|
28
|
+
remainFee: number;
|
|
29
29
|
/** 快照:归属用户unionId */
|
|
30
30
|
unionId: string;
|
|
31
31
|
/** 快照:归属用户openId */
|