node-easywechat 3.4.0 → 3.5.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v3.5.0 (2023-07-18)
5
+
6
+ - Feat: 优化ts的提示,并新增定义配置、定义服务端处理方法的工具函数
7
+
4
8
  ## v3.4.0 (2023-06-13)
5
9
 
6
10
  - Feat: 公众号、小程序配置项新增是否使用稳定版接口调用凭据的选项
package/README.md CHANGED
@@ -67,6 +67,20 @@ let app = new OpenWork({
67
67
  // 配置项
68
68
  });
69
69
 
70
+ // ----- 定义配置项(v3.5.0+) -----
71
+
72
+ // 这种方式设置配置项时可获得编辑器的代码提示(如:VS Code)
73
+
74
+ // 公众号配置
75
+ const config = defineOfficialAccountConfig({
76
+ // 配置项
77
+ });
78
+ // 小程序: defineMiniAppConfig()
79
+ // 支付: definePayConfig()
80
+ // 开放平台: defineOpenPlatformConfig()
81
+ // 企业微信: defineWorkConfig()
82
+ // 企业微信开放平台: defineOpenWorkConfig()
83
+
70
84
  // ----- 以下为通用的 api 调用方法 -----
71
85
 
72
86
  // 获取 api 调用客户端
@@ -13,7 +13,7 @@ declare class Config extends ConfigInterface {
13
13
  * 获取所有配置项
14
14
  * @returns
15
15
  */
16
- all(): object;
16
+ all(): Record<string, any>;
17
17
  /**
18
18
  * 判断配置项是否存在
19
19
  * @param key
@@ -38,7 +38,7 @@ declare class Config extends ConfigInterface {
38
38
  * @param keys 键名列表 或者 {键名:默认值} 格式的对象
39
39
  * @returns
40
40
  */
41
- getMany(keys: string[] | Record<string, any>): object;
41
+ getMany(keys: string[] | Record<string, any>): Record<string, any>;
42
42
  /**
43
43
  * 判断配置项是否存在
44
44
  * @param key
@@ -4,7 +4,7 @@ declare abstract class ConfigInterface extends ObjectAccessInterface {
4
4
  * 获取全部配置项
5
5
  * @returns
6
6
  */
7
- all(): object;
7
+ all(): Record<string, any>;
8
8
  /**
9
9
  * 判断配置项是否存在
10
10
  * @param key 键名
@@ -11,7 +11,7 @@ export declare const getTimestamp: (datetime?: string) => number;
11
11
  export declare const buildQueryString: (data: Record<string, any>, options?: Record<string, any>) => string;
12
12
  export declare const parseQueryString: (data: string, options?: Record<string, any>) => Record<string, any>;
13
13
  export declare const randomString: (len?: number) => string;
14
- export declare const makeSignature: (params: object, key?: string, type?: string) => string;
14
+ export declare const makeSignature: (params: Record<string, any>, key?: string, type?: string) => string;
15
15
  export declare const isString: (data: any) => boolean;
16
16
  export declare const isArray: (data: any) => boolean;
17
17
  export declare const isNumber: (data: any) => boolean;
@@ -1,4 +1,4 @@
1
1
  declare class Decryptor {
2
- static decrypt(sessionKey: string, iv: string, ciphertext: string): object;
2
+ static decrypt(sessionKey: string, iv: string, ciphertext: string): Record<string, any>;
3
3
  }
4
4
  export = Decryptor;
@@ -17,6 +17,6 @@ declare class Utils {
17
17
  * @param ciphertext
18
18
  * @returns
19
19
  */
20
- decryptSession(sessionKey: string, iv: string, ciphertext: string): object;
20
+ decryptSession(sessionKey: string, iv: string, ciphertext: string): Record<string, any>;
21
21
  }
22
22
  export = Utils;
@@ -9,7 +9,7 @@ import HttpClientMixin from '../Core/Mixins/HttpClientMixin';
9
9
  import ServerRequestMixin from '../Core/Mixins/ServerRequestMixin';
