halo-fe 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. package/dist/main.js +1518 -984
  2. package/dist/style.css +1 -0
  3. package/esm/coms/Code.vue.d.ts +41 -0
  4. package/esm/coms/Col.vue.d.ts +11 -0
  5. package/esm/coms/Compare.vue.d.ts +40 -0
  6. package/esm/coms/Container.vue.d.ts +23 -0
  7. package/esm/coms/Empty.vue.d.ts +26 -0
  8. package/esm/coms/Progress.vue.d.ts +8 -0
  9. package/esm/coms/Row.vue.d.ts +21 -0
  10. package/esm/coms/index.d.ts +8 -0
  11. package/esm/coms/types/CodeEmit.d.ts +23 -0
  12. package/esm/coms/types/CodeProps.d.ts +18 -0
  13. package/esm/coms/types/RowProps.d.ts +14 -0
  14. package/esm/coms/types/index.d.ts +4 -0
  15. package/esm/drivers/cdns/CdnFactory.d.ts +1 -1
  16. package/esm/drivers/cdns/index.d.ts +2 -0
  17. package/esm/drivers/encoders/EncoderFactory.d.ts +2 -2
  18. package/esm/drivers/encoders/index.d.ts +2 -0
  19. package/esm/drivers/excels/ExcelFactory.d.ts +1 -1
  20. package/esm/drivers/excels/index.d.ts +2 -1
  21. package/esm/drivers/explainers/index.d.ts +2 -0
  22. package/esm/drivers/factories/DriverFactory.d.ts +13 -12
  23. package/esm/drivers/factories/Factory.d.ts +1 -1
  24. package/esm/drivers/factories/IFactory.d.ts +1 -1
  25. package/esm/drivers/factories/index.d.ts +13 -1
  26. package/esm/drivers/features/FeatureFactory.d.ts +1 -1
  27. package/esm/drivers/features/index.d.ts +2 -1
  28. package/esm/drivers/hashers/HasherFactory.d.ts +2 -2
  29. package/esm/drivers/hashers/index.d.ts +2 -1
  30. package/esm/drivers/https/Http.d.ts +24 -0
  31. package/esm/drivers/https/HttpFactory.d.ts +20 -0
  32. package/esm/drivers/https/IHttp.d.ts +49 -0
  33. package/esm/drivers/https/entities/HttpMessage.d.ts +32 -0
  34. package/esm/drivers/https/entities/HttpRequest.d.ts +19 -0
  35. package/esm/drivers/{requesters → https}/entities/HttpResponse.d.ts +2 -5
  36. package/esm/drivers/{requesters/implements/DefaultRequester.d.ts → https/implements/DefaultHttp.d.ts} +4 -4
  37. package/esm/drivers/https/implements/HaloHttp.d.ts +37 -0
  38. package/esm/drivers/{requesters/implements/MkRequester.d.ts → https/implements/MkHttp.d.ts} +7 -7
  39. package/esm/drivers/https/index.d.ts +6 -0
  40. package/esm/drivers/index.d.ts +8 -10
  41. package/esm/drivers/providers/Provider.d.ts +17 -0
  42. package/esm/drivers/providers/ProviderFactory.d.ts +3 -3
  43. package/esm/drivers/providers/implements/IndexedDbProvider.d.ts +2 -2
  44. package/esm/drivers/providers/implements/StorageProvider.d.ts +4 -0
  45. package/esm/drivers/providers/index.d.ts +2 -1
  46. package/esm/drivers/signers/ISigner.d.ts +2 -2
  47. package/esm/drivers/signers/Signer.d.ts +13 -0
  48. package/esm/drivers/signers/SignerFactory.d.ts +1 -1
  49. package/esm/drivers/signers/implements/DefaultSigner.d.ts +4 -4
  50. package/esm/drivers/signers/index.d.ts +2 -1
  51. package/esm/drivers/ssos/ISso.d.ts +1 -1
  52. package/esm/drivers/ssos/SsoFactory.d.ts +1 -1
  53. package/esm/drivers/ssos/implements/AnonymousSso.d.ts +1 -1
  54. package/esm/drivers/ssos/implements/BearerSso.d.ts +1 -3
  55. package/esm/drivers/ssos/implements/NioSso.d.ts +1 -1
  56. package/esm/drivers/ssos/implements/SecretSso.d.ts +3 -3
  57. package/esm/drivers/ssos/implements/WeiXinSso.d.ts +1 -1
  58. package/esm/drivers/ssos/index.d.ts +2 -1
  59. package/esm/helpers/json-helper.d.ts +12 -4
  60. package/esm/helpers/object-helper.d.ts +4 -0
  61. package/esm/helpers/types/index.d.ts +0 -0
  62. package/esm/helpers/url-helper.d.ts +2 -2
  63. package/esm/main.d.ts +14 -3
  64. package/esm/services/index.d.ts +6 -12
  65. package/esm/services/types/IMessage.d.ts +14 -0
  66. package/esm/services/types/IMessager.d.ts +14 -0
  67. package/esm/services/types/index.d.ts +2 -0
  68. package/esm/stores/config.d.ts +10 -6
  69. package/esm/stores/driver.d.ts +2 -6
  70. package/esm/stores/index.d.ts +3 -2
  71. package/esm/stores/setting.d.ts +0 -4
  72. package/esm/stores/user.d.ts +3 -7
  73. package/esm/utilities/AffixUtility.d.ts +10 -0
  74. package/esm/utilities/EventUtility.d.ts +30 -0
  75. package/esm/utilities/KeyboardUtility.d.ts +73 -0
  76. package/esm/utilities/MouseUtility.d.ts +24 -0
  77. package/esm/utilities/index.d.ts +4 -0
  78. package/package.json +7 -7
  79. package/dist/vendor-axios-ud9O0vdJ.js +0 -1670
  80. package/esm/drivers/driver-helper.d.ts +0 -46
  81. package/esm/drivers/requesters/IRequester.d.ts +0 -25
  82. package/esm/drivers/requesters/Requester.d.ts +0 -13
  83. package/esm/drivers/requesters/RequesterFactory.d.ts +0 -21
  84. package/esm/drivers/requesters/entities/HttpRequest.d.ts +0 -34
  85. package/esm/drivers/requesters/implements/LocalRequester.d.ts +0 -43
  86. package/esm/drivers/requesters/index.d.ts +0 -5
  87. /package/esm/{thirds → plugins}/index.d.ts +0 -0
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ html{-webkit-user-select:initial;user-select:initial;font-size:14px;font-family:Consolas}a{text-decoration:none}p{margin:0;line-height:20px}input{outline:none;margin:0;font-family:inherit}ul,ol{margin:0;padding:0;outline:none}li{list-style-type:none}img{display:block}pre{margin:0;font-family:inherit}.ha-code{width:100%;height:100%}.ha-code.border{width:calc(100% - 2px);height:calc(100% - 2px);border-radius:4px}.ha-code.border .monaco-editor,.ha-code.border .overflow-guard{border-radius:4px}.ha-code.border:has(.monaco-editor.focused){border:1px solid #007fd4}.ha-col{display:flex;gap:5px}.ha-compare{width:100%;height:100%}.ha-container{padding:10px;width:calc(100% - 20px);height:calc(100% - 20px)}.ha-container .ha-operation:nth-child(1){margin-top:0;margin-bottom:10px;padding:8px 10px;line-height:32px}.ha-progress{position:absolute;width:0;z-index:1}.ha-row{display:flex;gap:5px}.ha-row.between{justify-content:space-between}
@@ -0,0 +1,41 @@
1
+ import { type Monaco } from "../plugins";
2
+ import { CodeProps } from "./types";
3
+ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<CodeProps>, {
4
+ config: {};
5
+ }>, {
6
+ layout: () => void;
7
+ getEditor: () => Monaco.editor.IStandaloneCodeEditor;
8
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ mounted: (monaco: typeof Monaco, editor: Monaco.editor.IStandaloneCodeEditor) => void;
10
+ change: (value: string) => void;
11
+ scroll: (scrollTop: number) => void;
12
+ "update:modelValue": (value: any) => void;
13
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<CodeProps>, {
14
+ config: {};
15
+ }>>> & {
16
+ onScroll?: (scrollTop: number) => any;
17
+ onMounted?: (monaco: typeof Monaco, editor: Monaco.editor.IStandaloneCodeEditor) => any;
18
+ onChange?: (value: string) => any;
19
+ "onUpdate:modelValue"?: (value: any) => any;
20
+ }, {
21
+ config: any;
22
+ }, {}>;
23
+ export default _default;
24
+
25
+ type __VLS_WithDefaults<P, D> = {
26
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
27
+ default: D[K];
28
+ }> : P[K];
29
+ };
30
+ type __VLS_Prettify<T> = {
31
+ [K in keyof T]: T[K];
32
+ } & {};
33
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
34
+ type __VLS_TypePropsToOption<T> = {
35
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
36
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
37
+ } : {
38
+ type: import('vue').PropType<T[K]>;
39
+ required: true;
40
+ };
41
+ };
@@ -0,0 +1,11 @@
1
+ declare function __VLS_template(): {
2
+ default?(_: {}): any;
3
+ };
4
+ declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
5
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
6
+ export default _default;
7
+ type __VLS_WithTemplateSlots<T, S> = T & {
8
+ new (): {
9
+ $slots: S;
10
+ };
11
+ };
@@ -0,0 +1,40 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ inline: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ language: {
7
+ type: StringConstructor;
8
+ };
9
+ original: {
10
+ type: StringConstructor;
11
+ };
12
+ modelValue: {
13
+ type: StringConstructor;
14
+ };
15
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
16
+ change: (...args: any[]) => void;
17
+ "update:modelValue": (...args: any[]) => void;
18
+ "update:original": (...args: any[]) => void;
19
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
20
+ inline: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
24
+ language: {
25
+ type: StringConstructor;
26
+ };
27
+ original: {
28
+ type: StringConstructor;
29
+ };
30
+ modelValue: {
31
+ type: StringConstructor;
32
+ };
33
+ }>> & {
34
+ onChange?: (...args: any[]) => any;
35
+ "onUpdate:modelValue"?: (...args: any[]) => any;
36
+ "onUpdate:original"?: (...args: any[]) => any;
37
+ }, {
38
+ inline: boolean;
39
+ }, {}>;
40
+ export default _default;
@@ -0,0 +1,23 @@
1
+ declare function __VLS_template(): {
2
+ default?(_: {}): any;
3
+ };
4
+ declare const __VLS_component: import("vue").DefineComponent<{
5
+ container: {
6
+ type: BooleanConstructor;
7
+ default: boolean;
8
+ };
9
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
10
+ container: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ }>>, {
15
+ container: boolean;
16
+ }, {}>;
17
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
18
+ export default _default;
19
+ type __VLS_WithTemplateSlots<T, S> = T & {
20
+ new (): {
21
+ $slots: S;
22
+ };
23
+ };
@@ -0,0 +1,26 @@
1
+ declare function __VLS_template(): {
2
+ default?(_: {}): any;
3
+ };
4
+ declare const __VLS_component: import("vue").DefineComponent<{
5
+ message: {
6
+ type: StringConstructor;
7
+ default: string;
8
+ };
9
+ hasData: BooleanConstructor;
10
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
11
+ message: {
12
+ type: StringConstructor;
13
+ default: string;
14
+ };
15
+ hasData: BooleanConstructor;
16
+ }>>, {
17
+ message: string;
18
+ hasData: boolean;
19
+ }, {}>;
20
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
21
+ export default _default;
22
+ type __VLS_WithTemplateSlots<T, S> = T & {
23
+ new (): {
24
+ $slots: S;
25
+ };
26
+ };
@@ -0,0 +1,8 @@
1
+ declare const _default: import("vue").DefineComponent<{
2
+ modelValue: BooleanConstructor;
3
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
4
+ modelValue: BooleanConstructor;
5
+ }>>, {
6
+ modelValue: boolean;
7
+ }, {}>;
8
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import { RowProps } from "./types";
2
+ declare function __VLS_template(): {
3
+ default?(_: {}): any;
4
+ };
5
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<RowProps>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<RowProps>>>, {}, {}>;
6
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
7
+ export default _default;
8
+ type __VLS_WithTemplateSlots<T, S> = T & {
9
+ new (): {
10
+ $slots: S;
11
+ };
12
+ };
13
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
14
+ type __VLS_TypePropsToOption<T> = {
15
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
16
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
17
+ } : {
18
+ type: import('vue').PropType<T[K]>;
19
+ required: true;
20
+ };
21
+ };
@@ -0,0 +1,8 @@
1
+ import HaCode from "./Code.vue";
2
+ import HaCol from "./Col.vue";
3
+ import HaCompare from "./Compare.vue";
4
+ import HaContainer from "./Container.vue";
5
+ import HaEmpty from "./Empty.vue";
6
+ import HaProgress from "./Progress.vue";
7
+ import HaRow from "./Row.vue";
8
+ export { HaCode, HaCol, HaCompare, HaContainer, HaEmpty, HaProgress, HaRow };
@@ -0,0 +1,23 @@
1
+ import { Monaco } from "../../plugins";
2
+ /**
3
+ * 代码控件事件
4
+ */
5
+ interface CodeEmit {
6
+ /**
7
+ * 挂载完毕事件
8
+ */
9
+ (event: 'mounted', monaco: typeof Monaco, editor: Monaco.editor.IStandaloneCodeEditor): void;
10
+ /**
11
+ * 值变动事件
12
+ */
13
+ (event: 'change', value: string): void;
14
+ /**
15
+ * 滚动事件
16
+ */
17
+ (event: 'scroll', scrollTop: number): void;
18
+ /**
19
+ * 值更新
20
+ */
21
+ (event: 'update:modelValue', value: any): void;
22
+ }
23
+ export default CodeEmit;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * 代码属性
3
+ */
4
+ interface CodeProps {
5
+ /**
6
+ * 配置
7
+ */
8
+ config?: any;
9
+ /**
10
+ * 是否显示边框
11
+ */
12
+ border?: boolean;
13
+ /**
14
+ * 值
15
+ */
16
+ modelValue?: string;
17
+ }
18
+ export default CodeProps;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * 行属性
3
+ */
4
+ interface RowProps {
5
+ /**
6
+ * 单元格间隙
7
+ */
8
+ gap?: number;
9
+ /**
10
+ * 对齐方向(right)
11
+ */
12
+ direction?: string;
13
+ }
14
+ export default RowProps;
@@ -0,0 +1,4 @@
1
+ import CodeEmit from "./CodeEmit";
2
+ import CodeProps from "./CodeProps";
3
+ import RowProps from "./RowProps";
4
+ export { type CodeEmit, type CodeProps, type RowProps };
@@ -8,6 +8,6 @@ declare class CdnFactory extends Factory<ICdn> {
8
8
  /**
9
9
  * 获取指定CDN实例
10
10
  */
11
- create(type: string, conn?: string): ICdn;
11
+ create(type: string, conn?: string): Promise<ICdn>;
12
12
  }
