@jayfong/x-server 1.33.2 → 1.33.5

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
@@ -2,6 +2,17 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.33.5](https://github.com/jfWorks/x-server/compare/v1.33.4...v1.33.5) (2022-08-21)
6
+
7
+ ### [1.33.4](https://github.com/jfWorks/x-server/compare/v1.33.3...v1.33.4) (2022-07-17)
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * remove console log ([13df7b1](https://github.com/jfWorks/x-server/commit/13df7b1728ab67df8206e79b2742f03143ff5668))
13
+
14
+ ### [1.33.3](https://github.com/jfWorks/x-server/compare/v1.33.2...v1.33.3) (2022-07-07)
15
+
5
16
  ### [1.33.2](https://github.com/jfWorks/x-server/compare/v1.33.1...v1.33.2) (2022-06-28)
6
17
 
7
18
  ### [1.33.1](https://github.com/jfWorks/x-server/compare/v1.33.0...v1.33.1) (2022-06-12)
@@ -164,7 +164,12 @@ class BuildUtil {
164
164
 
165
165
  await (0, _execa.default)('tyn', {
166
166
  cwd: distDir,
167
- stdio: 'inherit'
167
+ stdio: 'inherit',
168
+ env: {
169
+ // 禁止 yarn 更新检测,因网络原因容易超时长时间卡住
170
+ // https://classic.yarnpkg.com/lang/en/docs/yarnrc/#toc-disable-self-update-check
171
+ yarn_disable_self_update_check: 'true'
172
+ }
168
173
  }); // 打包为 tgz
169
174
 
170
175
  await _compressing.default.tgz.compressDir(distDir, distBundleFile);
@@ -29,7 +29,6 @@ class JwtService {
29
29
  ignoreExpiration: false
30
30
  }, (err, data) => {
31
31
  if (err) {
32
- console.log(err);
33
32
  reject(new _http_error.HttpError.Unauthorized());
34
33
  } else {
35
34
  resolve(data);
@@ -33,6 +33,19 @@ class SensitiveWordsService {
33
33
  });
34
34
  return res.text;
35
35
  }
36
+ /**
37
+ * 验证文本是否包含敏感词。
38
+ */
39
+
40
+
41
+ async validate(text) {
42
+ if (!this.mint) {
43
+ this.mint = new _mintFilter.default(this.options.words);
44
+ }
45
+
46
+ const res = this.mint.validator(text);
47
+ return res;
48
+ }
36
49
 
37
50
  }
38
51
 
@@ -138,7 +138,12 @@ export class BuildUtil {
138
138
 
139
139
  await exec('tyn', {
140
140
  cwd: distDir,
141
- stdio: 'inherit'
141
+ stdio: 'inherit',
142
+ env: {
143
+ // 禁止 yarn 更新检测,因网络原因容易超时长时间卡住
144
+ // https://classic.yarnpkg.com/lang/en/docs/yarnrc/#toc-disable-self-update-check
145
+ yarn_disable_self_update_check: 'true'
146
+ }
142
147
  }); // 打包为 tgz
143
148
 
144
149
  await compressing.tgz.compressDir(distDir, distBundleFile);
@@ -19,7 +19,6 @@ export class JwtService {
19
19
  ignoreExpiration: false
20
20
  }, (err, data) => {
21
21
  if (err) {
22
- console.log(err);
23
22
  reject(new HttpError.Unauthorized());
24
23
  } else {
25
24
  resolve(data);
@@ -15,6 +15,10 @@ export declare class SensitiveWordsService implements BaseService {
15
15
  * 处理文本,敏感词将被替换为 * 号。
16
16
  */
17
17
  process(text: string): Promise<string>;
18
+ /**
19
+ * 验证文本是否包含敏感词。
20
+ */
21
+ validate(text: string): Promise<boolean>;
18
22
  }
19
23
  declare module '../x' {
20
24
  interface X {
@@ -26,5 +26,18 @@ export class SensitiveWordsService {
26
26
  });
27
27
  return res.text;
28
28
  }
29
+ /**
30
+ * 验证文本是否包含敏感词。
31
+ */
32
+
33
+
34
+ async validate(text) {
35
+ if (!this.mint) {
36
+ this.mint = new Mint(this.options.words);
37
+ }
38
+
39
+ const res = this.mint.validator(text);
40
+ return res;
41
+ }
29
42
 
30
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "1.33.2",
3
+ "version": "1.33.5",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",