node-easywechat 3.5.0 → 3.5.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/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # CHANGELOG
2
2
 
3
3
 
4
+ ## v3.5.2 (2023-11-11)
5
+
6
+ - Fix: 更新依赖包
7
+
8
+ ## v3.5.1 (2023-09-04)
9
+
10
+ - Fix: 调整公众号、小程序access_token默认缓存名称的配置方式
11
+
4
12
  ## v3.5.0 (2023-07-18)
5
13
 
6
14
  - Feat: 优化ts的提示,并新增定义配置、定义服务端处理方法的工具函数
package/README.md CHANGED
@@ -69,7 +69,7 @@ let app = new OpenWork({
69
69
 
70
70
  // ----- 定义配置项(v3.5.0+) -----
71
71
 
72
- // 这种方式设置配置项时可获得编辑器的代码提示(如:VS Code)
72
+ // 这种方式可以让你在需要单独设置配置项时,也能获得编辑器的代码提示
73
73
 
74
74
  // 公众号配置
75
75
  const config = defineOfficialAccountConfig({
@@ -86,7 +86,7 @@ declare class HttpClientResponse implements HttpClientResponseInterface {
86
86
  getHeaders(throwError?: boolean): Record<string, any>;
87
87
  getContent(throwError?: boolean): any;
88
88
  cancel(): void;
89
- getInfo(type?: string): import("axios").AxiosRequestConfig<any>;
89
+ getInfo(type?: string): import("axios").InternalAxiosRequestConfig<any>;
90
90
  offsetExists(key: any): Promise<boolean>;
91
91
  offsetGet(key: any): Promise<any>;
92
92
  }
@@ -1,9 +1,8 @@
1
1
  import BaseAccessToken from "../OfficialAccount/AccessToken";
2
2
  declare class AccessToken extends BaseAccessToken {
3
3
  /**
4
- * 获取access_token的缓存名称
5
- * @returns
4
+ * 缓存前缀
6
5
  */
7
- getKey(): string;
6
+ protected CACHE_KEY_PREFIX: string;
8
7
  }
9
8
  export = AccessToken;
@@ -4,15 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  const AccessToken_1 = __importDefault(require("../OfficialAccount/AccessToken"));
6
6
  class AccessToken extends AccessToken_1.default {
7
- /**
8
- * 获取access_token的缓存名称
9
- * @returns
10
- */
11
- getKey() {
12
- if (!this.key) {
13
- this.key = `mini_app.access_token.${this.appId}`;
14
- }
15
- return this.key;
7
+ constructor() {
8
+ super(...arguments);
9
+ /**
10
+ * 缓存前缀
11
+ */
12
+ this.CACHE_KEY_PREFIX = 'mini_app';
16
13
  }
17
14
  }
18
15
  module.exports = AccessToken;
@@ -8,6 +8,10 @@ declare class AccessToken implements RefreshableAccessTokenInterface {
8
8
  protected cache: CacheInterface;
9
9
  protected httpClient: HttpClientInterface;
10
10
  protected stable: boolean;
11
+ /**
12
+ * 缓存前缀
13
+ */
14
+ protected CACHE_KEY_PREFIX: string;
11
15
  constructor(appId: string, secret: string, key?: string, cache?: CacheInterface, httpClient?: HttpClientInterface, stable?: boolean);
12
16
  /**
13
17
  * 获取access_token的缓存名称
@@ -20,6 +20,10 @@ class AccessToken {
20
20
  this.cache = cache;
21
21
  this.httpClient = httpClient;
22
22
  this.stable = stable;
23
+ /**
24
+ * 缓存前缀
25
+ */
26
+ this.CACHE_KEY_PREFIX = 'official_account';
23
27
  if (!this.httpClient) {
24
28
  this.httpClient = HttpClient_1.default.create({
25
29
  baseURL: 'https://api.weixin.qq.com/',
@@ -32,7 +36,7 @@ class AccessToken {
32
36
  */
33
37
  getKey() {
34
38
  if (!this.key) {
35
- this.key = `official_account.access_token.${this.appId}`;
39
+ this.key = `${this.CACHE_KEY_PREFIX}.access_token.${this.appId}`;
36
40
  }
37
41
  return this.key;
38
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-easywechat",
3
- "version": "3.5.0",
3
+ "version": "3.5.2",
4
4
  "description": "EasyWechat SDK for Node.js (NOT OFFICIAL)",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -29,13 +29,13 @@
29
29
  "typescript": "^4.6.3"
30
30
  },
31
31
  "dependencies": {
32
- "axios": "^0.26.1",
33
- "axios-retry": "^3.3.1",
32
+ "axios": "^1.6.1",
33
+ "axios-retry": "^3.8.1",
34
34
  "form-data": "^4.0.0",
35
35
  "merge": "^2.1.1",
36
- "node-socialite": "^1.3.2",
37
- "qs": "^6.10.3",
38
- "raw-body": "^2.5.1",
39
- "xml2js": "^0.5.0"
36
+ "node-socialite": "^1.4.1",
37
+ "qs": "^6.11.2",
38
+ "raw-body": "^2.5.2",
39
+ "xml2js": "^0.6.2"
40
40
  }
41
41
  }