halo-fe 1.0.20 → 1.0.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,19 +6,25 @@ import HttpResponse from "./entities/HttpResponse";
6
6
  */
7
7
  declare abstract class Http implements IHttp {
8
8
  type: string;
9
+ /**
10
+ * 默认请求器
11
+ */
12
+ http: IHttp;
9
13
  open(conn: string): Promise<void>;
10
- onRequest: (request: HttpRequest) => Promise<void>;
11
- onResponse: (response: HttpResponse) => Promise<void>;
12
- get(path: string, params?: any): Promise<any>;
13
- sendGet(path: string, params?: any): Promise<HttpResponse>;
14
- post(path: string, body: any): Promise<any>;
15
- sendPost(path: string, body?: any): Promise<HttpResponse>;
16
- patch(path: string): Promise<any>;
17
- sendPatch(path: string, pairs?: any): Promise<HttpResponse>;
14
+ get onRequest(): (request: HttpRequest) => Promise<void>;
15
+ set onRequest(value: (request: HttpRequest) => Promise<void>);
16
+ get onResponse(): (response: HttpResponse) => Promise<void>;
17
+ set onResponse(value: (response: HttpResponse) => Promise<void>);
18
+ get: (path: string, params?: any) => Promise<any>;
19
+ sendGet: (path: string, params?: any) => Promise<HttpResponse>;
20
+ post: (path: string, body: any) => Promise<any>;
21
+ sendPost: (path: string, body?: any) => Promise<HttpResponse>;
22
+ patch: (path: string) => Promise<any>;
23
+ sendPatch: (path: string, pairs?: any) => Promise<HttpResponse>;
18
24
  abstract send(request: HttpRequest): Promise<HttpResponse>;
19
25
  /**
20
26
  * 获取请求消息
21
27
  */
22
- getRequest(method: string, contentType: string, path: string, body?: any): HttpRequest;
28
+ getRequest: (method: string, contentType: string, path: string, body?: any) => HttpRequest;
23
29
  }
24
30
  export default Http;
@@ -8,6 +8,12 @@ import HttpResponse from "../entities/HttpResponse";
8
8
  declare class DefaultHttp extends Http {
9
9
  type: string;
10
10
  baseUrl: string;
11
+ _onRequest: any;
12
+ _onResponse: any;
13
+ get onRequest(): (request: HttpRequest) => Promise<void>;
14
+ set onRequest(value: (request: HttpRequest) => Promise<void>);
15
+ get onResponse(): (response: HttpResponse) => Promise<void>;
16
+ set onResponse(value: (response: HttpResponse) => Promise<void>);
11
17
  send(request: HttpRequest): Promise<HttpResponse>;
12
18
  /**
13
19
  * 使用Fetch发送请求,谷歌插件场景专用
@@ -1,7 +1,6 @@
1
1
  import Http from "../Http";
2
2
  import HttpRequest from "../entities/HttpRequest";
3
3
  import HttpResponse from "../entities/HttpResponse";
4
- import IHttp from "../IHttp";
5
4
  import { ISso, SsoUser } from "../../ssos";
6
5
  import { ISigner } from "../../signers";
7
6
  /**
@@ -29,10 +28,6 @@ declare class HaloHttp extends Http {
29
28
  * 当前终端
30
29
  */
31
30
  platform: string;
32
- /**
33
- * 默认请求器
34
- */
35
- http: IHttp;
36
31
  /**
37
32
  * 单点登录配置
38
33
  */
@@ -48,14 +43,14 @@ declare class HaloHttp extends Http {
48
43
  /**
49
44
  * 发送请求
50
45
  */
51
- send(request: HttpRequest): Promise<HttpResponse>;
46
+ send: (request: HttpRequest) => Promise<HttpResponse>;
52
47
  /**
53
48
  * 请求预处理
54
49
  */
55
- beforeRequest(request: HttpRequest): Promise<void>;
50
+ beforeRequest: (request: HttpRequest) => Promise<void>;
56
51
  /**
57
52
  * 处理网络错误和响应错误场景
58
53
  */
59
- handleError(error: any): Promise<never>;
54
+ handleError: (error: any) => Promise<never>;
60
55
  }
61
56
  export default HaloHttp;
@@ -1,7 +1,6 @@
1
1
  import Http from "../Http";
2
2
  import HttpRequest from "../entities/HttpRequest";
3
3
  import HttpResponse from "../entities/HttpResponse";
4
- import IHttp from "../IHttp";
5
4
  import { IHasher } from "../../hashers";
6
5
  /**
7
6
  * MK请求器
@@ -20,10 +19,6 @@ declare class MkHttp extends Http {
20
19
  * AppSecret
21
20
  */
22
21
  appSecret: string;
23
- /**
24
- * 默认请求器
25
- */
26
- requester: IHttp;
27
22
  /**
28
23
  * Hash计算器
29
24
  */
@@ -35,6 +30,6 @@ declare class MkHttp extends Http {
35
30
  /**
36
31
  * 危险操作,会暴露敏感信息
37
32
  */
38
- send(request: HttpRequest): Promise<HttpResponse>;
33
+ send: (request: HttpRequest) => Promise<HttpResponse>;
39
34
  }
40
35
  export default MkHttp;
@@ -5,9 +5,5 @@ import II18n from "./II18n";
5
5
  */
6
6
  declare class I18nFactory extends Factory<II18n> {
7
7
  open(): void;
8
- /**
9
- * 获取默认多语言
10
- */
11
- getDefault(): Promise<II18n>;
12
8
  }
13
9
  export default I18nFactory;
@@ -58,6 +58,14 @@ interface II18n extends IDriver, IOpen {
58
58
  * 系统标题
59
59
  */
60
60
  t_title(): string;
61
+ /**
62
+ * 设置多语言标题
63
+ */
64
+ setI18nTitle(key: string): void;
65
+ /**
66
+ * 设置标题
67
+ */
68
+ setTitle(title: string, env: string): void;
61
69
  /**
62
70
  * 添加自定义多语言包
63
71
  */
@@ -65,7 +73,7 @@ interface II18n extends IDriver, IOpen {
65
73
  [key: string]: string;
66
74
  }): void;
67
75
  /**
68
- * 加载指定语言包
76
+ * 加载指定语言包,需http请求器先加载完毕
69
77
  */
70
78
  loadI18n(lang?: string): Promise<void>;
71
79
  }