10
10
  import OfficialAccountApplication from '../OfficialAccount/Application';
11
11
  import MiniAppApplication from '../MiniApp/Application';
12
- import { OfficialAccountConfig, OfficialAccountOAuthFactory, MiniAppConfig } from '../Types/global';
12
+ import { OpenPlatformConfig, OfficialAccountConfig, OfficialAccountOAuthFactory, MiniAppConfig } from '../Types/global';
13
13
  import AccountInterface from './Contracts/AccountInterface';
14
14
  import ApplicationInterface from './Contracts/ApplicationInterface';
15
15
  import Server from './Server';
@@ -21,7 +21,7 @@ import AuthorizerAccessToken from './AuthorizerAccessToken';
21
21
  * 开放平台应用
22
22
  */
23
23
  declare class Application implements ApplicationInterface {
24
- constructor(config: ConfigInterface | OfficialAccountConfig);
24
+ constructor(config: ConfigInterface | OpenPlatformConfig);
25
25
  protected account: AccountInterface;
26
26
  protected encryptor: Encryptor;
27
27
  protected server: Server;
@@ -3,30 +3,18 @@ import ProviderInterface from 'node-socialite/dist/Core/ProviderInterface';
3
3
  import OfficialAccountApplicationInterface from '../OfficialAccount/Contracts/ApplicationInterface';
4
4
  import WorkApplicationInterface from '../Work/Contracts/ApplicationInterface';
5
5
  import Message from '../Core/Message';
6
+ import OfficialAccountMessage from '../OfficialAccount/Message';
7
+ import PayMessage from '../Pay/Message';
8
+ import WorkMessage from '../Work/Message';
9
+ import OpenPlatformMessage from '../OpenPlatform/Message';
10
+ import OpenWorkMessage from '../OpenWork/Message';
6
11
  import HttpClientResponseInterface from '../Core/HttpClient/Contracts/HttpClientResponseInterface';
7
12
  import { PublicKey } from "../Core/Support/PublicKey";
8
13
 
9
- declare module 'axios' {
10
- export interface AxiosRequestConfig {
11
- /**
12
- * 要发送的xml数据,会自动解析并赋值到data属性,同时设置content-type=text/xml
13
- */
14
- xml?: string | Record<string, any>;
15
- /**
16
- * 要发送的json数据,会自动解析并赋值到data属性,同时设置content-type=application/json
17
- */
18
- json?: string | Record<string, any>;
19
- /**
20
- * 要发送的FormData数据,会自动解析并赋值到data属性,同时设置根据内容提取headers
21
- */
22
- formData?: Record<string, any>;
23
- }
24
- }
25
-
26
14
  /**
27
15
  * 微信接口响应数据格式
28
16
  */
29
- export declare interface WeixinResponse extends Record<string, any> {
17
+ export interface WeixinResponse extends Record<string, any> {
30
18
  /**
31
19
  * 错误代码
32
20
  */
@@ -41,7 +29,7 @@ export declare interface WeixinResponse extends Record<string, any> {
41
29
  /**
42
30
  * 公众号网页授权相关配置
43
31
  */
44
- export declare interface OauthConfig {
32
+ export interface OauthConfig {
45
33
  /**
46
34
  * 网页授权权限,可选值:snsapi_userinfo、snsapi_base
47
35
  */
@@ -56,7 +44,7 @@ export declare interface OauthConfig {
56
44
  /**
57
45
  * 文件缓存相关配置
58
46
  */
59
- export declare interface CacheFileConfig {
47
+ export interface CacheFileConfig {
60
48
  /**
61
49
  * 缓存文件保存路径,默认:./
62
50
  */
@@ -78,7 +66,7 @@ export declare interface CacheFileConfig {
78
66
  /**
79
67
  * 网络请求配置
80
68
  */
81
- export declare interface HttpConfig extends AxiosRequestConfig {
69
+ export interface HttpConfig extends AxiosRequestConfig {
82
70
  /**
83
71
  * 是否抛出异常
84
72
  */
@@ -107,7 +95,7 @@ export declare interface HttpConfig extends AxiosRequestConfig {
107
95
  /**
108
96
  * 基础配置
109
97
  */
110
- export declare interface BaseConfig {
98
+ export interface BaseConfig {
111
99
  /**
112
100
  * 网络请求相关配置
113
101
  */
@@ -122,7 +110,7 @@ export declare interface BaseConfig {
122
110
  /**
123
111
  * 公众号配置
124
112
  */
125
- export declare interface OfficialAccountConfig extends BaseConfig {
113
+ export interface OfficialAccountConfig extends BaseConfig {
126
114
  /**
127
115
  * 公众号 app_id
128
116
  */
@@ -158,7 +146,7 @@ export declare interface OfficialAccountConfig extends BaseConfig {
158
146
  /**
159
147
  * 小程序配置
160
148
  */
161
- export declare interface MiniAppConfig extends BaseConfig {
149
+ export interface MiniAppConfig extends BaseConfig {
162
150
  /**
163
151
  * 小程序 app_id
164
152
  */
@@ -189,7 +177,7 @@ export declare interface MiniAppConfig extends BaseConfig {
189
177
  /**
190
178
  * 微信支付配置
191
179
  */
192
- export declare interface PayConfig extends BaseConfig {
180
+ export interface PayConfig extends BaseConfig {
193
181
  /**
194
182
  * 商户号
195
183
  */
@@ -228,7 +216,7 @@ export declare interface PayConfig extends BaseConfig {
228
216
  /**
229
217
  * 开发平台配置
230
218
  */
231
- export declare interface OpenPlatformConfig extends BaseConfig {
219
+ export interface OpenPlatformConfig extends BaseConfig {
232
220
  /**
233
221
  * 开发平台 app_id
234
222
  */
@@ -253,7 +241,7 @@ export declare interface OpenPlatformConfig extends BaseConfig {
253
241
  /**
254
242
  * 企业微信配置
255
243
  */
256
- export declare interface WorkConfig extends BaseConfig {
244
+ export interface WorkConfig extends BaseConfig {
257
245
  /**
258
246
  * 企业微信 corp_id
259
247
  */
@@ -278,7 +266,7 @@ export declare interface WorkConfig extends BaseConfig {
278
266
  /**
279
267
  * 企业微信开放平台配置
280
268
  */
281
- export declare interface OpenWorkConfig extends BaseConfig {
269
+ export interface OpenWorkConfig extends BaseConfig {
282
270
  /**
283
271
  * 企业微信 corp_id
284
272
  */
@@ -315,19 +303,19 @@ export declare interface OpenWorkConfig extends BaseConfig {
315
303
  * @param app 公众号应用实例
316
304
  * @returns OAuth服务供应商实例
317
305
  */
318
- export declare type OfficialAccountOAuthFactory = (app: OfficialAccountApplicationInterface) => ProviderInterface;
306
+ export type OfficialAccountOAuthFactory = (app: OfficialAccountApplicationInterface) => ProviderInterface;
319
307
 
320
308
  /**
321
309
  * 企业微信OAuth工厂方法
322
310
  * @param app 企业微信应用实例
323
311
  * @returns OAuth服务供应商实例
324
312
  */
325
- export declare type WorkOAuthFactory = (app: WorkApplicationInterface) => ProviderInterface;
313
+ export type WorkOAuthFactory = (app: WorkApplicationInterface) => ProviderInterface;
326
314
 
327
315
  /**
328
316
  * 服务端通知处理项
329
317
  */
330
- export declare interface ServerHandlerItem {
318
+ export interface ServerHandlerItem {
331
319
  hash: string;
332
320
  handler: ServerHandlerClosure;
333
321
  };
@@ -335,44 +323,44 @@ export declare interface ServerHandlerItem {
335
323
  /**
336
324
  * 服务端普通消息类型
337
325
  */
338
- export declare type ServerMessageType = 'text' | 'image' | 'voice' | 'video' | 'shortvideo' | 'location';
326
+ export type ServerMessageType = 'text' | 'image' | 'voice' | 'video' | 'shortvideo' | 'location';
339
327
 
340
328
  /**
341
329
  * 服务端事件消息类型
342
330
  */
343
- export declare type ServerEventType = 'subscribe' | 'unsubscribe' | 'SCAN' | 'LOCATION' | 'CLICK' | 'VIEW';
331
+ export type ServerEventType = 'subscribe' | 'unsubscribe' | 'SCAN' | 'LOCATION' | 'CLICK' | 'VIEW';
344
332
 
345
333
  /**
346
334
  * 服务端消息处理器
347
335
  * @param message 微信信息
348
336
  * @param next 下一个消息处理器
349
337
  */
350
- export declare type ServerHandlerClosure = (message: Message, next?: ServerHandlerClosure) => any;
338
+ export type ServerHandlerClosure<T = Message> = (message: T extends OfficialAccountMessage | PayMessage | WorkMessage | OpenPlatformMessage | OpenWorkMessage ? T : Message, next?: ServerHandler<T>) => any;
351
339
 
352
340
  /**
353
341
  * HttpClient错误判定回调
354
342
  * @param response 响应对象
355
343
  */
356
- export declare type HttpClientFailureJudgeClosure = (response: HttpClientResponseInterface) => boolean;
344
+ export type HttpClientFailureJudgeClosure = (response: HttpClientResponseInterface) => boolean;
357
345
 
358
346
  /**
359
347
  * Payment通知错误处理
360
348
  * @param error 错误信息
361
349
  */
362
- export declare type PaymentFailHandler = (error: string) => void;
350
+ export type PaymentFailHandler = (error: string) => void;
363
351
 
364
352
  /**
365
353
  * Payment业务错误处理
366
354
  * @param error 错误信息
367
355
  */
368
- export declare type PaymentAlertHandler = (error: string) => void;
356
+ export type PaymentAlertHandler = (error: string) => void;
369
357
 
370
358
  /**
371
359
  * Payment支付结果处理回调函数
372
360
  * @param message 微信通知信息
373
361
  * @param fail 通知错误处理函数
374
362
  */
375
- export declare type PaymentPaidHandler = (message: Message, fail: PaymentFailHandler) => void;
363
+ export type PaymentPaidHandler = (message: PayMessage, fail: PaymentFailHandler) => void;
376
364
 
377
365
  /**
378
366
  * Payment退款结果处理回调函数
@@ -380,7 +368,7 @@ export declare type PaymentPaidHandler = (message: Message, fail: PaymentFailHan
380
368
  * @param reqInfo 微信通知信息中 req_info 解密后的信息
381
369
  * @param fail 通知错误处理函数
382
370
  */
383
- export declare type PaymentRefundedHandler = (message: Message, reqInfo: object, fail: PaymentFailHandler) => void;
371
+ export type PaymentRefundedHandler = (message: PayMessage, reqInfo: Record<string, any>, fail: PaymentFailHandler) => void;
384
372
 
385
373
  /**
386
374
  * Payment扫码支付结果处理回调函数
@@ -388,7 +376,7 @@ export declare type PaymentRefundedHandler = (message: Message, reqInfo: object,
388
376
  * @param fail 通知错误处理函数
389
377
  * @param alert 业务错误处理函数
390
378
  */
391
- export declare type PaymentScannedHandler = (message: Message, fail: PaymentFailHandler, alert: PaymentAlertHandler) => void;
379
+ export type PaymentScannedHandler = (message: PayMessage, fail: PaymentFailHandler, alert: PaymentAlertHandler) => void;
392
380
 
393
381
  /**
394
382
  * 日志处理方法
@@ -397,12 +385,12 @@ export declare type PaymentScannedHandler = (message: Message, fail: PaymentFail
397
385
  * @param usedTime 请求耗时,单位ms,仅在 type 为 after 时返回
398
386
  * @param response 响应对象,仅在 type 为 after 时返回
399
387
  */
400
- export declare type LogHandler = (type: 'before' | 'after', options: AxiosRequestConfig, usedTime?: number, response?: AxiosResponse) => void | Promise<void>;
388
+ export type LogHandler = (type: 'before' | 'after', options: AxiosRequestConfig, usedTime?: number, response?: AxiosResponse) => void | Promise<void>;
401
389
 
402
390
  /**
403
391
  * 支付参数 JsBridge
404
392
  */
405
- export declare interface PayBridgeConfig {
393
+ export interface PayBridgeConfig {
406
394
  /**
407
395
  * 应用id
408
396
  */
@@ -432,7 +420,7 @@ export declare interface PayBridgeConfig {
432
420
  /**
433
421
  * 支付参数 JsSdk
434
422
  */
435
- export declare interface PaySdkConfig {
423
+ export interface PaySdkConfig {
436
424
  /**
437
425
  * 应用id
438
426
  */
@@ -462,7 +450,7 @@ export declare interface PaySdkConfig {
462
450
  /**
463
451
  * 支付参数 App
464
452
  */
465
- export declare interface PayAppConfig {
453
+ export interface PayAppConfig {
466
454
  /**
467
455
  * 应用id
468
456
  */
@@ -0,0 +1,31 @@
1
+
2
+ import axios from 'axios';
3
+
4
+ declare module 'axios' {
5
+
6
+ interface AxiosInstance {
7
+ <T = Recordable, R = ApiResponse<T>>(config: AxiosRequestConfig): Promise<R>;
8
+ request<T = Recordable, R = ApiResponse<T>>(config: AxiosRequestConfig): Promise<R>;
9
+ get<T = Recordable, R = ApiResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
10
+ delete<T = Recordable, R = ApiResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
11
+ head<T = Recordable, R = ApiResponse<T>>(url: string, config?: AxiosRequestConfig): Promise<R>;
12
+ post<T = Recordable, R = ApiResponse<T>>(url: string, data?: Recordable, config?: AxiosRequestConfig): Promise<R>;
13
+ put<T = Recordable, R = ApiResponse<T>>(url: string, data?: Recordable, config?: AxiosRequestConfig): Promise<R>;
14
+ patch<T = Recordable, R = ApiResponse<T>>(url: string, data?: Recordable, config?: AxiosRequestConfig): Promise<R>;
15
+ }
16
+
17
+ interface AxiosRequestConfig {
18
+ /**
19
+ * 要发送的xml数据,会自动解析并赋值到data属性,同时设置content-type=text/xml
20
+ */
21
+ xml?: string | Recordable;
22
+ /**
23
+ * 要发送的json数据,会自动解析并赋值到data属性,同时设置content-type=application/json
24
+ */
25
+ json?: string | Recordable;
26
+ /**
27
+ * 要发送的FormData数据,会自动解析并赋值到data属性,同时设置根据内容提取headers
28
+ */
29
+ formData?: Recordable;
30
+ }
31
+ }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { OfficialAccountConfig, MiniAppConfig, LogHandler, ServerEventType, ServerHandlerClosure, PayConfig, OpenPlatformConfig, WorkConfig, OpenWorkConfig } from './Types/global';
1
+ import { OfficialAccountConfig, MiniAppConfig, LogHandler, ServerEventType, ServerHandlerClosure, PayConfig, OpenPlatformConfig, WorkConfig, OpenWorkConfig, HttpClientFailureJudgeClosure, PaymentFailHandler, PaymentAlertHandler, PaymentPaidHandler, PaymentRefundedHandler, PaymentScannedHandler } from './Types/global';
2
2
  import OfficialAccount from './OfficialAccount/Application';
3
3
  import MiniApp from './MiniApp/Application';
4
4
  import Pay from './Pay/Application';
@@ -8,6 +8,10 @@ import OpenWork from './OpenWork/Application';
8
8
  import CacheInterface from './Core/Contracts/CacheInterface';
9
9
  import ServerRequest from './Core/Http/ServerRequest';
10
10
  import FormData from 'form-data';
11
+ import OfficialAccountMessage from './OfficialAccount/Message';
12
+ import WorkMessage from './Work/Message';
13
+ import OpenPlatformMessage from './OpenPlatform/Message';
14
+ import OpenWorkMessage from './OpenWork/Message';
11
15
  export { OfficialAccount, OfficialAccountConfig, MiniApp, MiniAppConfig, Pay, PayConfig, OpenPlatform, OpenPlatformConfig, Work, WorkConfig, OpenWork, OpenWorkConfig, CacheInterface, ServerRequest, LogHandler, ServerEventType, ServerHandlerClosure,
12
16
  /**
13
17
  * 表单对象
@@ -15,3 +19,93 @@ export { OfficialAccount, OfficialAccountConfig, MiniApp, MiniAppConfig, Pay, Pa
15
19
  * @see https://github.com/form-data/form-data#readme
16
20
  */
17
21
  FormData, };
22
+ /**
23
+ * 定义公众号配置
24
+ * @param config
25
+ */
26
+ export declare function defineOfficialAccountConfig(config: OfficialAccountConfig): OfficialAccountConfig;
27
+ /**
28
+ * 定义小程序配置
29
+ * @param config
30
+ */
31
+ export declare function defineMiniAppConfig(config: MiniAppConfig): MiniAppConfig;
32
+ /**
33
+ * 定义支付配置
34
+ * @param config
35
+ */
36
+ export declare function definePayConfig(config: PayConfig): PayConfig;
37
+ /**
38
+ * 定义开放平台配置
39
+ * @param config
40
+ */
41
+ export declare function defineOpenPlatformConfig(config: OpenPlatformConfig): OpenPlatformConfig;
42
+ /**
43
+ * 定义企业微信配置
44
+ * @param config
45
+ */
46
+ export declare function defineWorkConfig(config: WorkConfig): WorkConfig;
47
+ /**
48
+ * 定义企业微信开放平台配置
49
+ * @param config
50
+ */
51
+ export declare function defineOpenWorkConfig(config: OpenWorkConfig): OpenWorkConfig;
52
+ /**
53
+ * 定义日志处理函数
54
+ * @param func
55
+ */
56
+ export declare function defineLogHandler(func: LogHandler): LogHandler;
57
+ /**
58
+ * 定义公众号服务端消息处理函数
59
+ * @param func
60
+ */
61
+ export declare function defineOfficeAccountServerHandler(func: ServerHandlerClosure<OfficialAccountMessage>): ServerHandlerClosure<OfficialAccountMessage>;
62
+ /**
63
+ * 定义小程序服务端消息处理函数
64
+ * @param func
65
+ */
66
+ export declare function defineMiniAppServerHandler(func: ServerHandlerClosure<OfficialAccountMessage>): ServerHandlerClosure<OfficialAccountMessage>;
67
+ /**
68
+ * 定义企业微信服务端消息处理函数
69
+ * @param func
70
+ */
71
+ export declare function defineWorkServerHandler(func: ServerHandlerClosure<WorkMessage>): ServerHandlerClosure<WorkMessage>;
72
+ /**
73
+ * 定义开放平台服务端消息处理函数
74
+ * @param func
75
+ */
76
+ export declare function defineOpenPlatformServerHandler(func: ServerHandlerClosure<OpenPlatformMessage>): ServerHandlerClosure<OpenPlatformMessage>;
77
+ /**
78
+ * 定义企业微信开放平台服务端消息处理函数
79
+ * @param func
80
+ */
81
+ export declare function defineOpenWorkServerHandler(func: ServerHandlerClosure<OpenWorkMessage>): ServerHandlerClosure<OpenWorkMessage>;
82
+ /**
83
+ * 定义HttpClient错误判定回调
84
+ * @param func
85
+ */
86
+ export declare function defineHttpClientFailureJudgeClosure(func: HttpClientFailureJudgeClosure): HttpClientFailureJudgeClosure;
87
+ /**
88
+ * 定义支付通知错误处理函数
89
+ * @param func
90
+ */
91
+ export declare function definePaymentFailHandler(func: PaymentFailHandler): PaymentFailHandler;
92
+ /**
93
+ * 定义支付业务错误处理函数
94
+ * @param func
95
+ */
96
+ export declare function definePaymentAlertHandler(func: PaymentAlertHandler): PaymentAlertHandler;
97
+ /**
98
+ * 定义支付结果处理回调函数
99
+ * @param func
100
+ */
101
+ export declare function definePaymentPaidHandler(func: PaymentPaidHandler): PaymentPaidHandler;
102
+ /**
103
+ * 定义退款结果处理回调函数
104
+ * @param func
105
+ */
106
+ export declare function definePaymentRefundedHandler(func: PaymentRefundedHandler): PaymentRefundedHandler;
107
+ /**
108
+ * 定义扫码支付结果处理回调函数
109
+ * @param func
110
+ */
111
+ export declare function definePaymentScannedHandler(func: PaymentScannedHandler): PaymentScannedHandler;
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FormData = exports.ServerRequest = exports.CacheInterface = exports.OpenWork = exports.Work = exports.OpenPlatform = exports.Pay = exports.MiniApp = exports.OfficialAccount = void 0;
6
+ exports.definePaymentScannedHandler = exports.definePaymentRefundedHandler = exports.definePaymentPaidHandler = exports.definePaymentAlertHandler = exports.definePaymentFailHandler = exports.defineHttpClientFailureJudgeClosure = exports.defineOpenWorkServerHandler = exports.defineOpenPlatformServerHandler = exports.defineWorkServerHandler = exports.defineMiniAppServerHandler = exports.defineOfficeAccountServerHandler = exports.defineLogHandler = exports.defineOpenWorkConfig = exports.defineWorkConfig = exports.defineOpenPlatformConfig = exports.definePayConfig = exports.defineMiniAppConfig = exports.defineOfficialAccountConfig = exports.FormData = exports.ServerRequest = exports.CacheInterface = exports.OpenWork = exports.Work = exports.OpenPlatform = exports.Pay = exports.MiniApp = exports.OfficialAccount = void 0;
7
7
  const Application_1 = __importDefault(require("./OfficialAccount/Application"));
8
8
  exports.OfficialAccount = Application_1.default;
9
9
  const Application_2 = __importDefault(require("./MiniApp/Application"));
@@ -22,3 +22,147 @@ const ServerRequest_1 = __importDefault(require("./Core/Http/ServerRequest"));
22
22
  exports.ServerRequest = ServerRequest_1.default;
23
23
  const form_data_1 = __importDefault(require("form-data"));
24
24
  exports.FormData = form_data_1.default;
25
+ /**
26
+ * 定义公众号配置
27
+ * @param config
28
+ */
29
+ function defineOfficialAccountConfig(config) {
30
+ return config;
31
+ }
32
+ exports.defineOfficialAccountConfig = defineOfficialAccountConfig;
33
+ /**
34
+ * 定义小程序配置
35
+ * @param config
36
+ */
37
+ function defineMiniAppConfig(config) {
38
+ return config;
39
+ }
40
+ exports.defineMiniAppConfig = defineMiniAppConfig;
41
+ /**
42
+ * 定义支付配置
43
+ * @param config
44
+ */
45
+ function definePayConfig(config) {
46
+ return config;
47
+ }
48
+ exports.definePayConfig = definePayConfig;
49
+ /**
50
+ * 定义开放平台配置
51
+ * @param config
52
+ */
53
+ function defineOpenPlatformConfig(config) {
54
+ return config;
55
+ }
56
+ exports.defineOpenPlatformConfig = defineOpenPlatformConfig;
57
+ /**
58
+ * 定义企业微信配置
59
+ * @param config
60
+ */
61
+ function defineWorkConfig(config) {
62
+ return config;
63
+ }
64
+ exports.defineWorkConfig = defineWorkConfig;
65
+ /**
66
+ * 定义企业微信开放平台配置
67
+ * @param config
68
+ */
69
+ function defineOpenWorkConfig(config) {
70
+ return config;
71
+ }
72
+ exports.defineOpenWorkConfig = defineOpenWorkConfig;
73
+ /**
74
+ * 定义日志处理函数
75
+ * @param func
76
+ */
77
+ function defineLogHandler(func) {
78
+ return func;
79
+ }
80
+ exports.defineLogHandler = defineLogHandler;
81
+ /**
82
+ * 定义公众号服务端消息处理函数
83
+ * @param func
84
+ */
85
+ function defineOfficeAccountServerHandler(func) {
86
+ return func;
87
+ }
88
+ exports.defineOfficeAccountServerHandler = defineOfficeAccountServerHandler;
89
+ /**
90
+ * 定义小程序服务端消息处理函数
91
+ * @param func
92
+ */
93
+ function defineMiniAppServerHandler(func) {
94
+ return func;
95
+ }
96
+ exports.defineMiniAppServerHandler = defineMiniAppServerHandler;
97
+ /**
98
+ * 定义企业微信服务端消息处理函数
99
+ * @param func
100
+ */
101
+ function defineWorkServerHandler(func) {
102
+ return func;
103
+ }
104
+ exports.defineWorkServerHandler = defineWorkServerHandler;
105
+ /**
106
+ * 定义开放平台服务端消息处理函数
107
+ * @param func
108
+ */
109
+ function defineOpenPlatformServerHandler(func) {
110
+ return func;
111
+ }
112
+ exports.defineOpenPlatformServerHandler = defineOpenPlatformServerHandler;
113
+ /**
114
+ * 定义企业微信开放平台服务端消息处理函数
115
+ * @param func
116
+ */
117
+ function defineOpenWorkServerHandler(func) {
118
+ return func;
119
+ }
120
+ exports.defineOpenWorkServerHandler = defineOpenWorkServerHandler;
121
+ /**
122
+ * 定义HttpClient错误判定回调
123
+ * @param func
124
+ */
125
+ function defineHttpClientFailureJudgeClosure(func) {
126
+ return func;
127
+ }
128
+ exports.defineHttpClientFailureJudgeClosure = defineHttpClientFailureJudgeClosure;
129
+ /**
130
+ * 定义支付通知错误处理函数
131
+ * @param func
132
+ */
133
+ function definePaymentFailHandler(func) {
134
+ return func;
135
+ }
136
+ exports.definePaymentFailHandler = definePaymentFailHandler;
137
+ /**
138
+ * 定义支付业务错误处理函数
139
+ * @param func
140
+ */
141
+ function definePaymentAlertHandler(func) {
142
+ return func;
143
+ }
144
+ exports.definePaymentAlertHandler = definePaymentAlertHandler;
145
+ /**
146
+ * 定义支付结果处理回调函数
147
+ * @param func
148
+ */
149
+ function definePaymentPaidHandler(func) {
150
+ return func;
151
+ }
152
+ exports.definePaymentPaidHandler = definePaymentPaidHandler;
153
+ /**
154
+ * 定义退款结果处理回调函数
155
+ * @param func
156
+ */
157
+ function definePaymentRefundedHandler(func) {
158
+ return func;
159
+ }
160
+ exports.definePaymentRefundedHandler = definePaymentRefundedHandler;
161
+ /**
162
+ * 定义扫码支付结果处理回调函数
163
+ * @param func
164
+ */
165
+ function definePaymentScannedHandler(func) {
166
+ return func;
167
+ }
168
+ exports.definePaymentScannedHandler = definePaymentScannedHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-easywechat",
3
- "version": "3.4.0",
3
+ "version": "3.5.0",
4
4
  "description": "EasyWechat SDK for Node.js (NOT OFFICIAL)",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {