node-easywechat 2.8.3 → 2.9.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/README.md +51 -6
- package/dist/Core/Http/Request.js +2 -2
- package/dist/Core/ServerGuard.d.ts +2 -2
- package/dist/Core/Types.d.ts +34 -4
- package/dist/MiniProgram/Express/ExpressClient.d.ts +18 -0
- package/dist/MiniProgram/Express/ExpressClient.js +33 -0
- package/dist/MiniProgram/Shop/OrderClient.d.ts +7 -0
- package/dist/MiniProgram/Shop/OrderClient.js +9 -0
- package/dist/OfficialAccount/Base/OfficialAccountBase.d.ts +5 -0
- package/dist/OfficialAccount/Base/OfficialAccountBase.js +9 -0
- package/dist/OpenPlatform/Application.js +2 -2
- package/dist/OpenWork/Application.d.ts +37 -0
- package/dist/OpenWork/Application.js +128 -0
- package/dist/OpenWork/Auth/ProviderAccessToken.d.ts +8 -0
- package/dist/OpenWork/Auth/ProviderAccessToken.js +33 -0
- package/dist/OpenWork/Auth/SuiteAccessToken.d.ts +8 -0
- package/dist/OpenWork/Auth/SuiteAccessToken.js +34 -0
- package/dist/OpenWork/Auth/SuiteTicket.d.ts +8 -0
- package/dist/OpenWork/Auth/SuiteTicket.js +40 -0
- package/dist/OpenWork/Corp/CorpClient.d.ts +72 -0
- package/dist/OpenWork/Corp/CorpClient.js +150 -0
- package/dist/OpenWork/MiniProgram/MiniProgramClient.d.ts +5 -0
- package/dist/OpenWork/MiniProgram/MiniProgramClient.js +18 -0
- package/dist/OpenWork/Provider/ProviderClient.d.ts +81 -0
- package/dist/OpenWork/Provider/ProviderClient.js +172 -0
- package/dist/OpenWork/Server/OpenWorkGuard.d.ts +13 -0
- package/dist/OpenWork/Server/OpenWorkGuard.js +51 -0
- package/dist/OpenWork/Work/Application.d.ts +5 -0
- package/dist/OpenWork/Work/Application.js +22 -0
- package/dist/OpenWork/Work/Auth/AccessToken.d.ts +12 -0
- package/dist/OpenWork/Work/Auth/AccessToken.js +44 -0
- package/dist/Work/Application.d.ts +2 -0
- package/dist/Work/Application.js +5 -0
- package/dist/Work/ExternalContact/GroupChatWayClient.d.ts +32 -0
- package/dist/Work/ExternalContact/GroupChatWayClient.js +54 -0
- package/dist/Work/Server/Guard.d.ts +1 -1
- package/dist/index.d.ts +8 -2
- package/dist/index.js +8 -6
- package/package.json +2 -5
- package/node-easywechat.file_cache.easywechat.kernel.access_token.8a9684b45da7de42a06a70ba01a7005a.cache +0 -1
- package/node-easywechat.file_cache.easywechat.kernel.access_token.c3d06edaf326aad75d32f31348df787a.cache +0 -1
package/dist/Work/Application.js
CHANGED
|
@@ -42,6 +42,7 @@ const FinallResult_1 = __importDefault(require("../Core/Decorators/FinallResult"
|
|
|
42
42
|
const Application_1 = __importDefault(require("./MiniProgram/Application"));
|
|
43
43
|
const Client_1 = __importDefault(require("./ExternalContact/Client"));
|
|
44
44
|
const ContactWayClient_1 = __importDefault(require("./ExternalContact/ContactWayClient"));
|
|
45
|
+
const GroupChatWayClient_1 = __importDefault(require("./ExternalContact/GroupChatWayClient"));
|
|
45
46
|
const StatisticsClient_1 = __importDefault(require("./ExternalContact/StatisticsClient"));
|
|
46
47
|
const MessageClient_2 = __importDefault(require("./ExternalContact/MessageClient"));
|
|
47
48
|
const MessageTemplateClient_1 = __importDefault(require("./ExternalContact/MessageTemplateClient"));
|
|
@@ -68,6 +69,7 @@ class Work extends BaseApplication_1.default {
|
|
|
68
69
|
this.department = null;
|
|
69
70
|
this.external_contact = null;
|
|
70
71
|
this.contact_way = null;
|
|
72
|
+
this.group_chat_way = null;
|
|
71
73
|
this.external_contact_statistics = null;
|
|
72
74
|
this.external_contact_message = null;
|
|
73
75
|
this.external_contact_message_template = null;
|
|
@@ -130,6 +132,9 @@ class Work extends BaseApplication_1.default {
|
|
|
130
132
|
this.offsetSet('contact_way', function (app) {
|
|
131
133
|
return new ContactWayClient_1.default(app);
|
|
132
134
|
});
|
|
135
|
+
this.offsetSet('group_chat_way', function (app) {
|
|
136
|
+
return new GroupChatWayClient_1.default(app);
|
|
137
|
+
});
|
|
133
138
|
this.offsetSet('external_contact_statistics', function (app) {
|
|
134
139
|
return new StatisticsClient_1.default(app);
|
|
135
140
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import BaseClient from '../../Core/BaseClient';
|
|
2
|
+
export default class GroupChatWayClient extends BaseClient {
|
|
3
|
+
/**
|
|
4
|
+
* 配置客户群进群方式
|
|
5
|
+
* @see https://developer.work.weixin.qq.com/document/path/92229#%E9%85%8D%E7%BD%AE%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F
|
|
6
|
+
* @param params
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
create(params: object): Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* 获取客户群进群方式配置
|
|
12
|
+
* @see https://developer.work.weixin.qq.com/document/path/92229#%E8%8E%B7%E5%8F%96%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
|
|
13
|
+
* @param configId
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
get(configId: string): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* 更新客户群进群方式配置
|
|
19
|
+
* @see https://developer.work.weixin.qq.com/document/path/92229#%E6%9B%B4%E6%96%B0%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
|
|
20
|
+
* @param configId
|
|
21
|
+
* @param config
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
update(configId: string, config: object): Promise<any>;
|
|
25
|
+
/**
|
|
26
|
+
* 删除客户群进群方式配置
|
|
27
|
+
* @see https://developer.work.weixin.qq.com/document/path/92229#%E5%88%A0%E9%99%A4%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
|
|
28
|
+
* @param configId
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
delete(configId: string): Promise<any>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 GroupChatWayClient extends BaseClient_1.default {
|
|
9
|
+
/**
|
|
10
|
+
* 配置客户群进群方式
|
|
11
|
+
* @see https://developer.work.weixin.qq.com/document/path/92229#%E9%85%8D%E7%BD%AE%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F
|
|
12
|
+
* @param params
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
create(params) {
|
|
16
|
+
return this.httpPostJson('cgi-bin/externalcontact/groupchat/add_join_way', params);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 获取客户群进群方式配置
|
|
20
|
+
* @see https://developer.work.weixin.qq.com/document/path/92229#%E8%8E%B7%E5%8F%96%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
|
|
21
|
+
* @param configId
|
|
22
|
+
* @returns
|
|
23
|
+
*/
|
|
24
|
+
get(configId) {
|
|
25
|
+
return this.httpGet('cgi-bin/externalcontact/groupchat/get_join_way', {
|
|
26
|
+
config_id: configId,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 更新客户群进群方式配置
|
|
31
|
+
* @see https://developer.work.weixin.qq.com/document/path/92229#%E6%9B%B4%E6%96%B0%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
|
|
32
|
+
* @param configId
|
|
33
|
+
* @param config
|
|
34
|
+
* @returns
|
|
35
|
+
*/
|
|
36
|
+
update(configId, config) {
|
|
37
|
+
let params = (0, Utils_1.merge)({
|
|
38
|
+
config_id: configId,
|
|
39
|
+
}, config);
|
|
40
|
+
return this.httpPostJson('cgi-bin/externalcontact/groupchat/update_join_way', params);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 删除客户群进群方式配置
|
|
44
|
+
* @see https://developer.work.weixin.qq.com/document/path/92229#%E5%88%A0%E9%99%A4%E5%AE%A2%E6%88%B7%E7%BE%A4%E8%BF%9B%E7%BE%A4%E6%96%B9%E5%BC%8F%E9%85%8D%E7%BD%AE
|
|
45
|
+
* @param configId
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
delete(configId) {
|
|
49
|
+
return this.httpGet('cgi-bin/externalcontact/groupchat/del_join_way', {
|
|
50
|
+
config_id: configId,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.default = GroupChatWayClient;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ServerGuard from '../../Core/ServerGuard';
|
|
2
2
|
export default class Guard extends ServerGuard {
|
|
3
|
-
|
|
3
|
+
validate(): Promise<this>;
|
|
4
4
|
protected isSafeMode(): Promise<boolean>;
|
|
5
5
|
protected shouldReturnRawResponse(): Promise<boolean>;
|
|
6
6
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import OfficialAccount from './OfficialAccount/Application';
|
|
|
2
2
|
import BaseService from './BaseService/Application';
|
|
3
3
|
import MiniProgram from './MiniProgram/Application';
|
|
4
4
|
import OpenPlatform from './OpenPlatform/Application';
|
|
5
|
+
import OpenWork from './OpenWork/Application';
|
|
5
6
|
import Payment from './Payment/Application';
|
|
6
7
|
import Work from './Work/Application';
|
|
7
8
|
import MicroMerchant from './MicroMerchant/Application';
|
|
@@ -15,13 +16,14 @@ import * as Messages from './Core/Messages';
|
|
|
15
16
|
import { EasyWechatConfig } from './Core/Types';
|
|
16
17
|
/**
|
|
17
18
|
* 通用获取实例方法
|
|
18
|
-
* @param service 服务名称,可选值:'BaseService' | 'OfficialAccount' | 'MiniProgram' | 'OpenPlatform' | 'Payment'
|
|
19
|
+
* @param service 服务名称,可选值:'BaseService' | 'OfficialAccount' | 'MiniProgram' | 'OpenPlatform' | 'OpenWork' | 'Payment' | 'Work'
|
|
19
20
|
* @param config 对应的配置参数
|
|
20
21
|
*/
|
|
21
22
|
declare function getInstance(service: 'OfficialAccount', config?: EasyWechatConfig): OfficialAccount;
|
|
22
23
|
declare function getInstance(service: 'BaseService', config?: EasyWechatConfig): BaseService;
|
|
23
24
|
declare function getInstance(service: 'MiniProgram', config?: EasyWechatConfig): MiniProgram;
|
|
24
25
|
declare function getInstance(service: 'OpenPlatform', config?: EasyWechatConfig): OpenPlatform;
|
|
26
|
+
declare function getInstance(service: 'OpenWork', config?: EasyWechatConfig): OpenWork;
|
|
25
27
|
declare function getInstance(service: 'Payment', config?: EasyWechatConfig): Payment;
|
|
26
28
|
declare function getInstance(service: 'Work', config?: EasyWechatConfig): Work;
|
|
27
29
|
declare function getInstance(service: 'MicroMerchant', config?: EasyWechatConfig): MicroMerchant;
|
|
@@ -46,6 +48,10 @@ declare class EasyWechat {
|
|
|
46
48
|
* 开放平台类
|
|
47
49
|
*/
|
|
48
50
|
OpenPlatform: typeof OpenPlatform;
|
|
51
|
+
/**
|
|
52
|
+
* 企业微信开放平台类
|
|
53
|
+
*/
|
|
54
|
+
OpenWork: typeof OpenWork;
|
|
49
55
|
/**
|
|
50
56
|
* 支付类
|
|
51
57
|
*/
|
|
@@ -60,7 +66,7 @@ declare class EasyWechat {
|
|
|
60
66
|
MicroMerchant: typeof MicroMerchant;
|
|
61
67
|
/**
|
|
62
68
|
* 通用获取实例方法
|
|
63
|
-
* @param service 服务名称,可选值:'BaseService' | 'OfficialAccount' | 'MiniProgram' | 'OpenPlatform' | 'Payment'
|
|
69
|
+
* @param service 服务名称,可选值:'BaseService' | 'OfficialAccount' | 'MiniProgram' | 'OpenPlatform' | 'OpenWork' | 'Payment' | 'Work'
|
|
64
70
|
* @param config 对应的配置参数
|
|
65
71
|
*/
|
|
66
72
|
getInstance: typeof getInstance;
|
package/dist/index.js
CHANGED
|
@@ -26,9 +26,10 @@ const Application_1 = __importDefault(require("./OfficialAccount/Application"));
|
|
|
26
26
|
const Application_2 = __importDefault(require("./BaseService/Application"));
|
|
27
27
|
const Application_3 = __importDefault(require("./MiniProgram/Application"));
|
|
28
28
|
const Application_4 = __importDefault(require("./OpenPlatform/Application"));
|
|
29
|
-
const Application_5 = __importDefault(require("./
|
|
30
|
-
const Application_6 = __importDefault(require("./
|
|
31
|
-
const Application_7 = __importDefault(require("./
|
|
29
|
+
const Application_5 = __importDefault(require("./OpenWork/Application"));
|
|
30
|
+
const Application_6 = __importDefault(require("./Payment/Application"));
|
|
31
|
+
const Application_7 = __importDefault(require("./Work/Application"));
|
|
32
|
+
const Application_8 = __importDefault(require("./MicroMerchant/Application"));
|
|
32
33
|
const CacheInterface_1 = __importDefault(require("./Core/Contracts/CacheInterface"));
|
|
33
34
|
const FinallResult_1 = __importDefault(require("./Core/Decorators/FinallResult"));
|
|
34
35
|
const TerminateResult_1 = __importDefault(require("./Core/Decorators/TerminateResult"));
|
|
@@ -62,9 +63,10 @@ class EasyWechat {
|
|
|
62
63
|
BaseService: Application_2.default,
|
|
63
64
|
MiniProgram: Application_3.default,
|
|
64
65
|
OpenPlatform: Application_4.default,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
OpenWork: Application_5.default,
|
|
67
|
+
Payment: Application_6.default,
|
|
68
|
+
Work: Application_7.default,
|
|
69
|
+
MicroMerchant: Application_8.default,
|
|
68
70
|
getInstance: getInstance,
|
|
69
71
|
};
|
|
70
72
|
this.CacheInterface = CacheInterface_1.default;
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-easywechat",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.2",
|
|
4
4
|
"description": "EasyWechat SDK for Node.js (NOT OFFICIAL)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "rm -rf dist && npx tsc",
|
|
8
|
-
"docs": "rm -rf doc && npx typedoc --out docs --plugin typedoc-plugin-markdown ./src/",
|
|
9
8
|
"test": "npx mocha ./test/**/*.js"
|
|
10
9
|
},
|
|
11
10
|
"repository": {
|
|
@@ -20,10 +19,8 @@
|
|
|
20
19
|
"license": "MIT",
|
|
21
20
|
"devDependencies": {
|
|
22
21
|
"@types/node": "^17.0.8",
|
|
23
|
-
"mocha": "^9.
|
|
22
|
+
"mocha": "^9.2.0",
|
|
24
23
|
"sinon": "^12.0.1",
|
|
25
|
-
"typedoc": "^0.22.10",
|
|
26
|
-
"typedoc-plugin-markdown": "^3.11.9",
|
|
27
24
|
"typescript": "^4.5.4"
|
|
28
25
|
},
|
|
29
26
|
"dependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"data":{"errcode":0,"errmsg":"ok","access_token":"moke-token","expires_in":7200},"lifeTime":1642619272}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"data":{"errcode":0,"errmsg":"ok"},"lifeTime":1642619272}
|