@@ -1,4 +1,7 @@
1
1
  import ISigner from "./ISigner";
2
+ /**
3
+ * 签名器基类
4
+ */
2
5
  declare abstract class Signer implements ISigner {
3
6
  type: string;
4
7
  abstract open(auth: {
@@ -33,12 +33,8 @@ declare let messenger: IMessenger;
33
33
  * 初始化默认驱动实例
34
34
  */
35
35
  declare let initDriver: (options: CreateFeOptions) => Promise<void>;
36
- /**
37
- * 设置好请求器后,才可以设置多语言
38
- */
39
- declare let initI18n: () => Promise<void>;
40
36
  /**
41
37
  * 提取可导出的翻译方法,当i18n实例变化后,导出的方案会跟着变化?
42
38
  */
43
39
  declare let t: typeof i18n.t, t_exists: typeof i18n.t_exists, t_sys: typeof i18n.t_sys, t_enum: typeof i18n.t_enum, t_field: typeof i18n.t_field, t_field_choose_placeholder: typeof i18n.t_field_choose_placeholder, t_field_placeholder: typeof i18n.t_field_placeholder, t_table: typeof i18n.t_table, t_module: typeof i18n.t_module, t_menu: typeof i18n.t_menu;
44
- export { base64, cdn, http, i18n, md5, template, messenger, initDriver, initI18n, Factories, t, t_exists, t_sys, t_enum, t_field, t_field_choose_placeholder, t_field_placeholder, t_table, t_module, t_menu };
40
+ export { base64, cdn, http, i18n, md5, template, messenger, initDriver, Factories, t, t_exists, t_sys, t_enum, t_field, t_field_choose_placeholder, t_field_placeholder, t_table, t_module, t_menu };
@@ -1,2 +1 @@
1
- import IDictionary from "./Dictionary";
2
- export { type IDictionary };
1
+ export {};
@@ -1,10 +1,10 @@
1
- import { IDictionary } from "../@types";
2
1
  import { SysConfig, UserConfig } from "../entities";
3
2
  import Svc from "../Svc";
4
3
  /**
5
4
  * 不一定跟用户相关,此时如果使用配置仓储,使用的是配置文件的配置,非接口配置
6
5
  */
7
- declare class ConfigSvc extends Svc implements IDictionary {
6
+ declare class ConfigSvc extends Svc {
7
+ [key: string]: any;
8
8
  type: string;
9
9
  /**
10
10
  * 用户系统配置
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "halo-fe",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "description": "Halo front end sdk",
5
5
  "scripts": {
6
6
  "halo-fe:tsc": "vue-tsc",