13
13
  export default CdnFactory;
@@ -0,0 +1,2 @@
1
+ import CdnFactory from "./CdnFactory";
2
+ export { CdnFactory };
@@ -8,11 +8,11 @@ declare class EncoderFactory extends Factory<IEncoder> {
8
8
  /**
9
9
  * 创建执行类型的Hash实例
10
10
  */
11
- create(type: string, conn?: string): IEncoder;
11
+ create(type: string, conn?: string): Promise<IEncoder>;
12
12
  private base64;
13
13
  /**
14
14
  * 获取Base64 编码器对象
15
15
  */
16
- getBase64(): IEncoder;
16
+ getBase64(): Promise<IEncoder>;
17
17
  }
18
18
  export default EncoderFactory;
@@ -0,0 +1,2 @@
1
+ import EncoderFactory from "./EncoderFactory";
2
+ export { EncoderFactory };
@@ -8,6 +8,6 @@ declare class ExcelFactory extends Factory<IExcel> {
8
8
  /**
9
9
  * 获取Excel实例
10
10
  */
11
- create(type: string, conn?: string): IExcel;
11
+ create(type: string, conn?: string): Promise<IExcel>;
12
12
  }
13
13
  export default ExcelFactory;
@@ -1,2 +1,3 @@
1
1
  import type IExcel from "./IExcel";
