node-easywechat 2.8.0 → 2.9.0

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.
Files changed (142) hide show
  1. package/README.md +51 -4
  2. package/dist/BaseService/Jssdk/JssdkClient.js +5 -5
  3. package/dist/BaseService/Media/MediaClient.js +1 -1
  4. package/dist/Core/AES.d.ts +1 -1
  5. package/dist/Core/AES.js +4 -4
  6. package/dist/Core/BaseAccessToken.js +2 -2
  7. package/dist/Core/BaseApplication.js +4 -4
  8. package/dist/Core/BaseClient.js +2 -2
  9. package/dist/Core/Cache/FileCache.js +3 -3
  10. package/dist/Core/Encryptor.js +3 -3
  11. package/dist/Core/Http/Request.js +13 -13
  12. package/dist/Core/Http/StreamResponse.js +1 -1
  13. package/dist/Core/Messages/Media.js +2 -2
  14. package/dist/Core/Messages/Message.js +7 -7
  15. package/dist/Core/Mixins/HttpMixin.js +4 -4
  16. package/dist/Core/ServerGuard.d.ts +2 -2
  17. package/dist/Core/ServerGuard.js +5 -5
  18. package/dist/Core/Types.d.ts +34 -4
  19. package/dist/Core/Utils.js +18 -18
  20. package/dist/MicroMerchant/Application.js +1 -1
  21. package/dist/MicroMerchant/Base/MicroMerchantBase.js +6 -6
  22. package/dist/MicroMerchant/Certficates/CertficatesClient.js +1 -1
  23. package/dist/MicroMerchant/Core/BaseClient.js +8 -8
  24. package/dist/MicroMerchant/Media/MediaClient.js +1 -1
  25. package/dist/MicroMerchant/MerchantConfig/MerchantConfigClient.js +1 -1
  26. package/dist/MicroMerchant/Meterial/MeterialClient.js +4 -4
  27. package/dist/MicroMerchant/Withdraw/WithdrawClient.js +2 -2
  28. package/dist/MiniProgram/ActivityMessage/ActivityMessageClient.js +3 -3
  29. package/dist/MiniProgram/AppCode/AppCodeClient.js +2 -2
  30. package/dist/MiniProgram/Application.d.ts +16 -0
  31. package/dist/MiniProgram/Application.js +40 -0
  32. package/dist/MiniProgram/Base/MiniProgramBase.js +1 -1
  33. package/dist/MiniProgram/NearbyPoi/NearbyPoiClient.js +3 -3
  34. package/dist/MiniProgram/OpenData/OpenDataClient.js +2 -2
  35. package/dist/MiniProgram/RealtimeLog/RealtimeLogClient.js +1 -1
  36. package/dist/MiniProgram/Shop/AccoutClient.d.ts +25 -0
  37. package/dist/MiniProgram/Shop/AccoutClient.js +42 -0
  38. package/dist/MiniProgram/Shop/AftersaleClient.d.ts +22 -0
  39. package/dist/MiniProgram/Shop/AftersaleClient.js +35 -0
  40. package/dist/MiniProgram/Shop/BasicClient.d.ts +39 -0
  41. package/dist/MiniProgram/Shop/BasicClient.js +69 -0
  42. package/dist/MiniProgram/Shop/DeliveryClient.d.ts +20 -0
  43. package/dist/MiniProgram/Shop/DeliveryClient.js +32 -0
  44. package/dist/MiniProgram/Shop/OrderClient.d.ts +32 -0
  45. package/dist/MiniProgram/Shop/OrderClient.js +51 -0
  46. package/dist/MiniProgram/Shop/RegisterClient.d.ts +25 -0
  47. package/dist/MiniProgram/Shop/RegisterClient.js +43 -0
  48. package/dist/MiniProgram/Shop/SpuClient.d.ts +67 -0
  49. package/dist/MiniProgram/Shop/SpuClient.js +92 -0
  50. package/dist/MiniProgram/ShortLink/ShortLinkClient.d.ts +11 -0
  51. package/dist/MiniProgram/ShortLink/ShortLinkClient.js +23 -0
  52. package/dist/MiniProgram/SubscribeMessage/SubscribeMessageClient.js +5 -5
  53. package/dist/MiniProgram/UniformMessage/UniformMessageClient.js +3 -3
  54. package/dist/MiniProgram/UrlLink/UrlLinkClient.d.ts +6 -1
  55. package/dist/MiniProgram/UrlLink/UrlLinkClient.js +7 -2
  56. package/dist/OfficialAccount/Base/OfficialAccountBase.js +2 -2
  57. package/dist/OfficialAccount/Broadcasting/BroadcastingClient.js +2 -2
  58. package/dist/OfficialAccount/Broadcasting/MessageBuilder.js +1 -1
  59. package/dist/OfficialAccount/Card/Client.js +1 -1
  60. package/dist/OfficialAccount/Card/JssdkClient.js +2 -2
  61. package/dist/OfficialAccount/Card/MemberCardClient.js +1 -1
  62. package/dist/OfficialAccount/CustomerService/CustomerServiceClient.js +2 -2
  63. package/dist/OfficialAccount/CustomerService/Messenger.js +1 -1
  64. package/dist/OfficialAccount/DataCube/DataCubeClient.js +1 -1
  65. package/dist/OfficialAccount/Material/MaterialClient.js +2 -2
  66. package/dist/OfficialAccount/OCR/OCRClient.js +1 -1
  67. package/dist/OfficialAccount/Semantic/SemanticClient.js +1 -1
  68. package/dist/OfficialAccount/SubscribeMessage/SubscribeMessageClient.js +4 -4
  69. package/dist/OfficialAccount/TemplateMessage/TemplateMessageClient.js +4 -4
  70. package/dist/OpenPlatform/Application.js +8 -8
  71. package/dist/OpenPlatform/Authorizer/Auth/AccessToken.js +1 -1
  72. package/dist/OpenPlatform/Authorizer/OfficialAccount/Account/Client.js +1 -1
  73. package/dist/OpenWork/Application.d.ts +37 -0
  74. package/dist/OpenWork/Application.js +128 -0
  75. package/dist/OpenWork/Auth/ProviderAccessToken.d.ts +8 -0
  76. package/dist/OpenWork/Auth/ProviderAccessToken.js +33 -0
  77. package/dist/OpenWork/Auth/SuiteAccessToken.d.ts +8 -0
  78. package/dist/OpenWork/Auth/SuiteAccessToken.js +34 -0
  79. package/dist/OpenWork/Auth/SuiteTicket.d.ts +8 -0
  80. package/dist/OpenWork/Auth/SuiteTicket.js +40 -0
  81. package/dist/OpenWork/Corp/CorpClient.d.ts +72 -0
  82. package/dist/OpenWork/Corp/CorpClient.js +150 -0
  83. package/dist/OpenWork/MiniProgram/MiniProgramClient.d.ts +5 -0
  84. package/dist/OpenWork/MiniProgram/MiniProgramClient.js +18 -0
  85. package/dist/OpenWork/Provider/ProviderClient.d.ts +81 -0
  86. package/dist/OpenWork/Provider/ProviderClient.js +172 -0
  87. package/dist/OpenWork/Server/OpenWorkGuard.d.ts +13 -0
  88. package/dist/OpenWork/Server/OpenWorkGuard.js +51 -0
  89. package/dist/OpenWork/Work/Application.d.ts +5 -0
  90. package/dist/OpenWork/Work/Application.js +22 -0
  91. package/dist/OpenWork/Work/Auth/AccessToken.d.ts +12 -0
  92. package/dist/OpenWork/Work/Auth/AccessToken.js +44 -0
  93. package/dist/Payment/Application.js +4 -4
  94. package/dist/Payment/Bill/BillClient.js +2 -2
  95. package/dist/Payment/Core/BaseClient.js +8 -8
  96. package/dist/Payment/Jssdk/JssdkClient.js +14 -14
  97. package/dist/Payment/Merchant/MerchantClient.js +1 -1
  98. package/dist/Payment/Notify/Handler.js +5 -5
  99. package/dist/Payment/Notify/Refunded.js +1 -1
  100. package/dist/Payment/Notify/Scanned.js +2 -2
  101. package/dist/Payment/Order/OrderClient.js +1 -1
  102. package/dist/Payment/Redpack/RedpackClient.js +5 -5
  103. package/dist/Payment/Refund/RefundClient.js +3 -3
  104. package/dist/Payment/Sandbox/SandboxClient.js +1 -1
  105. package/dist/Payment/Transfer/TransferClient.js +1 -1
  106. package/dist/Work/Agent/AgentClient.js +1 -1
  107. package/dist/Work/Agent/WorkbenchClient.d.ts +24 -0
  108. package/dist/Work/Agent/WorkbenchClient.js +39 -0
  109. package/dist/Work/Application.d.ts +8 -0
  110. package/dist/Work/Application.js +20 -0
  111. package/dist/Work/Calendar/CalendarClient.js +1 -1
  112. package/dist/Work/Chat/ChatClient.js +1 -1
  113. package/dist/Work/CorpGroup/CorpGroupClient.d.ts +34 -0
  114. package/dist/Work/CorpGroup/CorpGroupClient.js +42 -0
  115. package/dist/Work/Department/DepartmentClient.js +1 -1
  116. package/dist/Work/ExternalContact/Client.d.ts +56 -0
  117. package/dist/Work/ExternalContact/Client.js +88 -0
  118. package/dist/Work/ExternalContact/ContactWayClient.d.ts +37 -0
  119. package/dist/Work/ExternalContact/ContactWayClient.js +51 -2
  120. package/dist/Work/ExternalContact/MessageClient.js +4 -4
  121. package/dist/Work/ExternalContact/MessageTemplateClient.js +3 -3
  122. package/dist/Work/ExternalContact/MomentClient.d.ts +56 -3
  123. package/dist/Work/ExternalContact/MomentClient.js +62 -3
  124. package/dist/Work/ExternalContact/StatisticsClient.d.ts +24 -0
  125. package/dist/Work/ExternalContact/StatisticsClient.js +35 -0
  126. package/dist/Work/Jssdk/JssdkClient.js +3 -3
  127. package/dist/Work/Kf/KfAccountClient.d.ts +41 -0
  128. package/dist/Work/Kf/KfAccountClient.js +71 -0
  129. package/dist/Work/Kf/KfMessageClient.d.ts +44 -0
  130. package/dist/Work/Kf/KfMessageClient.js +73 -0
  131. package/dist/Work/Kf/KfServicerClient.d.ts +26 -0
  132. package/dist/Work/Kf/KfServicerClient.js +47 -0
  133. package/dist/Work/Media/MediaClient.js +1 -1
  134. package/dist/Work/Message/Messenger.js +2 -2
  135. package/dist/Work/Schedule/ScheduleClient.js +1 -1
  136. package/dist/Work/Server/Guard.d.ts +1 -1
  137. package/dist/Work/User/UserClient.js +3 -3
  138. package/dist/index.d.ts +8 -2
  139. package/dist/index.js +9 -7
  140. package/node-easywechat.file_cache.easywechat.kernel.access_token.8a9684b45da7de42a06a70ba01a7005a.cache +1 -1
  141. package/node-easywechat.file_cache.easywechat.kernel.access_token.c3d06edaf326aad75d32f31348df787a.cache +1 -1
  142. package/package.json +11 -11
