node-easywechat 2.7.1 → 2.8.2
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/dist/BaseService/Jssdk/JssdkClient.js +5 -5
- package/dist/BaseService/Media/MediaClient.js +1 -1
- package/dist/Core/AES.d.ts +1 -1
- package/dist/Core/AES.js +4 -4
- package/dist/Core/BaseAccessToken.js +2 -2
- package/dist/Core/BaseApplication.js +4 -4
- package/dist/Core/BaseClient.js +2 -2
- package/dist/Core/Cache/FileCache.js +3 -3
- package/dist/Core/Encryptor.js +3 -3
- package/dist/Core/Http/Request.js +11 -11
- package/dist/Core/Http/StreamResponse.js +1 -1
- package/dist/Core/Messages/Media.js +2 -2
- package/dist/Core/Messages/Message.js +7 -9
- package/dist/Core/Mixins/HttpMixin.js +4 -4
- package/dist/Core/ServerGuard.d.ts +1 -0
- package/dist/Core/ServerGuard.js +8 -5
- package/dist/Core/Utils.js +18 -18
- package/dist/MicroMerchant/Application.js +1 -1
- package/dist/MicroMerchant/Base/MicroMerchantBase.js +6 -6
- package/dist/MicroMerchant/Certficates/CertficatesClient.js +1 -1
- package/dist/MicroMerchant/Core/BaseClient.js +8 -8
- package/dist/MicroMerchant/Media/MediaClient.js +1 -1
- package/dist/MicroMerchant/MerchantConfig/MerchantConfigClient.js +1 -1
- package/dist/MicroMerchant/Meterial/MeterialClient.js +4 -4
- package/dist/MicroMerchant/Withdraw/WithdrawClient.js +2 -2
- package/dist/MiniProgram/ActivityMessage/ActivityMessageClient.js +3 -3
- package/dist/MiniProgram/AppCode/AppCodeClient.js +2 -2
- package/dist/MiniProgram/Application.d.ts +6 -0
- package/dist/MiniProgram/Application.js +15 -0
- package/dist/MiniProgram/Base/MiniProgramBase.js +1 -1
- package/dist/MiniProgram/NearbyPoi/NearbyPoiClient.js +3 -3
- package/dist/MiniProgram/OpenData/OpenDataClient.js +2 -2
- package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.d.ts +10 -0
- package/dist/MiniProgram/PhoneNumber/PhoneNumberClient.js +20 -0
- package/dist/MiniProgram/RealtimeLog/RealtimeLogClient.js +1 -1
- package/dist/MiniProgram/ShortLink/ShortLinkClient.d.ts +11 -0
- package/dist/MiniProgram/ShortLink/ShortLinkClient.js +23 -0
- package/dist/MiniProgram/SubscribeMessage/SubscribeMessageClient.js +5 -5
- package/dist/MiniProgram/UniformMessage/UniformMessageClient.js +3 -3
- package/dist/MiniProgram/Union/UnionClient.d.ts +3 -0
- package/dist/MiniProgram/Union/UnionClient.js +9 -0
- package/dist/MiniProgram/UrlLink/UrlLinkClient.d.ts +9 -0
- package/dist/MiniProgram/UrlLink/UrlLinkClient.js +17 -0
- package/dist/OfficialAccount/Base/OfficialAccountBase.js +2 -2
- package/dist/OfficialAccount/Broadcasting/BroadcastingClient.js +2 -2
- package/dist/OfficialAccount/Broadcasting/MessageBuilder.js +1 -1
- package/dist/OfficialAccount/Card/Client.js +1 -1
- package/dist/OfficialAccount/Card/JssdkClient.js +2 -2
- package/dist/OfficialAccount/Card/MemberCardClient.js +1 -1
- package/dist/OfficialAccount/CustomerService/CustomerServiceClient.js +2 -2
- package/dist/OfficialAccount/CustomerService/Messenger.js +1 -1
- package/dist/OfficialAccount/DataCube/DataCubeClient.js +1 -1
- package/dist/OfficialAccount/Material/MaterialClient.js +2 -2
- package/dist/OfficialAccount/OCR/OCRClient.js +1 -1
- package/dist/OfficialAccount/Semantic/SemanticClient.js +1 -1
- package/dist/OfficialAccount/SubscribeMessage/SubscribeMessageClient.js +4 -4
- package/dist/OfficialAccount/TemplateMessage/TemplateMessageClient.js +4 -4
- package/dist/OpenPlatform/Application.js +7 -7
- package/dist/OpenPlatform/Authorizer/Auth/AccessToken.js +1 -1
- package/dist/OpenPlatform/Authorizer/OfficialAccount/Account/Client.js +1 -1
- package/dist/Payment/Application.js +4 -4
- package/dist/Payment/Bill/BillClient.js +2 -2
- package/dist/Payment/Core/BaseClient.js +8 -8
- package/dist/Payment/Jssdk/JssdkClient.d.ts +12 -0
- package/dist/Payment/Jssdk/JssdkClient.js +41 -9
- package/dist/Payment/Merchant/MerchantClient.js +1 -1
- package/dist/Payment/Notify/Handler.js +5 -5
- package/dist/Payment/Notify/Refunded.js +1 -1
- package/dist/Payment/Notify/Scanned.js +2 -2
- package/dist/Payment/Order/OrderClient.js +1 -1
- package/dist/Payment/Redpack/RedpackClient.js +5 -5
- package/dist/Payment/Refund/RefundClient.js +3 -3
- package/dist/Payment/Sandbox/SandboxClient.js +1 -1
- package/dist/Payment/Transfer/TransferClient.js +1 -1
- package/dist/Work/Agent/AgentClient.js +1 -1
- package/dist/Work/Agent/WorkbenchClient.d.ts +24 -0
- package/dist/Work/Agent/WorkbenchClient.js +39 -0
- package/dist/Work/Application.d.ts +8 -0
- package/dist/Work/Application.js +20 -0
- package/dist/Work/Calendar/CalendarClient.js +1 -1
- package/dist/Work/Chat/ChatClient.js +1 -1
- package/dist/Work/CorpGroup/CorpGroupClient.d.ts +34 -0
- package/dist/Work/CorpGroup/CorpGroupClient.js +42 -0
- package/dist/Work/Department/DepartmentClient.js +1 -1
- package/dist/Work/ExternalContact/Client.d.ts +202 -3
- package/dist/Work/ExternalContact/Client.js +244 -6
- package/dist/Work/ExternalContact/ContactWayClient.d.ts +37 -0
- package/dist/Work/ExternalContact/ContactWayClient.js +51 -2
- package/dist/Work/ExternalContact/MessageClient.d.ts +45 -0
- package/dist/Work/ExternalContact/MessageClient.js +90 -4
- package/dist/Work/ExternalContact/MessageTemplateClient.js +3 -3
- package/dist/Work/ExternalContact/MomentClient.d.ts +56 -3
- package/dist/Work/ExternalContact/MomentClient.js +62 -3
- package/dist/Work/ExternalContact/StatisticsClient.d.ts +24 -0
- package/dist/Work/ExternalContact/StatisticsClient.js +35 -0
- package/dist/Work/Jssdk/JssdkClient.js +3 -3
- package/dist/Work/Kf/KfAccountClient.d.ts +41 -0
- package/dist/Work/Kf/KfAccountClient.js +71 -0
- package/dist/Work/Kf/KfMessageClient.d.ts +44 -0
- package/dist/Work/Kf/KfMessageClient.js +73 -0
- package/dist/Work/Kf/KfServicerClient.d.ts +26 -0
- package/dist/Work/Kf/KfServicerClient.js +47 -0
- package/dist/Work/Media/MediaClient.js +1 -1
- package/dist/Work/Message/Messenger.js +2 -2
- package/dist/Work/Schedule/ScheduleClient.js +1 -1
- package/dist/Work/User/UserClient.js +3 -3
- package/dist/index.js +1 -1
- package/node-easywechat.file_cache.easywechat.kernel.access_token.8a9684b45da7de42a06a70ba01a7005a.cache +1 -1
- package/node-easywechat.file_cache.easywechat.kernel.access_token.c3d06edaf326aad75d32f31348df787a.cache +1 -1
- package/package.json +11 -11
|
@@ -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);
|
|
@@ -10,6 +10,7 @@ import CustomerServiceClient from '../OfficialAccount/CustomerService/CustomerSe
|
|
|
10
10
|
import UniformMessageClient from './UniformMessage/UniformMessageClient';
|
|
11
11
|
import ActivityMessageClient from './ActivityMessage/ActivityMessageClient';
|
|
12
12
|
import OpenDataClient from './OpenData/OpenDataClient';
|
|
13
|
+
import PhoneNumberClient from './PhoneNumber/PhoneNumberClient';
|
|
13
14
|
import PluginClient from './Plugin/PluginClient';
|
|
14
15
|
import PluginDevClient from './Plugin/PluginDevClient';
|
|
15
16
|
import MiniProgramBase from './Base/MiniProgramBase';
|
|
@@ -20,9 +21,11 @@ import SoterClient from './Soter/SoterClient';
|
|
|
20
21
|
import SubscribeMessageClient from './SubscribeMessage/SubscribeMessageClient';
|
|
21
22
|
import RealtimeLogClient from './RealtimeLog/RealtimeLogClient';
|
|
22
23
|
import SearchClient from './Search/SearchClient';
|
|
24
|
+
import ShortLinkClient from './ShortLink/ShortLinkClient';
|
|
23
25
|
import MediaClient from '../BaseService/Media/MediaClient';
|
|
24
26
|
import ContentSecurityClient from '../BaseService/ContentSecurity/ContentSecurityClient';
|
|
25
27
|
import { EasyWechatConfig } from '../Core/Types';
|
|
28
|
+
import UrlLinkClient from './UrlLink/UrlLinkClient';
|
|
26
29
|
import UrlSchemeClient from './UrlScheme/UrlSchemeClient';
|
|
27
30
|
import RiskControlClient from './RiskControl/RiskControlClient';
|
|
28
31
|
import LiveClient from './Live/LiveClient';
|
|
@@ -40,6 +43,7 @@ export default class MiniProgram extends BaseApplication {
|
|
|
40
43
|
uniform_message: UniformMessageClient;
|
|
41
44
|
activity_message: ActivityMessageClient;
|
|
42
45
|
open_data: OpenDataClient;
|
|
46
|
+
phone_number: PhoneNumberClient;
|
|
43
47
|
plugin: PluginClient;
|
|
44
48
|
plugin_dev: PluginDevClient;
|
|
45
49
|
base: MiniProgramBase;
|
|
@@ -50,8 +54,10 @@ export default class MiniProgram extends BaseApplication {
|
|
|
50
54
|
subscribe_message: SubscribeMessageClient;
|
|
51
55
|
realtime_log: RealtimeLogClient;
|
|
52
56
|
search: SearchClient;
|
|
57
|
+
short_link: ShortLinkClient;
|
|
53
58
|
media: MediaClient;
|
|
54
59
|
content_security: ContentSecurityClient;
|
|
60
|
+
url_link: UrlLinkClient;
|
|
55
61
|
url_scheme: UrlSchemeClient;
|
|
56
62
|
risk_control: RiskControlClient;
|
|
57
63
|
live: LiveClient;
|
|
@@ -24,6 +24,7 @@ const CustomerServiceClient_1 = __importDefault(require("../OfficialAccount/Cust
|
|
|
24
24
|
const UniformMessageClient_1 = __importDefault(require("./UniformMessage/UniformMessageClient"));
|
|
25
25
|
const ActivityMessageClient_1 = __importDefault(require("./ActivityMessage/ActivityMessageClient"));
|
|
26
26
|
const OpenDataClient_1 = __importDefault(require("./OpenData/OpenDataClient"));
|
|
27
|
+
const PhoneNumberClient_1 = __importDefault(require("./PhoneNumber/PhoneNumberClient"));
|
|
27
28
|
const PluginClient_1 = __importDefault(require("./Plugin/PluginClient"));
|
|
28
29
|
const PluginDevClient_1 = __importDefault(require("./Plugin/PluginDevClient"));
|
|
29
30
|
const MiniProgramBase_1 = __importDefault(require("./Base/MiniProgramBase"));
|
|
@@ -34,8 +35,10 @@ const SoterClient_1 = __importDefault(require("./Soter/SoterClient"));
|
|
|
34
35
|
const SubscribeMessageClient_1 = __importDefault(require("./SubscribeMessage/SubscribeMessageClient"));
|
|
35
36
|
const RealtimeLogClient_1 = __importDefault(require("./RealtimeLog/RealtimeLogClient"));
|
|
36
37
|
const SearchClient_1 = __importDefault(require("./Search/SearchClient"));
|
|
38
|
+
const ShortLinkClient_1 = __importDefault(require("./ShortLink/ShortLinkClient"));
|
|
37
39
|
const MediaClient_1 = __importDefault(require("../BaseService/Media/MediaClient"));
|
|
38
40
|
const ContentSecurityClient_1 = __importDefault(require("../BaseService/ContentSecurity/ContentSecurityClient"));
|
|
41
|
+
const UrlLinkClient_1 = __importDefault(require("./UrlLink/UrlLinkClient"));
|
|
39
42
|
const UrlSchemeClient_1 = __importDefault(require("./UrlScheme/UrlSchemeClient"));
|
|
40
43
|
const RiskControlClient_1 = __importDefault(require("./RiskControl/RiskControlClient"));
|
|
41
44
|
const LiveClient_1 = __importDefault(require("./Live/LiveClient"));
|
|
@@ -55,6 +58,7 @@ class MiniProgram extends BaseApplication_1.default {
|
|
|
55
58
|
this.uniform_message = null;
|
|
56
59
|
this.activity_message = null;
|
|
57
60
|
this.open_data = null;
|
|
61
|
+
this.phone_number = null;
|
|
58
62
|
this.plugin = null;
|
|
59
63
|
this.plugin_dev = null;
|
|
60
64
|
this.base = null;
|
|
@@ -65,8 +69,10 @@ class MiniProgram extends BaseApplication_1.default {
|
|
|
65
69
|
this.subscribe_message = null;
|
|
66
70
|
this.realtime_log = null;
|
|
67
71
|
this.search = null;
|
|
72
|
+
this.short_link = null;
|
|
68
73
|
this.media = null;
|
|
69
74
|
this.content_security = null;
|
|
75
|
+
this.url_link = null;
|
|
70
76
|
this.url_scheme = null;
|
|
71
77
|
this.risk_control = null;
|
|
72
78
|
this.live = null;
|
|
@@ -126,6 +132,9 @@ class MiniProgram extends BaseApplication_1.default {
|
|
|
126
132
|
this.offsetSet('open_data', function (app) {
|
|
127
133
|
return new OpenDataClient_1.default(app);
|
|
128
134
|
});
|
|
135
|
+
this.offsetSet('phone_number', function (app) {
|
|
136
|
+
return new PhoneNumberClient_1.default(app);
|
|
137
|
+
});
|
|
129
138
|
this.offsetSet('plugin', function (app) {
|
|
130
139
|
return new PluginClient_1.default(app);
|
|
131
140
|
});
|
|
@@ -156,6 +165,12 @@ class MiniProgram extends BaseApplication_1.default {
|
|
|
156
165
|
this.offsetSet('search', function (app) {
|
|
157
166
|
return new SearchClient_1.default(app);
|
|
158
167
|
});
|
|
168
|
+
this.offsetSet('short_link', function (app) {
|
|
169
|
+
return new ShortLinkClient_1.default(app);
|
|
170
|
+
});
|
|
171
|
+
this.offsetSet('url_link', function (app) {
|
|
172
|
+
return new UrlLinkClient_1.default(app);
|
|
173
|
+
});
|
|
159
174
|
this.offsetSet('url_scheme', function (app) {
|
|
160
175
|
return new UrlSchemeClient_1.default(app);
|
|
161
176
|
});
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class PhoneNumber extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 获取用户手机号
|
|
5
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/phonenumber/phonenumber.getPhoneNumber.html
|
|
6
|
+
* @param code [前端获取code方法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html)
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
getUserPhoneNumber(code: string): Promise<any>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 PhoneNumber extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 获取用户手机号
|
|
10
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/phonenumber/phonenumber.getPhoneNumber.html
|
|
11
|
+
* @param code [前端获取code方法](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html)
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
getUserPhoneNumber(code) {
|
|
15
|
+
return this.httpPostJson('wxa/business/getuserphonenumber', {
|
|
16
|
+
code
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = PhoneNumber;
|
|
@@ -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,11 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class ShortLinkClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 获取小程序 Short Link
|
|
5
|
+
* @param pageUrl
|
|
6
|
+
* @param pageTitle
|
|
7
|
+
* @param isPermanent
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
getShortLink(pageUrl: string, pageTitle: string, isPermanent?: boolean): Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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 ShortLinkClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 获取小程序 Short Link
|
|
10
|
+
* @param pageUrl
|
|
11
|
+
* @param pageTitle
|
|
12
|
+
* @param isPermanent
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
getShortLink(pageUrl, pageTitle, isPermanent = false) {
|
|
16
|
+
return this.httpPostJson('wxa/genwxashortlink', {
|
|
17
|
+
page_url: pageUrl,
|
|
18
|
+
page_title: pageTitle,
|
|
19
|
+
is_permanent: isPermanent,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.default = ShortLinkClient;
|
|
@@ -26,9 +26,9 @@ class SubscribeMessageClient extends BaseClient_1.default {
|
|
|
26
26
|
return this.httpPostJson('cgi-bin/message/subscribe/send', params);
|
|
27
27
|
}
|
|
28
28
|
formatMessage(data) {
|
|
29
|
-
let params = Utils_1.merge(Utils_1.merge({}, this.message), data);
|
|
29
|
+
let params = (0, Utils_1.merge)((0, Utils_1.merge)({}, this.message), data);
|
|
30
30
|
for (let key in params) {
|
|
31
|
-
if (Utils_1.inArray(key, this.required) && !params[key]) {
|
|
31
|
+
if ((0, Utils_1.inArray)(key, this.required) && !params[key]) {
|
|
32
32
|
throw new Error(`Attribute "${key}" can not be empty!`);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -39,13 +39,13 @@ class SubscribeMessageClient extends BaseClient_1.default {
|
|
|
39
39
|
let formatted = {}, value;
|
|
40
40
|
for (let key in data) {
|
|
41
41
|
value = {};
|
|
42
|
-
if (Utils_1.isArray(data[key]) && data[key].length == 2) {
|
|
42
|
+
if ((0, Utils_1.isArray)(data[key]) && data[key].length == 2) {
|
|
43
43
|
value = {
|
|
44
44
|
value: data[key][0],
|
|
45
45
|
color: data[key][1],
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
else if (Utils_1.isObject(data[key]) && data[key]['value']) {
|
|
48
|
+
else if ((0, Utils_1.isObject)(data[key]) && data[key]['value']) {
|
|
49
49
|
value = data[key];
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
@@ -101,7 +101,7 @@ class SubscribeMessageClient extends BaseClient_1.default {
|
|
|
101
101
|
start,
|
|
102
102
|
limit,
|
|
103
103
|
};
|
|
104
|
-
if (Utils_1.isArray(ids)) {
|
|
104
|
+
if ((0, Utils_1.isArray)(ids)) {
|
|
105
105
|
query.ids = ids.join(',');
|
|
106
106
|
}
|
|
107
107
|
return this.httpGet('wxaapi/newtmpl/getpubtemplatetitles', query);
|
|
@@ -29,7 +29,7 @@ class UniformMessageClient extends TemplateMessageClient_1.default {
|
|
|
29
29
|
this.required = ['touser', 'template_id', 'form_id', 'miniprogram', 'appid'];
|
|
30
30
|
}
|
|
31
31
|
formatMessage(data) {
|
|
32
|
-
let params = Utils_1.merge(Utils_1.merge({}, this.message), data);
|
|
32
|
+
let params = (0, Utils_1.merge)((0, Utils_1.merge)({}, this.message), data);
|
|
33
33
|
if (!params['touser']) {
|
|
34
34
|
throw new Error('Attribute "touser" can not be empty!');
|
|
35
35
|
}
|
|
@@ -55,9 +55,9 @@ class UniformMessageClient extends TemplateMessageClient_1.default {
|
|
|
55
55
|
return params;
|
|
56
56
|
}
|
|
57
57
|
baseFormat(data = {}, defaultData = {}) {
|
|
58
|
-
let params = Utils_1.merge(Utils_1.merge({}, defaultData), data);
|
|
58
|
+
let params = (0, Utils_1.merge)((0, Utils_1.merge)({}, defaultData), data);
|
|
59
59
|
for (let key in params) {
|
|
60
|
-
if (Utils_1.inArray(key, this.required) && !params[key] && !defaultData[key]) {
|
|
60
|
+
if ((0, Utils_1.inArray)(key, this.required) && !params[key] && !defaultData[key]) {
|
|
61
61
|
throw new Error(`Attribute "${key}" can not be empty!`);
|
|
62
62
|
}
|
|
63
63
|
params[key] = params[key] || defaultData[key];
|
|
@@ -10,4 +10,7 @@ export default class UnionClient extends BaseClient {
|
|
|
10
10
|
getOrderInfo(orderIdList: string[]): Promise<any>;
|
|
11
11
|
searchOrder(page?: number, startTimestamp?: string, endTimestamp?: string, commissionStatus?: string): Promise<any>;
|
|
12
12
|
getFeaturedProducts(params: object): Promise<any>;
|
|
13
|
+
getTargetPlanInfo(params: object): Promise<any>;
|
|
14
|
+
applyJoinTargetPlan(params: object): Promise<any>;
|
|
15
|
+
getTargetPlanStatus(params: object): Promise<any>;
|
|
13
16
|
}
|
|
@@ -56,5 +56,14 @@ class UnionClient extends BaseClient_1.default {
|
|
|
56
56
|
getFeaturedProducts(params) {
|
|
57
57
|
return this.httpGet('union/promoter/product/select', params);
|
|
58
58
|
}
|
|
59
|
+
getTargetPlanInfo(params) {
|
|
60
|
+
return this.httpGet('union/promoter/target/plan_info', params);
|
|
61
|
+
}
|
|
62
|
+
applyJoinTargetPlan(params) {
|
|
63
|
+
return this.httpPostJson('union/promoter/target/apply_target', params);
|
|
64
|
+
}
|
|
65
|
+
getTargetPlanStatus(params) {
|
|
66
|
+
return this.httpGet('union/promoter/target/apply_status', params);
|
|
67
|
+
}
|
|
59
68
|
}
|
|
60
69
|
exports.default = UnionClient;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 UrlLinkClient extends BaseClient_1.default {
|
|
8
|
+
/**
|
|
9
|
+
* 获取小程序 URL Link
|
|
10
|
+
* @param params
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
generate(params = {}) {
|
|
14
|
+
return this.httpPostJson('wxa/generate_urllink', params);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = UrlLinkClient;
|
|
@@ -22,11 +22,11 @@ class OfficialAccountBase extends BaseClient_1.default {
|
|
|
22
22
|
return this.httpGet('cgi-bin/getcallbackip');
|
|
23
23
|
}
|
|
24
24
|
checkCallbackUrl(action = 'all', operator = 'DEFAULT') {
|
|
25
|
-
if (!Utils_1.inArray(action, ['dns', 'ping', 'all'], true)) {
|
|
25
|
+
if (!(0, Utils_1.inArray)(action, ['dns', 'ping', 'all'], true)) {
|
|
26
26
|
throw new Error('The action must be dns, ping, all.');
|
|
27
27
|
}
|
|
28
28
|
operator = operator.toUpperCase();
|
|
29
|
-
if (!Utils_1.inArray(operator, ['CHINANET', 'UNICOM', 'CAP', 'DEFAULT'], true)) {
|
|
29
|
+
if (!(0, Utils_1.inArray)(operator, ['CHINANET', 'UNICOM', 'CAP', 'DEFAULT'], true)) {
|
|
30
30
|
throw new Error('The operator must be CHINANET, UNICOM, CAP, DEFAULT.');
|
|
31
31
|
}
|
|
32
32
|
return this.httpPostJson('cgi-bin/callback/check', {
|
|
@@ -49,10 +49,10 @@ class BroadcastingClient extends BaseClient_1.default {
|
|
|
49
49
|
*/
|
|
50
50
|
sendMessage(message, reception = null, attributes = {}) {
|
|
51
51
|
let msg = (new MessageBuilder_1.default).message(message).with(attributes).toAll();
|
|
52
|
-
if (Utils_1.isNumber(reception) && reception > 0) {
|
|
52
|
+
if ((0, Utils_1.isNumber)(reception) && reception > 0) {
|
|
53
53
|
msg.toTag(reception);
|
|
54
54
|
}
|
|
55
|
-
else if (Utils_1.isArray(reception)) {
|
|
55
|
+
else if ((0, Utils_1.isArray)(reception)) {
|
|
56
56
|
msg.toUsers(reception);
|
|
57
57
|
}
|
|
58
58
|
return this.send(msg.build());
|
|
@@ -50,7 +50,7 @@ class MessageBuilder {
|
|
|
50
50
|
if (!prepends) {
|
|
51
51
|
prepends = this._to;
|
|
52
52
|
}
|
|
53
|
-
let message = Utils_1.merge(Utils_1.merge(Utils_1.merge({}, prepends), content), this._attributes);
|
|
53
|
+
let message = (0, Utils_1.merge)((0, Utils_1.merge)((0, Utils_1.merge)({}, prepends), content), this._attributes);
|
|
54
54
|
return message;
|
|
55
55
|
}
|
|
56
56
|
buildForPreview(by, user) {
|
|
@@ -114,7 +114,7 @@ class Client extends BaseClient_1.default {
|
|
|
114
114
|
status: res.getStatusCode(),
|
|
115
115
|
headers: res.getHeaders(),
|
|
116
116
|
body: res.getContent(),
|
|
117
|
-
url: baseUrl + '?' + Utils_1.buildQueryString(params),
|
|
117
|
+
url: baseUrl + '?' + (0, Utils_1.buildQueryString)(params),
|
|
118
118
|
};
|
|
119
119
|
});
|
|
120
120
|
}
|
|
@@ -43,8 +43,8 @@ class JssdkClient extends JssdkClient_1.default {
|
|
|
43
43
|
}
|
|
44
44
|
attachExtension(cardId, extension = {}) {
|
|
45
45
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
let timestamp = Utils_1.getTimestamp();
|
|
47
|
-
let nonce_str = Utils_1.randomString(6);
|
|
46
|
+
let timestamp = (0, Utils_1.getTimestamp)();
|
|
47
|
+
let nonce_str = (0, Utils_1.randomString)(6);
|
|
48
48
|
let ticket = yield this.getTicket()['ticket'];
|
|
49
49
|
let ext = {
|
|
50
50
|
timestamp,
|
|
@@ -19,7 +19,7 @@ class MemberCardClient extends Client_1.default {
|
|
|
19
19
|
* @param settings 会员卡激活时的选项
|
|
20
20
|
*/
|
|
21
21
|
setActivationForm(cardId, settings) {
|
|
22
|
-
let params = Utils_1.merge({
|
|
22
|
+
let params = (0, Utils_1.merge)({
|
|
23
23
|
card_id: cardId,
|
|
24
24
|
}, settings);
|
|
25
25
|
return this.httpPostJson('card/membercard/activateuserform/set', params);
|
|
@@ -68,8 +68,8 @@ class CustomerServiceClient extends BaseClient_1.default {
|
|
|
68
68
|
}
|
|
69
69
|
messages(startTime, endTime, msgId = 1, number = 10000) {
|
|
70
70
|
return this.httpPostJson('customservice/msgrecord/getmsglist', {
|
|
71
|
-
starttime: Utils_1.getTimestamp(startTime),
|
|
72
|
-
endtime: Utils_1.getTimestamp(endTime),
|
|
71
|
+
starttime: (0, Utils_1.getTimestamp)(startTime),
|
|
72
|
+
endtime: (0, Utils_1.getTimestamp)(endTime),
|
|
73
73
|
msgid: msgId,
|
|
74
74
|
number: number,
|
|
75
75
|
});
|
|
@@ -193,7 +193,7 @@ class DataCubeClient extends BaseClient_1.default {
|
|
|
193
193
|
return this.query('datacube/getcardmembercarddetail', from, to, ext);
|
|
194
194
|
}
|
|
195
195
|
query(api, from, to, ext = {}) {
|
|
196
|
-
let params = Utils_1.merge({
|
|
196
|
+
let params = (0, Utils_1.merge)({
|
|
197
197
|
begin_date: from,
|
|
198
198
|
end_date: to,
|
|
199
199
|
}, ext);
|
|
@@ -70,10 +70,10 @@ class MaterialClient extends BaseClient_1.default {
|
|
|
70
70
|
if (!file) {
|
|
71
71
|
throw new Error(`File does not exist, or the file is unreadable: '${file}'`);
|
|
72
72
|
}
|
|
73
|
-
if (Utils_1.isString(file)) {
|
|
73
|
+
if ((0, Utils_1.isString)(file)) {
|
|
74
74
|
file = fs_1.default.createReadStream(file);
|
|
75
75
|
}
|
|
76
|
-
if (!Utils_1.inArray(type, this.allowTypes)) {
|
|
76
|
+
if (!(0, Utils_1.inArray)(type, this.allowTypes)) {
|
|
77
77
|
throw new Error(`Unsupported media type: '${type}'`);
|
|
78
78
|
}
|
|
79
79
|
let formData = new form_data_1.default();
|
|
@@ -19,7 +19,7 @@ class OCRClient extends BaseClient_1.default {
|
|
|
19
19
|
* @param type
|
|
20
20
|
*/
|
|
21
21
|
idCard(img_url, type = 'photo') {
|
|
22
|
-
if (!Utils_1.inArray(type, this.allowTypes, true)) {
|
|
22
|
+
if (!(0, Utils_1.inArray)(type, this.allowTypes, true)) {
|
|
23
23
|
throw new Error(`Unsupported type: '${type}'`);
|
|
24
24
|
}
|
|
25
25
|
return this.httpPost('cv/ocr/idcard', {
|