2
- export { IExcel, };
2
+ import ExcelFactory from "./ExcelFactory";
3
+ export { IExcel, ExcelFactory };
@@ -0,0 +1,2 @@
1
+ import ExplainerFactory from "./ExplainerFactory";
2
+ export { ExplainerFactory };
@@ -1,12 +1,13 @@
1
- import { RequesterFactory } from "../requesters";
2
- import EncoderFactory from "../encoders/EncoderFactory";
3
- import SignerFactory from "../signers/SignerFactory";
4
- import CdnFactory from "../cdns/CdnFactory";
5
- import ExplainerFactory from "../explainers/ExplainerFactory";
6
- import ExcelFactory from "../excels/ExcelFactory";
7
- import FeatureFactory from "../features/FeatureFactory";
8
- import HasherFactory from "../hashers/HasherFactory";
9
- import ProviderFactory from "../providers/ProviderFactory";
1
+ import { HttpFactory } from "../https";
2
+ import { EncoderFactory } from "../encoders";
3
+ import { SignerFactory } from "../signers";
4
+ import { SsoFactory } from "../ssos";
5
+ import { CdnFactory } from "../cdns";
6
+ import { ExplainerFactory } from "../explainers";
7
+ import { ExcelFactory } from "../excels";
8
+ import { FeatureFactory } from "../features";
9
+ import { HasherFactory } from "../hashers";
10
+ import { ProviderFactory } from "../providers";
10
11
  /**
11
12
  * 驱动工厂类
12
13
  */
