halo-fe 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,13 @@
1
1
  import ICdn from "./ICdn";
2
+ import Factory from "../factories/Factory";
2
3
  /**
3
4
  * CDN工厂类
4
5
  */
5
- declare class CdnFactory {
6
+ declare class CdnFactory extends Factory<ICdn> {
7
+ getInstances(): ICdn[];
6
8
  /**
7
9
  * 获取指定CDN实例
8
10
  */
9
- static create(type: string): ICdn;
11
+ create(type: string, conn?: string): ICdn;
10
12
  }
11
13
  export default CdnFactory;
@@ -1,16 +1,18 @@
1
1
  import IEncoder from "./IEncoder";
2
+ import Factory from "../factories/Factory";
2
3
  /**
3
4
  * 编码器工厂
4
5
  */
5
- declare class EncoderFactory {
6
+ declare class EncoderFactory extends Factory<IEncoder> {
7
+ getInstances(): IEncoder[];
6
8
  /**
7
9
  * 创建执行类型的Hash实例
8
10
  */
9
- static create(type: string): IEncoder;
10
- private static base64;
11
+ create(type: string, conn?: string): IEncoder;
12
+ private base64;
11
13
  /**
12
14
  * 获取Base64 编码器对象
13
15
  */
14
- static getBase64(): IEncoder;
16
+ getBase64(): IEncoder;
15
17
  }
16
18
  export default EncoderFactory;
@@ -1,11 +1,13 @@
1
1
  import IExcel from "./IExcel";
2
+ import Factory from "../factories/Factory";
2
3
  /**
3
4
  * Excel工厂
4
5
  */
5
- declare class ExcelFactory {
6
+ declare class ExcelFactory extends Factory<IExcel> {
7
+ getInstances(): IExcel[];
6
8
  /**
7
9
  * 获取Excel实例
8
10
  */
9
- static create(type: string): IExcel;
11
+ create(type: string, conn?: string): IExcel;
10
12
  }
11
13
  export default ExcelFactory;
@@ -1,4 +1,5 @@
1
1
  import IExplainer from "./IExplainer";
2
2
  declare class Explainer implements IExplainer {
3
+ type: string;
3
4
  }
4
5
  export default Explainer;
@@ -1 +1,6 @@
1
- export {};
1
+ import Factory from "../factories/Factory";
2
+ import IExplainer from "./IExplainer";
3
+ declare class ExplainerFactory extends Factory<IExplainer> {
4
+ getInstances(): IExplainer[];
5
+ }
6
+ export default ExplainerFactory;
@@ -1,3 +1,4 @@
1
- declare class IExplainer {
1
+ import IDriver from "../IDriver";
2
+ interface IExplainer extends IDriver {
2
3
  }
3
4
  export default IExplainer;
@@ -1,4 +1,12 @@
1
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";
2
10
  /**
3
11
  * 驱动工厂类
4
12
  */
@@ -11,9 +19,45 @@ declare class DriverFactory {
11
19
  * 获取并缓存工厂实例
12
20
  */
13
21
  static create(name: string, type: any): any;
22
+ /**
23
+ *获取CDN工厂
24
+ */
25
+ static getCdn(): CdnFactory;
26
+ /**
27
+ *获取编码器工厂
28
+ */
29
+ static getEncoder(): EncoderFactory;
30
+ /**
31
+ *获取Excel工厂
32
+ */
33
+ static getExcel(): ExcelFactory;
34
+ /**
35
+ *获取Explainer工厂
36
+ */
37
+ static getExplainer(): ExplainerFactory;
38
+ /**
39
+ *获取特征工厂
40
+ */
41
+ static getFeature(): FeatureFactory;
42
+ /**
43
+ *获取哈希工厂
44
+ */
45
+ static getHasher(): HasherFactory;
46
+ /**
47
+ *获取提供程序工厂
48
+ */
49
+ static getProvider(): ProviderFactory;
14
50
  /**
15
51
  *获取请求器工厂
16
52
  */
17
53
  static getRequester(): RequesterFactory;
54
+ /**
55
+ *获取签名工厂
56
+ */
57
+ static getSigner(): SignerFactory;
58
+ /**
59
+ *获取SSO工厂
60
+ */
61
+ static getSso(): SignerFactory;
18
62
  }
19
63
  export default DriverFactory;
@@ -1,8 +1,16 @@
1
1
  import IFactory from "./IFactory";
2
+ import IDriver from "../IDriver";
2
3
  /**
3
4
  * 工厂基类
4
5
  */
5
- declare abstract class Factory<T> implements IFactory<T> {
6
- abstract create(type: string): T;
6
+ declare abstract class Factory<T extends IDriver> implements IFactory<T> {
7
+ /**
8
+ * 获取当前驱动所有实例
9
+ */
10
+ abstract getInstances(): T[];
11
+ /**
12
+ * 创建指定类型驱动
13
+ */
14
+ create(type: string, conn?: string): T;
7
15
  }
8
16
  export default Factory;
@@ -2,9 +2,13 @@
2
2
  * 工厂接口
3
3
  */
4
4
  interface IFactory<T> {
5
+ /**
6
+ * 获取当前驱动所有实例
7
+ */
8
+ getInstances(): T[];
5
9
  /**
6
10
  * 创建指定类型的实例
7
11
  */
8
- create(type: string): T;
12
+ create(type: string, conn?: string): T;
9
13
  }
10
14
  export default IFactory;
@@ -1,11 +1,13 @@
1
1
  import IFeature from "./IFeature";
2
+ import Factory from "../factories/Factory";
2
3
  /**
3
4
  * 特征工厂类
4
5
  */
5
- declare class FeatureFactory {
6
+ declare class FeatureFactory extends Factory<IFeature> {
7
+ getInstances(): IFeature[];
6
8
  /**
7
9
  * 获取指定特征实例
8
10
  */
9
- static create(type: string): IFeature;
11
+ create(type: string, conn?: string): IFeature;
10
12
  }
11
13
  export default FeatureFactory;
@@ -1,13 +1,12 @@
1
1
  import IHasher from "./IHasher";
2
- declare class HasherFactory {
3
- /**
4
- * 创建执行类型的Hash实例
5
- */
6
- static create(type: string): IHasher;
7
- private static md5;
2
+ import Factory from "../factories/Factory";
3
+ declare class HasherFactory extends Factory<IHasher> {
4
+ getInstances(): IHasher[];
5
+ create(type: string, conn?: string): IHasher;
6
+ private md5;
8
7
  /**
9
8
  * 获取MD5 Hash对象
10
9
  */
11
- static getMd5(): IHasher;
10
+ getMd5(): IHasher;
12
11
  }
13
12
  export default HasherFactory;
@@ -1,11 +1,18 @@
1
1
  import IProvider from "./IProvider";
2
+ import Factory from "../factories/Factory";
2
3
  /**
3
4
  * 数据库提供程序工厂类
4
5
  */
5
- declare class ProviderFactory {
6
+ declare class ProviderFactory extends Factory<IProvider> {
7
+ getInstances(): IProvider[];
6
8
  /**
7
9
  * 获取指定类型的提供程序
8
10
  */
9
- static create(type: string): IProvider;
11
+ create(type: string, conn?: string): IProvider;
12
+ private _default;
13
+ /**
14
+ * 获取并开启 指定类型的驱动程序
15
+ */
16
+ getDefault(type: string, store?: string): Promise<IProvider>;
10
17
  }
11
18
  export default ProviderFactory;
@@ -10,12 +10,16 @@ interface IRequester extends IDriver {
10
10
  */
11
11
  open(conn: string): void;
12
12
  /**
13
- * 发送请求
13
+ * 发送Post请求
14
14
  */
15
- send(request: HttpRequest): Promise<HttpResponse>;
15
+ post<T>(path: string, body: any): Promise<T>;
16
16
  /**
17
17
  * 发送Post请求
18
18
  */
19
- post(url: string, body: any): Promise<HttpResponse>;
19
+ post(path: string, body: any): Promise<HttpResponse>;
20
+ /**
21
+ * 发送请求
22
+ */
23
+ send(request: HttpRequest): Promise<HttpResponse>;
20
24
  }
21
25
  export default IRequester;
@@ -7,6 +7,7 @@ import HttpResponse from "./entities/HttpResponse";
7
7
  declare abstract class Requester implements IRequester {
8
8
  type: string;
9
9
  abstract open(conn: string): void;
10
+ post(path: string, body: any): Promise<HttpResponse>;
10
11
  abstract send(request: HttpRequest): Promise<HttpResponse>;
11
12
  }
12
13
  export default Requester;
@@ -1,13 +1,11 @@
1
- import DefaultRequester from "./implements/DefaultRequester";
2
1
  import IRequester from "./IRequester";
3
- import MkRequester from "./implements/MkRequester";
4
2
  import Factory from "../factories/Factory";
5
- import LocalRequester from "./implements/LocalRequester";
6
3
  /**
7
4
  * 请求器工厂类
8
5
  */
9
6
  declare class RequesterFactory extends Factory<IRequester> {
10
- create(type: string): DefaultRequester | MkRequester | LocalRequester;
7
+ getInstances(): IRequester[];
8
+ create(type: string, conn?: string): IRequester;
11
9
  private _default;
12
10
  /**
13
11
  * 获取默认请求器
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Http请求
3
3
  */
4
- type HttpRequest = {
4
+ declare class HttpRequest {
5
5
  /**
6
6
  * 请求路径
7
7
  */
@@ -30,5 +30,5 @@ type HttpRequest = {
30
30
  * 请求体
31
31
  */
32
32
  body: string;
33
- };
33
+ }
34
34
  export default HttpRequest;
@@ -2,7 +2,7 @@ import HttpRequest from "./HttpRequest";
2
2
  /**
3
3
  * Http响应
4
4
  */
5
- type HttpResponse = {
5
+ declare class HttpResponse {
6
6
  /**
7
7
  * 请求耗时
8
8
  */
@@ -15,5 +15,5 @@ type HttpResponse = {
15
15
  * 对应的请求信息
16
16
  */
17
17
  request: HttpRequest;
18
- };
18
+ }
19
19
  export default HttpResponse;
@@ -1,11 +1,13 @@
1
1
  import ISigner from "./ISigner";
2
+ import Factory from "../factories/Factory";
2
3
  /**
3
4
  * 签名工厂类
4
5
  */
5
- declare class SignerFactory {
6
+ declare class SignerFactory extends Factory<ISigner> {
7
+ getInstances(): ISigner[];
6
8
  /**
7
9
  * 获取指定签名实例
8
10
  */
9
- static create(type: string): ISigner;
11
+ create(type: string, conn?: string): ISigner;
10
12
  }
11
13
  export default SignerFactory;
@@ -1,11 +1,8 @@
1
+ import IDriver from "../IDriver";
1
2
  /**
2
3
  * SSO接口
3
4
  */
4
- interface ISso {
5
- /**
6
- * 类型
7
- */
8
- type: string;
5
+ interface ISso extends IDriver {
9
6
  /**
10
7
  * 开启连接
11
8
  */
@@ -1,11 +1,17 @@
1
1
  import ISso from "./ISso";
2
+ import Factory from "../factories/Factory";
2
3
  /**
3
4
  * SSO工厂类
5
+ * @extends {Factory<ISso>}
4
6
  */
5
- declare class SsoFactory {
7
+ declare class SsoFactory extends Factory<ISso> {
8
+ /**
9
+ * @extends {getInstances}
10
+ */
11
+ getInstances(): ISso[];
6
12
  /**
7
13
  * 获取指定SSO实例
8
14
  */
9
- static getSso(type: string): ISso;
15
+ create(type: string, conn?: string): ISso;
10
16
  }
11
17
  export default SsoFactory;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "halo-fe",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Halo front end sdk",
5
5
  "scripts": {
6
6
  "halo-fe:tsc": "vue-tsc",