@@ -19,24 +19,24 @@ const xml2js_1 = __importDefault(require("xml2js"));
19
19
  const stream_1 = __importDefault(require("stream"));
20
20
  const fs_1 = __importDefault(require("fs"));
21
21
  const merge = (target, source) => {
22
- if (exports.isObject(source)) {
22
+ if ((0, exports.isObject)(source)) {
23
23
  if (source.constructor !== Object) {
24
24
  target = source;
25
25
  }
26
26
  else {
27
- if (!target || !exports.isObject(target)) {
27
+ if (!target || !(0, exports.isObject)(target)) {
28
28
  target = {};
29
29
  }
30
30
  Object.keys(source).map((k) => {
31
31
  if (!target[k]) {
32
32
  target[k] = null;
33
33
  }
34
- target[k] = exports.merge(target[k], source[k]);
34
+ target[k] = (0, exports.merge)(target[k], source[k]);
35
35
  });
36
36
  }
37
37
  }
38
- else if (exports.isArray(source)) {
39
- if (!target || !exports.isArray(target)) {
38
+ else if ((0, exports.isArray)(source)) {
39
+ if (!target || !(0, exports.isArray)(target)) {
40
40
  target = [];
41
41
  }
42
42
  target = target.concat(target, source);
@@ -62,7 +62,7 @@ exports.createHmac = createHmac;
62
62
  const md5File = function (path) {
63
63
  return new Promise((reslove, reject) => {
64
64
  let stream;
65
- if (exports.isString(path)) {
65
+ if ((0, exports.isString)(path)) {
66
66
  stream = fs_1.default.createReadStream(path);
67
67
  }
68
68
  else {
@@ -83,7 +83,7 @@ exports.md5File = md5File;
83
83
  const getTimestamp = function (datetime = null) {
84
84
  let time;
85
85
  try {
86
- time = (exports.isString(datetime) ? new Date(datetime) : new Date).getTime();
86
+ time = ((0, exports.isString)(datetime) ? new Date(datetime) : new Date).getTime();
87
87
  }
88
88
  catch (e) {
89
89
  return 0;
@@ -127,12 +127,12 @@ const makeSignature = function (params, key = '', type = 'md5') {
127
127
  switch (type) {
128
128
  case 'sha1':
129
129
  case 'md5':
130
- sign = exports.createHash(paramsString, type);
130
+ sign = (0, exports.createHash)(paramsString, type);
131
131
  break;
132
132
  case 'hmac-sha256':
133
133
  case 'hmac_sha256':
134
134
  type = type.replace(/^hmac[\-|_]/i, '');
135
- sign = exports.createHmac(paramsString, key, type);
135
+ sign = (0, exports.createHmac)(paramsString, key, type);
136
136
  break;
137
137
  }
138
138
  return (sign + '').toUpperCase();
@@ -171,13 +171,13 @@ const isIpv6 = function (ip) {
171
171
  };
172
172
  exports.isIpv6 = isIpv6;
173
173
  const isIp = function (ip) {
174
- return exports.isIpv4(ip) || exports.isIpv6(ip);
174
+ return (0, exports.isIpv4)(ip) || (0, exports.isIpv6)(ip);
175
175
  };
176
176
  exports.isIp = isIp;
177
177
  const inArray = function (data, arr, strict = false) {
178
- if (!exports.isArray(arr))
178
+ if (!(0, exports.isArray)(arr))
179
179
  return strict ? data === arr : data == arr;
180
- if (exports.isFunction(arr.findIndex)) {
180
+ if ((0, exports.isFunction)(arr.findIndex)) {
181
181
  return arr.findIndex((o) => { return strict ? o === data : o == data; }) > -1;
182
182
  }
183
183
  else {
@@ -216,12 +216,12 @@ const strLcwords = function (str) {
216
216
  exports.strLcwords = strLcwords;
217
217
  // 驼峰(首字母大写),'hello word' => 'HelloWorld'
218
218
  const strStudly = function (value) {
219
- return exports.strUcwords(value.replace(/[\-|\_]/gi, ' ')).replace(/\s/gi, '');
219
+ return (0, exports.strUcwords)(value.replace(/[\-|\_]/gi, ' ')).replace(/\s/gi, '');
220
220
  };
221
221
  exports.strStudly = strStudly;
222
222
  // 驼峰(首字母小写),'hello word' => 'helloWorld'
223
223
  const strCamel = function (value) {
224
- return exports.strLcwords(exports.strStudly(value));
224
+ return (0, exports.strLcwords)((0, exports.strStudly)(value));
225
225
  };
226
226
  exports.strCamel = strCamel;
227
227
  // 如果只有一个同名、同级节点,则不当作数组
@@ -229,16 +229,16 @@ const singleItem = function (obj) {
229
229
  if (typeof obj == 'object') {
230
230
  if (typeof obj.length != 'undefined') {
231
231
  if (obj.length == 1) {
232
- return exports.singleItem(obj[0]);
232
+ return (0, exports.singleItem)(obj[0]);
233
233
  }
234
234
  for (let i = 0; i < obj.length; i++) {
235
- obj[i] = exports.singleItem(obj[i]);
235
+ obj[i] = (0, exports.singleItem)(obj[i]);
236
236
  }
237
237
  return obj;
238
238
  }
239
239
  else {
240
240
  for (let k in obj) {
241
- obj[k] = exports.singleItem(obj[k]);
241
+ obj[k] = (0, exports.singleItem)(obj[k]);
242
242
  }
243
243
  }
244
244
  }
@@ -248,7 +248,7 @@ exports.singleItem = singleItem;
248
248
  const parseXml = function (xml) {
249
249
  return __awaiter(this, void 0, void 0, function* () {
250
250
  let res = yield xml2js_1.default.parseStringPromise(xml);
251
- res = exports.singleItem(res);
251
+ res = (0, exports.singleItem)(res);
252
252
  if (res['xml'])
253
253
  res = res['xml'];
254
254
  return res;
@@ -82,7 +82,7 @@ class MicroMerchant extends BaseApplication_1.default {
82
82
  delete data['sign'];
83
83
  let signType = sign.length > 32 ? 'HMAC-SHA256' : 'MD5';
84
84
  let secretKey = this.getKey();
85
- if (Utils_1.makeSignature(data, secretKey, signType) === sign) {
85
+ if ((0, Utils_1.makeSignature)(data, secretKey, signType) === sign) {
86
86
  return true;
87
87
  }
88
88
  throw new Error('return value signature verification error');
@@ -7,11 +7,11 @@ const Utils_1 = require("../../Core/Utils");
7
7
  const BaseClient_1 = __importDefault(require("../Core/BaseClient"));
8
8
  class MicroMerchantBase extends BaseClient_1.default {
9
9
  submitApplication(params) {
10
- let newParams = this.processParams(Utils_1.merge(Utils_1.merge({}, params), {
10
+ let newParams = this.processParams((0, Utils_1.merge)((0, Utils_1.merge)({}, params), {
11
11
  version: '3.0',
12
12
  cert_sn: '',
13
13
  sign_type: 'HMAC-SHA256',
14
- nonce_str: Utils_1.randomString(18),
14
+ nonce_str: (0, Utils_1.randomString)(18),
15
15
  }));
16
16
  return this.safeRequest('applyment/micro/submit', newParams);
17
17
  }
@@ -19,7 +19,7 @@ class MicroMerchantBase extends BaseClient_1.default {
19
19
  let params = {
20
20
  version: '1.0',
21
21
  sign_type: 'HMAC-SHA256',
22
- nonce_str: Utils_1.randomString(18),
22
+ nonce_str: (0, Utils_1.randomString)(18),
23
23
  };
24
24
  if (applymentId) {
25
25
  params['applyment_id'] = applymentId;
@@ -30,12 +30,12 @@ class MicroMerchantBase extends BaseClient_1.default {
30
30
  return this.safeRequest('applyment/micro/getstate', params);
31
31
  }
32
32
  upgrade(params) {
33
- let newParams = this.processParams(Utils_1.merge(Utils_1.merge({}, params), {
33
+ let newParams = this.processParams((0, Utils_1.merge)((0, Utils_1.merge)({}, params), {
34
34
  sub_mch_id: params['sub_mch_id'] || this.app.config.sub_mch_id,
35
35
  version: '1.0',
36
36
  cert_sn: '',
37
37
  sign_type: 'HMAC-SHA256',
38
- nonce_str: Utils_1.randomString(18),
38
+ nonce_str: (0, Utils_1.randomString)(18),
39
39
  }));
40
40
  return this.safeRequest('applyment/micro/submitupgrade', newParams);
41
41
  }
@@ -44,7 +44,7 @@ class MicroMerchantBase extends BaseClient_1.default {
44
44
  sub_mch_id: subMchId || this.app.config.sub_mch_id,
45
45
  version: '1.0',
46
46
  sign_type: 'HMAC-SHA256',
47
- nonce_str: Utils_1.randomString(18),
47
+ nonce_str: (0, Utils_1.randomString)(18),
48
48
  };
49
49
  return this.safeRequest('applyment/micro/getupgradestate', params);
50
50
  }
@@ -20,7 +20,7 @@ class CertficatesClient extends BaseClient_1.default {
20
20
  return __awaiter(this, void 0, void 0, function* () {
21
21
  let params = {
22
22
  sign_type: 'HMAC-SHA256',
23
- nonce_str: Utils_1.randomString(18),
23
+ nonce_str: (0, Utils_1.randomString)(18),
24
24
  };
25
25
  if (returnRaw) {
26
26
  return yield this.requestRaw('risk/getcertficates', params);
@@ -21,7 +21,7 @@ class BaseClient extends BaseClient_1.default {
21
21
  httpUpload(url, files = {}, form = {}, query = {}, returnResponse = false) {
22
22
  let formData = new form_data_1.default;
23
23
  for (let name in files) {
24
- if (Utils_1.isString(files[name])) {
24
+ if ((0, Utils_1.isString)(files[name])) {
25
25
  formData.append(name, fs_1.default.createReadStream(files[name]));
26
26
  }
27
27
  else {
@@ -43,14 +43,14 @@ class BaseClient extends BaseClient_1.default {
43
43
  let base = {
44
44
  mch_id: this.app.config.mch_id,
45
45
  };
46
- let localParams = Utils_1.merge(Utils_1.merge(base, this.prepends()), params);
46
+ let localParams = (0, Utils_1.merge)((0, Utils_1.merge)(base, this.prepends()), params);
47
47
  let secretKey = yield this.app.getKey();
48
- localParams['sign'] = Utils_1.makeSignature(localParams, secretKey, localParams['sign_type'] || 'MD5');
49
- let payload = Utils_1.merge(Utils_1.merge({}, options), {
48
+ localParams['sign'] = (0, Utils_1.makeSignature)(localParams, secretKey, localParams['sign_type'] || 'MD5');
49
+ let payload = (0, Utils_1.merge)((0, Utils_1.merge)({}, options), {
50
50
  url: endpoint,
51
51
  method,
52
52
  responseType: 'text',
53
- data: Utils_1.buildXml(localParams)
53
+ data: (0, Utils_1.buildXml)(localParams)
54
54
  });
55
55
  let response = yield this.doRequest(payload);
56
56
  if (returnResponse) {
@@ -59,7 +59,7 @@ class BaseClient extends BaseClient_1.default {
59
59
  else {
60
60
  let body = response.data;
61
61
  try {
62
- body = yield Utils_1.parseXml(body);
62
+ body = yield (0, Utils_1.parseXml)(body);
63
63
  }
64
64
  catch (e) { }
65
65
  return body;
@@ -77,11 +77,11 @@ class BaseClient extends BaseClient_1.default {
77
77
  }
78
78
  let rsa = new RSA_1.default;
79
79
  rsa.setPublicKey(certificate);
80
- let newParams = Utils_1.merge({}, params);
80
+ let newParams = (0, Utils_1.merge)({}, params);
81
81
  newParams['cert_sn'] = serial_no;
82
82
  let sensitive_fields = this.getSensitiveFieldsName();
83
83
  for (let k in newParams) {
84
- if (Utils_1.inArray(k, sensitive_fields)) {
84
+ if ((0, Utils_1.inArray)(k, sensitive_fields)) {
85
85
  newParams[k] = rsa.encrypt(newParams[k]);
86
86
  }
87
87
  }
@@ -21,7 +21,7 @@ class MediaClient extends BaseClient_1.default {
21
21
  throw new Error(`File does not exist, or the file is unreadable: '${file}'`);
22
22
  }
23
23
  let form = {
24
- media_hash: yield Utils_1.md5File(file),
24
+ media_hash: yield (0, Utils_1.md5File)(file),
25
25
  sign_type: 'HMAC-SHA256',
26
26
  };
27
27
  return this.httpUpload('secapi/mch/uploadmedia', {
@@ -11,7 +11,7 @@ class MerchantConfigClient extends BaseClient_1.default {
11
11
  sub_appid: subAppId,
12
12
  sub_mch_id: subMchId || this.app.config.sub_mch_id,
13
13
  sign_type: 'HMAC-SHA256',
14
- nonce_str: Utils_1.randomString(18),
14
+ nonce_str: (0, Utils_1.randomString)(18),
15
15
  };
16
16
  if (subscribeAppId) {
17
17
  params['subscribe_appid'] = subscribeAppId;
@@ -7,22 +7,22 @@ const Utils_1 = require("../../Core/Utils");
7
7
  const BaseClient_1 = __importDefault(require("../Core/BaseClient"));
8
8
  class MeterialClient extends BaseClient_1.default {
9
9
  setSettlementCard(params) {
10
- let newParams = this.processParams(Utils_1.merge(Utils_1.merge({}, params), {
10
+ let newParams = this.processParams((0, Utils_1.merge)((0, Utils_1.merge)({}, params), {
11
11
  sub_mch_id: params['sub_mch_id'] || this.app.config.sub_mch_id,
12
12
  version: '1.0',
13
13
  cert_sn: '',
14
14
  sign_type: 'HMAC-SHA256',
15
- nonce_str: Utils_1.randomString(18),
15
+ nonce_str: (0, Utils_1.randomString)(18),
16
16
  }));
17
17
  return this.safeRequest('applyment/micro/modifyarchives', newParams);
18
18
  }
19
19
  updateContact(params) {
20
- let newParams = this.processParams(Utils_1.merge(Utils_1.merge({}, params), {
20
+ let newParams = this.processParams((0, Utils_1.merge)((0, Utils_1.merge)({}, params), {
21
21
  sub_mch_id: params['sub_mch_id'] || this.app.config.sub_mch_id,
22
22
  version: '1.0',
23
23
  cert_sn: '',
24
24
  sign_type: 'HMAC-SHA256',
25
- nonce_str: Utils_1.randomString(18),
25
+ nonce_str: (0, Utils_1.randomString)(18),
26
26
  }));
27
27
  return this.safeRequest('applyment/micro/modifycontactinfo', newParams);
28
28
  }
@@ -11,7 +11,7 @@ class WithdrawClient extends BaseClient_1.default {
11
11
  date,
12
12
  sub_mch_id: subMchId || this.app.config.sub_mch_id,
13
13
  sign_type: 'HMAC-SHA256',
14
- nonce_str: Utils_1.randomString(18),
14
+ nonce_str: (0, Utils_1.randomString)(18),
15
15
  };
16
16
  return this.safeRequest('fund/queryautowithdrawbydate', params);
17
17
  }
@@ -20,7 +20,7 @@ class WithdrawClient extends BaseClient_1.default {
20
20
  date,
21
21
  sub_mch_id: subMchId || this.app.config.sub_mch_id,
22
22
  sign_type: 'HMAC-SHA256',
23
- nonce_str: Utils_1.randomString(18),
23
+ nonce_str: (0, Utils_1.randomString)(18),
24
24
  };
25
25
  return this.safeRequest('fund/reautowithdrawbydate', params);
26
26
  }
@@ -10,7 +10,7 @@ class ActivityMessageClient extends BaseClient_1.default {
10
10
  return this.httpGet('cgi-bin/message/wxopen/activityid/create');
11
11
  }
12
12
  updateMessage(activityId, state = 0, params = {}) {
13
- if (!Utils_1.inArray(state, [0, 1, '0', '1'])) {
13
+ if (!(0, Utils_1.inArray)(state, [0, 1, '0', '1'])) {
14
14
  throw new Error('"state" should be "0" or "1".');
15
15
  }
16
16
  params = {
@@ -25,10 +25,10 @@ class ActivityMessageClient extends BaseClient_1.default {
25
25
  formatParameters(params) {
26
26
  let formatted = [];
27
27
  for (let key in params) {
28
- if (Utils_1.inArray(key, ['member_count', 'room_limit', 'path', 'version_type'])) {
28
+ if ((0, Utils_1.inArray)(key, ['member_count', 'room_limit', 'path', 'version_type'])) {
29
29
  continue;
30
30
  }
31
- if (key === 'version_type' && !Utils_1.inArray(params[key], ['develop', 'trial', 'release'])) {
31
+ if (key === 'version_type' && !(0, Utils_1.inArray)(params[key], ['develop', 'trial', 'release'])) {
32
32
  throw new Error('Invalid value of attribute "version_type".');
33
33
  }
34
34
  formatted.push({
@@ -23,7 +23,7 @@ class AppCodeClient extends BaseClient_1.default {
23
23
  */
24
24
  get(path, optional = {}) {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
- let params = Utils_1.merge({
26
+ let params = (0, Utils_1.merge)({
27
27
  path,
28
28
  }, optional);
29
29
  return yield this.getStream('wxa/getwxacode', params);
@@ -36,7 +36,7 @@ class AppCodeClient extends BaseClient_1.default {
36
36
  */
37
37
  getUnlimit(scene, optional = {}) {
38
38
  return __awaiter(this, void 0, void 0, function* () {
39
- let params = Utils_1.merge({
39
+ let params = (0, Utils_1.merge)({
40
40
  scene,
41
41
  }, optional);
42
42
  return yield this.getStream('wxa/getwxacodeunlimit', params);
@@ -21,6 +21,14 @@ import SoterClient from './Soter/SoterClient';
21
21
  import SubscribeMessageClient from './SubscribeMessage/SubscribeMessageClient';
22
22
  import RealtimeLogClient from './RealtimeLog/RealtimeLogClient';
23
23
  import SearchClient from './Search/SearchClient';
24
+ import ShopAccoutClient from './Shop/AccoutClient';
25
+ import ShopAftersaleClient from './Shop/AftersaleClient';
26
+ import ShopBasicClient from './Shop/BasicClient';
27
+ import ShopDeliveryClient from './Shop/DeliveryClient';
28
+ import ShopOrderClient from './Shop/OrderClient';
29
+ import ShopRegisterClient from './Shop/RegisterClient';
30
+ import ShopSpuClient from './Shop/SpuClient';
31
+ import ShortLinkClient from './ShortLink/ShortLinkClient';
24
32
  import MediaClient from '../BaseService/Media/MediaClient';
25
33
  import ContentSecurityClient from '../BaseService/ContentSecurity/ContentSecurityClient';
26
34
  import { EasyWechatConfig } from '../Core/Types';
@@ -53,6 +61,14 @@ export default class MiniProgram extends BaseApplication {
53
61
  subscribe_message: SubscribeMessageClient;
54
62
  realtime_log: RealtimeLogClient;
55
63
  search: SearchClient;
64
+ shop_account: ShopAccoutClient;
65
+ shop_aftersale: ShopAftersaleClient;
66
+ shop_basic: ShopBasicClient;
67
+ shop_delivery: ShopDeliveryClient;
68
+ shop_order: ShopOrderClient;
69
+ shop_register: ShopRegisterClient;
70
+ shop_spu: ShopSpuClient;
71
+ short_link: ShortLinkClient;
56
72
  media: MediaClient;
57
73
  content_security: ContentSecurityClient;
58
74
  url_link: UrlLinkClient;
@@ -35,6 +35,14 @@ const SoterClient_1 = __importDefault(require("./Soter/SoterClient"));
35
35
  const SubscribeMessageClient_1 = __importDefault(require("./SubscribeMessage/SubscribeMessageClient"));
36
36
  const RealtimeLogClient_1 = __importDefault(require("./RealtimeLog/RealtimeLogClient"));
37
37
  const SearchClient_1 = __importDefault(require("./Search/SearchClient"));
38
+ const AccoutClient_1 = __importDefault(require("./Shop/AccoutClient"));
39
+ const AftersaleClient_1 = __importDefault(require("./Shop/AftersaleClient"));
40
+ const BasicClient_1 = __importDefault(require("./Shop/BasicClient"));
41
+ const DeliveryClient_1 = __importDefault(require("./Shop/DeliveryClient"));
42
+ const OrderClient_1 = __importDefault(require("./Shop/OrderClient"));
43
+ const RegisterClient_1 = __importDefault(require("./Shop/RegisterClient"));
44
+ const SpuClient_1 = __importDefault(require("./Shop/SpuClient"));
45
+ const ShortLinkClient_1 = __importDefault(require("./ShortLink/ShortLinkClient"));
38
46
  const MediaClient_1 = __importDefault(require("../BaseService/Media/MediaClient"));
39
47
  const ContentSecurityClient_1 = __importDefault(require("../BaseService/ContentSecurity/ContentSecurityClient"));
40
48
  const UrlLinkClient_1 = __importDefault(require("./UrlLink/UrlLinkClient"));
@@ -68,6 +76,14 @@ class MiniProgram extends BaseApplication_1.default {
68
76
  this.subscribe_message = null;
69
77
  this.realtime_log = null;
70
78
  this.search = null;
79
+ this.shop_account = null;
80
+ this.shop_aftersale = null;
81
+ this.shop_basic = null;
82
+ this.shop_delivery = null;
83
+ this.shop_order = null;
84
+ this.shop_register = null;
85
+ this.shop_spu = null;
86
+ this.short_link = null;
71
87
  this.media = null;
72
88
  this.content_security = null;
73
89
  this.url_link = null;
@@ -163,6 +179,30 @@ class MiniProgram extends BaseApplication_1.default {
163
179
  this.offsetSet('search', function (app) {
164
180
  return new SearchClient_1.default(app);
165
181
  });
182
+ this.offsetSet('shop_account', function (app) {
183
+ return new AccoutClient_1.default(app);
184
+ });
185
+ this.offsetSet('shop_aftersale', function (app) {
186
+ return new AftersaleClient_1.default(app);
187
+ });
188
+ this.offsetSet('shop_basic', function (app) {
189
+ return new BasicClient_1.default(app);
190
+ });
191
+ this.offsetSet('shop_delivery', function (app) {
192
+ return new DeliveryClient_1.default(app);
193
+ });
194
+ this.offsetSet('shop_order', function (app) {
195
+ return new OrderClient_1.default(app);
196
+ });
197
+ this.offsetSet('shop_register', function (app) {
198
+ return new RegisterClient_1.default(app);
199
+ });
200
+ this.offsetSet('shop_spu', function (app) {
201
+ return new SpuClient_1.default(app);
202
+ });
203
+ this.offsetSet('short_link', function (app) {
204
+ return new ShortLinkClient_1.default(app);
205
+ });
166
206
  this.offsetSet('url_link', function (app) {
167
207
  return new UrlLinkClient_1.default(app);
168
208
  });
@@ -12,7 +12,7 @@ class MiniProgramBase extends BaseClient_1.default {
12
12
  * @param optional 参数。transaction_id:支付交易号;mch_id:商户id;out_trade_no:商家订单号
13
13
  */
14
14
  getPaidUnionid(openid, optional = {}) {
15
- let params = Utils_1.merge({
15
+ let params = (0, Utils_1.merge)({
16
16
  openid,
17
17
  }, optional);
18
18
  return this.httpGet('wxa/getpaidunionid', params);
@@ -11,7 +11,7 @@ class NearbyPoiClient extends BaseClient_1.default {
11
11
  * @param params 地点信息
12
12
  */
13
13
  add(params = {}) {
14
- params = Utils_1.merge({
14
+ params = (0, Utils_1.merge)({
15
15
  is_comm_nearby: '1',
16
16
  poi_id: '',
17
17
  }, params);
@@ -23,7 +23,7 @@ class NearbyPoiClient extends BaseClient_1.default {
23
23
  * @param params 地点信息
24
24
  */
25
25
  update(poiId, params = {}) {
26
- params = Utils_1.merge({
26
+ params = (0, Utils_1.merge)({
27
27
  is_comm_nearby: '1',
28
28
  poi_id: poiId,
29
29
  }, params);
@@ -55,7 +55,7 @@ class NearbyPoiClient extends BaseClient_1.default {
55
55
  * @param status 0:不展示;1:展示
56
56
  */
57
57
  setVisibility(poiId = '', status) {
58
- if (!Utils_1.inArray(status, [0, 1, '0', '1'])) {
58
+ if (!(0, Utils_1.inArray)(status, [0, 1, '0', '1'])) {
59
59
  throw new Error('status should be 0 or 1.');
60
60
  }
61
61
  return this.httpPostJson('wxa/setnearbypoishowstatus', {
@@ -17,7 +17,7 @@ class OpenDataClient extends BaseClient_1.default {
17
17
  let query = {
18
18
  openid: openid,
19
19
  sig_method: 'hmac_sha256',
20
- signature: Utils_1.createHmac(JSON.stringify(data), sessionKey, 'sha256'),
20
+ signature: (0, Utils_1.createHmac)(JSON.stringify(data), sessionKey, 'sha256'),
21
21
  };
22
22
  return this.httpPostJson('remove_user_storage', data, query);
23
23
  }
@@ -28,7 +28,7 @@ class OpenDataClient extends BaseClient_1.default {
28
28
  let query = {
29
29
  openid: openid,
30
30
  sig_method: 'hmac_sha256',
31
- signature: Utils_1.createHmac(JSON.stringify(data), sessionKey, 'sha256'),
31
+ signature: (0, Utils_1.createHmac)(JSON.stringify(data), sessionKey, 'sha256'),
32
32
  };
33
33
  return this.httpPostJson('set_user_storage', data, query);
34
34
  }
@@ -14,7 +14,7 @@ class RealtimeLogClient extends BaseClient_1.default {
14
14
  * @param options 其它参数
15
15
  */
16
16
  search(date, beginTime, endTime, options = {}) {
17
- let params = Utils_1.merge({
17
+ let params = (0, Utils_1.merge)({
18
18
  date: date,
19
19
  begintime: beginTime,
20
20
  endtime: endTime,
@@ -0,0 +1,25 @@
1
+ import BaseClient from '../../Core/BaseClient';
2
+ export default class AccountClient extends BaseClient {
3
+ /**
4
+ * 获取商家类目列表
5
+ * @returns
6
+ */
7
+ getCategoryList(): Promise<any>;
8
+ /**
9
+ * 获取商家品牌列表
10
+ * @returns
11
+ */
12
+ getBrandList(): Promise<any>;
13
+ /**
14
+ * 更新商家信息
15
+ * @param path 小程序path
16
+ * @param phone 客服联系方式
17
+ * @returns
18
+ */
19
+ updateInfo(path: string, phone: string): Promise<any>;
20
+ /**
21
+ * 获取商家信息
22
+ * @returns
23
+ */
24
+ getInfo(): Promise<any>;
25
+ }
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
7
+ class AccountClient extends BaseClient_1.default {
8
+ /**
9
+ * 获取商家类目列表
10
+ * @returns
11
+ */
12
+ getCategoryList() {
13
+ return this.httpPostJson('shop/account/get_category_list');
14
+ }
15
+ /**
16
+ * 获取商家品牌列表
17
+ * @returns
18
+ */
19
+ getBrandList() {
20
+ return this.httpPostJson('shop/account/get_brand_list');
21
+ }
22
+ /**
23
+ * 更新商家信息
24
+ * @param path 小程序path
25
+ * @param phone 客服联系方式
26
+ * @returns
27
+ */
28
+ updateInfo(path, phone) {
29
+ return this.httpPostJson('shop/account/update_info', {
30
+ service_agent_path: path,
31
+ service_agent_phone: phone,
32
+ });
33
+ }
34
+ /**
35
+ * 获取商家信息
36
+ * @returns
37
+ */
38
+ getInfo() {
39
+ return this.httpPostJson('shop/account/get_info');
40
+ }
41
+ }
42
+ exports.default = AccountClient;
@@ -0,0 +1,22 @@
1
+ import BaseClient from '../../Core/BaseClient';
2
+ export default class AftersaleClient extends BaseClient {
3
+ /**
4
+ * 创建售后
5
+ * @param aftersale 售后数据
6
+ * @returns
7
+ */
8
+ add(aftersale: object): Promise<any>;
9
+ /**
10
+ * 获取订单下售后单
11
+ * @param order 订单数据
12
+ * @returns
13
+ */
14
+ get(order: object): Promise<any>;
15
+ /**
16
+ * 更新售后
17
+ * @param order 订单数据
18
+ * @param aftersale 售后数据
19
+ * @returns
20
+ */
21
+ update(order: object, aftersale: object): Promise<any>;
22
+ }
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const BaseClient_1 = __importDefault(require("../../Core/BaseClient"));
7
+ const Utils_1 = require("../../Core/Utils");
8
+ class AftersaleClient extends BaseClient_1.default {
9
+ /**
10
+ * 创建售后
11
+ * @param aftersale 售后数据
12
+ * @returns
13
+ */
14
+ add(aftersale) {
15
+ return this.httpPostJson('shop/aftersale/add', aftersale);
16
+ }
17
+ /**
18
+ * 获取订单下售后单
19
+ * @param order 订单数据
20
+ * @returns
21
+ */
22
+ get(order) {
23
+ return this.httpPostJson('shop/aftersale/get', order);
24
+ }
25
+ /**
26
+ * 更新售后
27
+ * @param order 订单数据
28
+ * @param aftersale 售后数据
29
+ * @returns
30
+ */
31
+ update(order, aftersale) {
32
+ return this.httpPostJson('shop/aftersale/update', (0, Utils_1.merge)((0, Utils_1.merge)({}, order), aftersale));
33
+ }
34
+ }
35
+ exports.default = AftersaleClient;