@@ -48,9 +49,9 @@ declare class DriverFactory {
48
49
  */
49
50
  static getProvider(): ProviderFactory;
50
51
  /**
51
- *获取请求器工厂
52
+ *获取Http请求工厂
52
53
  */
53
- static getRequester(): RequesterFactory;
54
+ static getHttp(): HttpFactory;
54
55
  /**
55
56
  *获取签名工厂
56
57
  */
@@ -58,6 +59,6 @@ declare class DriverFactory {
58
59
  /**
59
60
  *获取SSO工厂
60
61
  */
61
- static getSso(): SignerFactory;
62
+ static getSso(): SsoFactory;
62
63
  }
63
64
  export default DriverFactory;
@@ -11,6 +11,6 @@ declare abstract class Factory<T extends IDriver> implements IFactory<T> {
11
11
  /**
12
12
  * 创建指定类型驱动
13
13
  */
14
- create(type: string, conn?: string): T;
14
+ create(type: string, conn?: string): Promise<T>;
15
15
  }
16
16
  export default Factory;
@@ -9,6 +9,6 @@ interface IFactory<T> {
9
9
  /**
10
10
  * 创建指定类型的实例
11
11
  */
12
- create(type: string, conn?: string): T;
12
+ create(type: string, conn?: string): Promise<T>;
13
13
  }
14
14
  export default IFactory;
@@ -1,2 +1,14 @@
1
1
  import DriverFactory from "./DriverFactory";
2
- export { DriverFactory };
2
+ import { HttpFactory, IHttp } from "../https";
3
+ import { EncoderFactory } from "../encoders";
4
+ /**
5
+ * 默认Http请求对象
6
+ */
7
+ declare let httpFactory: HttpFactory;
8
+ declare let encoderFactory: EncoderFactory;
9
+ declare let http: IHttp;
10
+ /**
11
+ * 设置Http请求对象
12
+ */
13
+ declare let setHttp: () => Promise<void>;
14
+ export { DriverFactory, httpFactory, encoderFactory, http, setHttp };
@@ -8,6 +8,6 @@ declare class FeatureFactory extends Factory<IFeature> {
8
8
  /**
9
9
  * 获取指定特征实例
10
10
  */
11
- create(type: string, conn?: string): IFeature;
11
+ create(type: string, conn?: string): Promise<IFeature>;
12
12
  }
13
13
  export default FeatureFactory;
@@ -1,2 +1,3 @@
1
1
  import type IFeature from "./IFeature";
2
- export { IFeature };
2
+ import FeatureFactory from "./FeatureFactory";
3
+ export { IFeature, FeatureFactory };
@@ -2,11 +2,11 @@ import IHasher from "./IHasher";
2
2
  import Factory from "../factories/Factory";
3
3
  declare class HasherFactory extends Factory<IHasher> {
4
4
  getInstances(): IHasher[];
5
- create(type: string, conn?: string): IHasher;
5
+ create(type: string, conn?: string): Promise<IHasher>;
6
6
  private md5;
7
7
  /**
8
8
  * 获取MD5 Hash对象
9
9
  */
10
- getMd5(): IHasher;
10
+ getMd5(): Promise<IHasher>;
11
11
  }
12
12
  export default HasherFactory;
@@ -1,2 +1,3 @@
1
1
  import type IHasher from "./IHasher";
2
- export { IHasher };
2
+ import HasherFactory from "./HasherFactory";
3
+ export { IHasher, HasherFactory };
@@ -0,0 +1,24 @@
1
+ import IHttp from "./IHttp";
2
+ import HttpRequest from "./entities/HttpRequest";
3
+ import HttpResponse from "./entities/HttpResponse";
4
+ /**
5
+ * 请求器基类
6
+ */
7
+ declare abstract class Http implements IHttp {
8
+ type: string;
9
+ abstract open(conn: string): Promise<void>;
10
+ onRequest: (request: HttpRequest) => void;
11
+ onResponse: (response: HttpResponse) => void;
12
+ get(path: string): Promise<any>;
13
+ sendGet(path: string): 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>;
18
+ abstract send(request: HttpRequest): Promise<HttpResponse>;
19
+ /**
20
+ * 获取请求消息
21
+ */
22
+ getRequest(method: string, path: string, body?: any): HttpRequest;
23
+ }
24
+ export default Http;
@@ -0,0 +1,20 @@
1
+ import IHttp from "./IHttp";
2
+ import Factory from "../factories/Factory";
3
+ /**
4
+ * 请求器工厂类
5
+ */
6
+ declare class HttpFactory extends Factory<IHttp> {
7
+ getInstances(): IHttp[];
8
+ private _default;
9
+ /**
10
+ * 获取默认请求器
11
+ */
12
+ getDefault(): Promise<IHttp>;
13
+ private halo;
14
+ /**
15
+ * 获取本地请求实例
16
+ * 获取完毕后,下游第一行代码就要配置消息服务
17
+ */
18
+ getHalo(): Promise<IHttp>;
19
+ }
20
+ export default HttpFactory;
@@ -0,0 +1,49 @@
1
+ import HttpRequest from "./entities/HttpRequest";
2
+ import HttpResponse from "./entities/HttpResponse";
3
+ import IDriver from "../IDriver";
4
+ /**
5
+ * 请求器接口
6
+ */
7
+ interface IHttp extends IDriver {
8
+ /**
9
+ * 开启
10
+ */
11
+ open(conn: string): Promise<void>;
12
+ /**
13
+ * 请求时执行
14
+ */
15
+ onRequest: (request: HttpRequest) => void;
16
+ /**
17
+ * 响应时执行
18
+ */
19
+ onResponse: (response: HttpResponse) => void;
20
+ /**
21
+ * 发送GET请求,并得到响应体
22
+ */
23
+ get(path: string): Promise<any>;
24
+ /**
25
+ * 发送GET请求
26
+ */
27
+ sendGet(path: string): Promise<HttpResponse>;
28
+ /**
29
+ * 发送Post请求,并得到响应体
30
+ */
31
+ post(path: string, body?: any): Promise<any>;
32
+ /**
33
+ * 发送Post请求
34
+ */
35
+ sendPost(path: string, body?: any): Promise<HttpResponse>;
36
+ /**
37
+ * 发送Patch请求,并得到响应体
38
+ */
39
+ patch(path: string, pairs: any): Promise<any>;
40
+ /**
41
+ * 发送Patch请求
42
+ */
43
+ sendPatch(path: string, pairs: any): Promise<HttpResponse>;
44
+ /**
45
+ * 发送请求
46
+ */
47
+ send(request: HttpRequest): Promise<HttpResponse>;
48
+ }
49
+ export default IHttp;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Http消息基类
3
+ */
4
+ declare abstract class HttpMessage {
5
+ /**
6
+ * 实体数据
7
+ */
8
+ data: any;
9
+ /**
10
+ * 数据体
11
+ */
12
+ body: string;
13
+ /**
14
+ * 请求头
15
+ */
16
+ headers?: [string, string];
17
+ /**
18
+ * 内容类型
19
+ */
20
+ contentType: string;
21
+ /**
22
+ * 获取指定Key的值
23
+ */
24
+ getHeader(key: string): string;
25
+ /**
26
+ * 添加请求头
27
+ */
28
+ addHeaders(headers: {
29
+ [key: string]: string;
30
+ }): void;
31
+ }
32
+ export default HttpMessage;
@@ -0,0 +1,19 @@
1
+ import HttpMessage from "./HttpMessage";
2
+ /**
3
+ * Http请求
4
+ */
5
+ declare class HttpRequest extends HttpMessage {
6
+ /**
7
+ * 请求路径
8
+ */
9
+ path: string;
10
+ /**
11
+ * 请求方法
12
+ */
13
+ method: string;
14
+ /**
15
+ * 实际请求地址
16
+ */
17
+ url?: string;
18
+ }
19
+ export default HttpRequest;
@@ -1,16 +1,13 @@
1
1
  import HttpRequest from "./HttpRequest";
2
+ import HttpMessage from "./HttpMessage";
2
3
  /**
3
4
  * Http响应
4
5
  */
5
- declare class HttpResponse {
6
+ declare class HttpResponse extends HttpMessage {
6
7
  /**
7
8
  * 请求耗时
8
9
  */
9
10
  elapsed: number;
10
- /**
11
- * 请求体
12
- */
13
- body: string;
14
11
  /**
15
12
  * 对应的请求信息
16
13
  */
@@ -1,12 +1,12 @@
1
- import Requester from "../Requester";
1
+ import Http from "../Http";
2
2
  import HttpRequest from "../entities/HttpRequest";
3
3
  import HttpResponse from "../entities/HttpResponse";
4
4
  /**
5
5
  * 默认Http请求器
6
6
  */
7
- declare class DefaultRequester extends Requester {
7
+ declare class DefaultHttp extends Http {
8
8
  type: string;
9
- open(conn: string): void;
9
+ open(conn: string): Promise<void>;
10
10
  send(request: HttpRequest): Promise<HttpResponse>;
11
11
  }
12
- export default DefaultRequester;
12
+ export default DefaultHttp;
@@ -0,0 +1,37 @@
1
+ import Http from "../Http";
2
+ import HttpRequest from "../entities/HttpRequest";
3
+ import HttpResponse from "../entities/HttpResponse";
4
+ import IHttp from "../IHttp";
5
+ /**
6
+ * 框架请求器
7
+ */
8
+ declare class HaloHttp extends Http {
9
+ type: string;
10
+ /**
11
+ * 基准地址
12
+ */
13
+ baseUrl: string;
14
+ /**
15
+ * 默认请求器
16
+ */
17
+ http: IHttp;
18
+ /**
19
+ * 开启
20
+ */
21
+ open(conn: string): Promise<void>;
22
+ /**
23
+ * 发送请求
24
+ */
25
+ send(request: HttpRequest): Promise<HttpResponse>;
26
+ /**
27
+ * 获取请求头
28
+ */
29
+ getHeaders(request: HttpRequest): Promise<{
30
+ [key: string]: string;
31
+ }>;
32
+ /**
33
+ * 处理网络错误和响应错误场景
34
+ */
35
+ handleError(error: any): Promise<never>;
36
+ }
37
+ export default HaloHttp;