@be-link/pos-cli-nodejs 1.0.124 → 1.0.126

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@be-link/pos-cli-nodejs",
3
- "version": "1.0.124",
3
+ "version": "1.0.126",
4
4
  "description": "正向订单服务Nodejs客户端",
5
5
  "main": "index.js",
6
6
  "repository": {
package/pos/http.js CHANGED
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -30,37 +39,39 @@ const axiosInstance = axios_1.default.create({
30
39
  console.info(`retryCount: ${retryCount}, onRetry: ${error}, requestHeader: ${JSON.stringify(requestConfig.headers)}`);
31
40
  },
32
41
  });
33
- async function callApi(url, ...request) {
34
- const requestId = (0, uuid_1.v4)();
35
- try {
36
- console.info(`准备发起POS请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
37
- const response = await axiosInstance.post(url, request[0], {
38
- headers: {
39
- 'X-Request-Id': requestId,
40
- 'x-belink-accessType': 'authorizationTokenInside',
41
- 'x-belink-authorization': process.env.authorizationTokenInside || ""
42
+ function callApi(url, ...request) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const requestId = (0, uuid_1.v4)();
45
+ try {
46
+ console.info(`准备发起POS请求[${requestId}]: ${url}, 参数: ${JSON.stringify(request)}`);
47
+ const response = yield axiosInstance.post(url, request[0], {
48
+ headers: {
49
+ 'X-Request-Id': requestId,
50
+ 'x-belink-accessType': 'authorizationTokenInside',
51
+ 'x-belink-authorization': process.env.authorizationTokenInside || ""
52
+ }
53
+ });
54
+ const responseData = response.data;
55
+ return responseData.data;
56
+ }
57
+ catch (error) {
58
+ const axiosError = error;
59
+ const ErrorClass = axiosError.response
60
+ ? axiosError.response.status === 400
61
+ ? BizError_1.default
62
+ : SystemError_1.default
63
+ : SystemError_1.default;
64
+ if (axiosError.response) {
65
+ const response = axiosError.response;
66
+ const data = response.data;
67
+ console.error(`POS 异常[${requestId}]: ${axiosError.message}`);
68
+ console.info('响应信息', data.message);
69
+ console.error('异常堆栈', JSON.stringify(error.stack));
70
+ throw new ErrorClass(data.message || 'Pos Error', response.status);
42
71
  }
43
- });
44
- const responseData = response.data;
45
- return responseData.data;
46
- }
47
- catch (error) {
48
- const axiosError = error;
49
- const ErrorClass = axiosError.response
50
- ? axiosError.response.status === 400
51
- ? BizError_1.default
52
- : SystemError_1.default
53
- : SystemError_1.default;
54
- if (axiosError.response) {
55
- const response = axiosError.response;
56
- const data = response.data;
57
- console.error(`POS 异常[${requestId}]: ${axiosError.message}`);
58
- console.info('响应信息', data.message);
59
- console.error('异常堆栈', JSON.stringify(error.stack));
60
- throw new ErrorClass(data.message || 'Pos Error', response.status);
72
+ console.error(`POS 未知异常[${requestId}]: ${axiosError.message}`, error.stack);
73
+ throw error;
61
74
  }
62
- console.error(`POS 未知异常[${requestId}]: ${axiosError.message}`, error.stack);
63
- throw error;
64
- }
75
+ });
65
76
  }
66
77
  exports.callApi = callApi;
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -17,13 +26,17 @@ class QueryByCommodityService extends service_1.default {
17
26
  querySaleItem(request) {
18
27
  return (0, http_1.callApi)(this.getApiUrl(this.querySaleItem), request);
19
28
  }
20
- async queryOrderInDepartureDate(request) {
21
- const result = await (0, http_1.callApi)(this.getApiUrl(this.queryOrderInDepartureDate), request);
22
- return result.map(item => posProxy_1.default.createProxy(item));
29
+ queryOrderInDepartureDate(request) {
30
+ return __awaiter(this, void 0, void 0, function* () {
31
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.queryOrderInDepartureDate), request);
32
+ return result.map(item => posProxy_1.default.createProxy(item));
33
+ });
23
34
  }
24
- async queryOrderBySkuIdList(request) {
25
- const result = await (0, http_1.callApi)(this.getApiUrl(this.queryOrderBySkuIdList), request);
26
- return result.map(item => posProxy_1.default.createProxy(item));
35
+ queryOrderBySkuIdList(request) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.queryOrderBySkuIdList), request);
38
+ return result.map(item => posProxy_1.default.createProxy(item));
39
+ });
27
40
  }
28
41
  queryItineraryList(request) {
29
42
  return (0, http_1.callApi)(this.getApiUrl(this.queryItineraryList), request);
@@ -34,9 +47,11 @@ class QueryByCommodityService extends service_1.default {
34
47
  queryPartyOrderInfo(request) {
35
48
  return (0, http_1.callApi)(this.getApiUrl(this.queryPartyOrderInfo), request);
36
49
  }
37
- async queryPartyOrderDetail(request) {
38
- const result = await (0, http_1.callApi)(this.getApiUrl(this.queryPartyOrderDetail), request);
39
- return result.map(item => posProxy_1.default.createProxy(item));
50
+ queryPartyOrderDetail(request) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.queryPartyOrderDetail), request);
53
+ return result.map(item => posProxy_1.default.createProxy(item));
54
+ });
40
55
  }
41
56
  getPartyOrderCount(request) {
42
57
  return (0, http_1.callApi)(this.getApiUrl(this.getPartyOrderCount), request);
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -14,9 +23,11 @@ class QueryByStoreService extends service_1.default {
14
23
  queryRejectReasons(request) {
15
24
  return (0, http_1.callApi)(this.getApiUrl(this.queryRejectReasons), request);
16
25
  }
17
- async queryOrderList(request) {
18
- const result = await (0, http_1.callApi)(this.getApiUrl(this.queryOrderList), request);
19
- return result.map(item => posProxy_1.default.createProxy(item));
26
+ queryOrderList(request) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.queryOrderList), request);
29
+ return result.map(item => posProxy_1.default.createProxy(item));
30
+ });
20
31
  }
21
32
  getOrderCount(request) {
22
33
  return (0, http_1.callApi)(this.getApiUrl(this.getOrderCount), request);
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -14,16 +23,20 @@ class QueryBySupplierService extends service_1.default {
14
23
  queryRejectReasons(request) {
15
24
  return (0, http_1.callApi)(this.getApiUrl(this.queryRejectReasons), request);
16
25
  }
17
- async queryOrderList(request) {
18
- const result = await (0, http_1.callApi)(this.getApiUrl(this.queryOrderList), request);
19
- return result.map(item => posProxy_1.default.createProxy(item));
26
+ queryOrderList(request) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.queryOrderList), request);
29
+ return result.map(item => posProxy_1.default.createProxy(item));
30
+ });
20
31
  }
21
32
  getOrderCount(request) {
22
33
  return (0, http_1.callApi)(this.getApiUrl(this.getOrderCount), request);
23
34
  }
24
- async queryOrderForStatistics(request) {
25
- const result = await (0, http_1.callApi)(this.getApiUrl(this.queryOrderForStatistics), request);
26
- return result.map(item => posProxy_1.default.createProxy(item));
35
+ queryOrderForStatistics(request) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.queryOrderForStatistics), request);
38
+ return result.map(item => posProxy_1.default.createProxy(item));
39
+ });
27
40
  }
28
41
  mgetOrderQuantity(request) {
29
42
  return (0, http_1.callApi)(this.getApiUrl(this.mgetOrderQuantity), request);
@@ -874,6 +874,8 @@ export declare namespace Service {
874
874
  remainAmount: number;
875
875
  /** 商品名称 */
876
876
  itemName: string;
877
+ /** 商品二级类目 */
878
+ categoryTwo: string;
877
879
  }[];
878
880
  total: number;
879
881
  }
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -23,27 +32,37 @@ class QueryByUserService extends service_1.default {
23
32
  getOrderInvoiceByInvoiceId(request) {
24
33
  return (0, http_1.callApi)(this.getApiUrl(this.getOrderInvoiceByInvoiceId), request);
25
34
  }
26
- async getOrderById(request) {
27
- const result = await (0, http_1.callApi)(this.getApiUrl(this.getOrderById), request);
28
- return posProxy_1.default.createProxy(result);
35
+ getOrderById(request) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.getOrderById), request);
38
+ return posProxy_1.default.createProxy(result);
39
+ });
29
40
  }
30
- async queryOrderByIdList(request) {
31
- const result = await (0, http_1.callApi)(this.getApiUrl(this.queryOrderByIdList), request);
32
- return result.map(item => posProxy_1.default.createProxy(item));
41
+ queryOrderByIdList(request) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.queryOrderByIdList), request);
44
+ return result.map(item => posProxy_1.default.createProxy(item));
45
+ });
33
46
  }
34
- async queryUserOrder(request) {
35
- const result = await (0, http_1.callApi)(this.getApiUrl(this.queryUserOrder), request);
36
- return result.map(item => posProxy_1.default.createProxy(item));
47
+ queryUserOrder(request) {
48
+ return __awaiter(this, void 0, void 0, function* () {
49
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.queryUserOrder), request);
50
+ return result.map(item => posProxy_1.default.createProxy(item));
51
+ });
37
52
  }
38
53
  getUserOrderCount(request) {
39
54
  return (0, http_1.callApi)(this.getApiUrl(this.getUserOrderCount), request);
40
55
  }
41
- async mgetUserOrderCountList(request) {
42
- return (0, http_1.callApi)(this.getApiUrl(this.mgetUserOrderCountList), request);
56
+ mgetUserOrderCountList(request) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ return (0, http_1.callApi)(this.getApiUrl(this.mgetUserOrderCountList), request);
59
+ });
43
60
  }
44
- async querySubOrderList(request) {
45
- const result = await (0, http_1.callApi)(this.getApiUrl(this.querySubOrderList), request);
46
- return result.map(item => posProxy_1.default.createProxy(item));
61
+ querySubOrderList(request) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.querySubOrderList), request);
64
+ return result.map(item => posProxy_1.default.createProxy(item));
65
+ });
47
66
  }
48
67
  calculateUserConsumeInfo(request) {
49
68
  return (0, http_1.callApi)(this.getApiUrl(this.calculateUserConsumeInfo), request);
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -11,9 +20,11 @@ class QueryByWebService extends service_1.default {
11
20
  super(...arguments);
12
21
  this.prefixUrl = '/query/web';
13
22
  }
14
- async queryOrderList(request) {
15
- const result = await (0, http_1.callApi)(this.getApiUrl(this.queryOrderList), request);
16
- return result.map(item => posProxy_1.default.createProxy(item));
23
+ queryOrderList(request) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.queryOrderList), request);
26
+ return result.map(item => posProxy_1.default.createProxy(item));
27
+ });
17
28
  }
18
29
  getOrderCount(request) {
19
30
  return (0, http_1.callApi)(this.getApiUrl(this.getOrderCount), request);
@@ -21,9 +32,11 @@ class QueryByWebService extends service_1.default {
21
32
  queryOrderOperateRecord(request) {
22
33
  return (0, http_1.callApi)(this.getApiUrl(this.queryOrderOperateRecord), request);
23
34
  }
24
- async queryOrderForStatistics(request) {
25
- const result = await (0, http_1.callApi)(this.getApiUrl(this.queryOrderForStatistics), request);
26
- return result.map(item => posProxy_1.default.createProxy(item));
35
+ queryOrderForStatistics(request) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const result = yield (0, http_1.callApi)(this.getApiUrl(this.queryOrderForStatistics), request);
38
+ return result.map(item => posProxy_1.default.createProxy(item));
39
+ });
27
40
  }
28
41
  }
29
42
  const queryByWebService = new QueryByWebService();
@@ -1,4 +1,13 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
@@ -10,17 +19,25 @@ class OrderTouristMaterialService extends service_1.default {
10
19
  super(...arguments);
11
20
  this.prefixUrl = '/tourist-material';
12
21
  }
13
- async get(request) {
14
- return (0, http_1.callApi)(this.getApiUrl(this.get), request);
22
+ get(request) {
23
+ return __awaiter(this, void 0, void 0, function* () {
24
+ return (0, http_1.callApi)(this.getApiUrl(this.get), request);
25
+ });
15
26
  }
16
- async queryExists(request) {
17
- return (0, http_1.callApi)(this.getApiUrl(this.queryExists), request);
27
+ queryExists(request) {
28
+ return __awaiter(this, void 0, void 0, function* () {
29
+ return (0, http_1.callApi)(this.getApiUrl(this.queryExists), request);
30
+ });
18
31
  }
19
- async getTourMaterialInfo(request) {
20
- return (0, http_1.callApi)(this.getApiUrl(this.getTourMaterialInfo), request);
32
+ getTourMaterialInfo(request) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ return (0, http_1.callApi)(this.getApiUrl(this.getTourMaterialInfo), request);
35
+ });
21
36
  }
22
- async initDepartureOrderTourMaterialInfo(request) {
23
- return (0, http_1.callApi)(this.getApiUrl(this.initDepartureOrderTourMaterialInfo), request);
37
+ initDepartureOrderTourMaterialInfo(request) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ return (0, http_1.callApi)(this.getApiUrl(this.initDepartureOrderTourMaterialInfo), request);
40
+ });
24
41
  }
25
42
  }
26
43
  const orderTouristMaterialService = new OrderTouristMaterialService();
@@ -31,17 +31,15 @@ class PosProxyFactory {
31
31
  if (order.venueInfo) {
32
32
  venueInfoProxy = order.venueInfo.map(venue => (0, venueInfoProxy_1.createVenueInfoProxy)(venue, version));
33
33
  }
34
- return {
35
- ...order,
34
+ return Object.assign(Object.assign({}, order), {
36
35
  // @ts-ignore
37
- itemInfo: itemInfoProxy,
36
+ itemInfo: itemInfoProxy,
38
37
  // @ts-ignore
39
- skuInfo: skuInfoProxy,
38
+ skuInfo: skuInfoProxy,
40
39
  // @ts-ignore
41
- comboInfo: comboInfoProxy,
40
+ comboInfo: comboInfoProxy,
42
41
  // @ts-ignore
43
- venueInfo: venueInfoProxy,
44
- };
42
+ venueInfo: venueInfoProxy });
45
43
  }
46
44
  }
47
45
  exports.default = PosProxyFactory;