halo-fe 1.0.25 → 1.0.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. package/README.md +3 -1
  2. package/dist/assets/{liquidjs-B8dqQyVv.js → liquidjs-C2HVw1Ra.js} +82 -81
  3. package/dist/main.js +3482 -3071
  4. package/dist/style.css +1 -1
  5. package/esm/coms/@types/PagerEmit.d.ts +11 -0
  6. package/esm/coms/@types/PagerProps.d.ts +18 -0
  7. package/esm/coms/@types/SocketProgressProps.d.ts +8 -0
  8. package/esm/coms/@types/TableEmit.d.ts +10 -0
  9. package/esm/coms/@types/TableProps.d.ts +14 -2
  10. package/esm/coms/@types/index.d.ts +4 -1
  11. package/esm/coms/controls/@types/CodeIntelli.d.ts +6 -0
  12. package/esm/coms/controls/@types/CodeProps.d.ts +31 -2
  13. package/esm/coms/controls/@types/Range.d.ts +1 -1
  14. package/esm/coms/controls/Code.vue.d.ts +15 -25
  15. package/esm/coms/layouts/Row.vue.d.ts +2 -1
  16. package/esm/coms/pagers/Index.vue.d.ts +8 -1
  17. package/esm/coms/pagers/index.d.ts +2 -2
  18. package/esm/coms/progresses/Circle.vue.d.ts +2 -0
  19. package/esm/coms/progresses/Index.vue.d.ts +6 -3
  20. package/esm/coms/progresses/Spinner.vue.d.ts +20 -0
  21. package/esm/coms/progresses/index.d.ts +2 -1
  22. package/esm/coms/tables/Index.vue.d.ts +22 -3
  23. package/esm/drivers/@types/IOpen.d.ts +1 -1
  24. package/esm/drivers/builders/BuilderFactory.d.ts +1 -1
  25. package/esm/drivers/cdns/Cdn.d.ts +1 -1
  26. package/esm/drivers/cdns/CdnFactory.d.ts +1 -1
  27. package/esm/drivers/cdns/ICdn.d.ts +2 -6
  28. package/esm/drivers/encoders/Encoder.d.ts +1 -1
  29. package/esm/drivers/encoders/EncoderFactory.d.ts +2 -2
  30. package/esm/drivers/encoders/IEncoder.d.ts +2 -5
  31. package/esm/drivers/encoders/implement/Base64Encoder.d.ts +1 -1
  32. package/esm/drivers/excels/Excel.d.ts +1 -1
  33. package/esm/drivers/excels/ExcelFactory.d.ts +1 -1
  34. package/esm/drivers/excels/implements/XlsxExcel.d.ts +1 -1
  35. package/esm/drivers/explainers/ExplainerFactory.d.ts +2 -2
  36. package/esm/drivers/features/FeatureFactory.d.ts +2 -2
  37. package/esm/drivers/features/IFeature.d.ts +2 -6
  38. package/esm/drivers/features/implements/ExpressionFeature.d.ts +1 -1
  39. package/esm/drivers/features/implements/I18NFeature.d.ts +1 -1
  40. package/esm/drivers/features/implements/SortFeature.d.ts +1 -1
  41. package/esm/drivers/hashers/Hasher.d.ts +1 -1
  42. package/esm/drivers/hashers/HasherFactory.d.ts +2 -2
  43. package/esm/drivers/hashers/IHasher.d.ts +2 -5
  44. package/esm/drivers/hashers/implement/Md5Hasher.d.ts +1 -1
  45. package/esm/drivers/hashers/implement/Sha256Hasher.d.ts +1 -1
  46. package/esm/drivers/https/Http.d.ts +10 -6
  47. package/esm/drivers/https/HttpFactory.d.ts +2 -7
  48. package/esm/drivers/https/IHttp.d.ts +12 -12
  49. package/esm/drivers/https/entities/HttpResponse.d.ts +5 -1
  50. package/esm/drivers/https/implements/DefaultHttp.d.ts +1 -1
  51. package/esm/drivers/https/implements/HaloHttp.d.ts +1 -1
  52. package/esm/drivers/https/implements/MkHttp.d.ts +1 -1
  53. package/esm/drivers/i18ns/I18n.d.ts +1 -1
  54. package/esm/drivers/i18ns/I18nFactory.d.ts +1 -1
  55. package/esm/drivers/i18ns/implements/DefaultI18n.d.ts +1 -1
  56. package/esm/drivers/index.d.ts +50 -0
  57. package/esm/drivers/messengers/MessengerFactory.d.ts +2 -2
  58. package/esm/drivers/providers/IProvider.d.ts +19 -15
  59. package/esm/drivers/providers/Provider.d.ts +11 -9
  60. package/esm/drivers/providers/ProviderFactory.d.ts +5 -9
  61. package/esm/drivers/providers/implements/CookieProvider.d.ts +8 -8
  62. package/esm/drivers/providers/implements/IndexedDbProvider.d.ts +20 -10
  63. package/esm/drivers/providers/implements/StorageProvider.d.ts +8 -8
  64. package/esm/drivers/signers/ISigner.d.ts +1 -1
  65. package/esm/drivers/signers/Signer.d.ts +1 -1
  66. package/esm/drivers/signers/SignerFactory.d.ts +2 -2
  67. package/esm/drivers/signers/implements/DefaultSigner.d.ts +1 -1
  68. package/esm/drivers/sockets/@types/SubscribedWindow.d.ts +16 -0
  69. package/esm/drivers/sockets/@types/index.d.ts +2 -0
  70. package/esm/drivers/sockets/ISocket.d.ts +7 -3
  71. package/esm/drivers/sockets/Socket.d.ts +10 -1
  72. package/esm/drivers/sockets/SocketFactory.d.ts +1 -1
  73. package/esm/drivers/sockets/entities/SocketProgress.d.ts +34 -0
  74. package/esm/drivers/sockets/entities/SocketResponse.d.ts +26 -0
  75. package/esm/drivers/sockets/entities/index.d.ts +3 -0
  76. package/esm/drivers/sockets/implement/DefaultSocket.d.ts +0 -2
  77. package/esm/drivers/sockets/index.d.ts +3 -1
  78. package/esm/drivers/ssos/ISso.d.ts +1 -1
  79. package/esm/drivers/ssos/Sso.d.ts +1 -1
  80. package/esm/drivers/ssos/SsoFactory.d.ts +2 -2
  81. package/esm/drivers/ssos/implements/AnonymousSso.d.ts +1 -1
  82. package/esm/drivers/ssos/implements/BearerSso.d.ts +1 -1
  83. package/esm/drivers/ssos/implements/NioSso.d.ts +1 -1
  84. package/esm/drivers/ssos/implements/SecretSso.d.ts +1 -1
  85. package/esm/drivers/ssos/implements/WeiXinSso.d.ts +1 -1
  86. package/esm/drivers/tasks/ITask.d.ts +7 -3
  87. package/esm/drivers/tasks/Task.d.ts +2 -1
  88. package/esm/drivers/tasks/TaskFactory.d.ts +2 -2
  89. package/esm/drivers/tasks/implement/MemoryTask.d.ts +5 -3
  90. package/esm/drivers/templates/TemplateFactory.d.ts +2 -2
  91. package/esm/drivers/util/UtilFactory.d.ts +1 -1
  92. package/esm/drivers/util/implements/ArrayUtil.d.ts +5 -5
  93. package/esm/drivers/util/implements/EventUtil.d.ts +6 -6
  94. package/esm/drivers/util/implements/JsonUtil.d.ts +5 -0
  95. package/esm/drivers/util/implements/SignUtil.d.ts +1 -1
  96. package/esm/drivers/util/implements/StringUtil.d.ts +1 -1
  97. package/esm/drivers/utilities/IUtility.d.ts +3 -0
  98. package/esm/drivers/utilities/Utility.d.ts +3 -0
  99. package/esm/drivers/utilities/UtilityFactory.d.ts +6 -6
  100. package/esm/drivers/utilities/implement/EventUtility.d.ts +3 -6
  101. package/esm/drivers/utilities/implement/SaveUtility.d.ts +48 -3
  102. package/esm/drivers/videos/VideoFactory.d.ts +2 -2
  103. package/esm/drivers/voices/VoiceFactory.d.ts +2 -2
  104. package/esm/factory/Factories.d.ts +99 -0
  105. package/esm/factory/Factory.d.ts +41 -0
  106. package/esm/factory/IFactory.d.ts +40 -0
  107. package/esm/factory/Utils.d.ts +29 -0
  108. package/esm/factory/index.d.ts +4 -0
  109. package/esm/factorying/Factory.d.ts +3 -3
  110. package/esm/factorying/IFactory.d.ts +1 -1
  111. package/esm/main.d.ts +1 -2
  112. package/esm/repos/Repo.d.ts +5 -0
  113. package/esm/repos/RepoFactory.d.ts +20 -1
  114. package/esm/repos/implements/PageRepo.d.ts +30 -0
  115. package/esm/repos/implements/QueryRepo.d.ts +64 -0
  116. package/esm/repos/implements/SettingRepo.d.ts +1 -0
  117. package/esm/repos/index.d.ts +10 -1
  118. package/esm/svcs/SvcFactory.d.ts +1 -1
  119. package/esm/svcs/implement/ConfigSvc.d.ts +9 -9
  120. package/esm/svcs/implement/DriverSvc.d.ts +1 -35
  121. package/esm/svcs/index.d.ts +6 -15
  122. package/package.json +9 -9
@@ -20,19 +20,23 @@ declare abstract class Http implements IHttp {
20
20
  * 编码器
21
21
  */
22
22
  encoder: IEncoder;
23
- open(conn: string): Promise<void>;
23
+ /**
24
+ * 原型方法,保证子类可以通过super调用
25
+ * VIP:箭头函数定义的是实例方法,不在原型链上,子类无法通过super调用
26
+ */
27
+ openAsync(conn: string): Promise<void>;
24
28
  get onRequest(): (request: HttpRequest) => Promise<void>;
25
29
  set onRequest(value: (request: HttpRequest) => Promise<void>);
26
30
  get onResponse(): (response: HttpResponse) => Promise<void>;
27
31
  set onResponse(value: (response: HttpResponse) => Promise<void>);
28
32
  prepareAsync(request: HttpRequest, variables: string[]): Promise<void>;
29
33
  get: (path: string, params?: any) => Promise<any>;
30
- sendGet: (path: string, params?: any) => Promise<HttpResponse>;
34
+ getAsync: (path: string, params?: any) => Promise<HttpResponse>;
31
35
  post: (path: string, body: any) => Promise<any>;
32
- sendPost: (path: string, body?: any) => Promise<HttpResponse>;
33
- patch: (path: string) => Promise<any>;
34
- sendPatch: (path: string, pairs?: any) => Promise<HttpResponse>;
35
- send: (request: HttpRequest) => Promise<HttpResponse>;
36
+ postAsync: (path: string, body?: any) => Promise<HttpResponse>;
37
+ patch: (path: string, body?: any) => Promise<any>;
38
+ patchAsync: (path: string, body?: any) => Promise<HttpResponse>;
39
+ sendAsync: (request: HttpRequest) => Promise<HttpResponse>;
36
40
  /**
37
41
  * 获取请求消息
38
42
  */
@@ -1,15 +1,10 @@
1
1
  import IHttp from "./IHttp";
2
- import Factory from "../../factorying/Factory";
3
- import { Ref } from "../../plugins";
2
+ import Factory from "../../factory/Factory";
4
3
  /**
5
4
  * 请求器工厂类
6
5
  */
7
6
  declare class HttpFactory extends Factory<IHttp> {
8
- get instances(): IHttp[];
9
- /**
10
- * 创建并开启
11
- */
12
- createById(id: number, driverRef?: Ref<any>): Promise<IHttp>;
7
+ open(): void;
13
8
  /**
14
9
  * 获取默认请求器
15
10
  */
@@ -18,32 +18,32 @@ interface IHttp extends IDriver, IOpen {
18
18
  */
19
19
  prepareAsync(request: HttpRequest, variables: string[]): Promise<void>;
20
20
  /**
21
- * 发送GET请求,并得到响应体
21
+ * 发送GET请求,得到响应体
22
22
  */
23
23
  get(path: string, params?: any): Promise<any>;
24
24
  /**
25
- * 发送GET请求
25
+ * 发送GET请求,得到响应
26
26
  */
27
- sendGet(path: string, params?: any): Promise<HttpResponse>;
27
+ getAsync(path: string, params?: any): Promise<HttpResponse>;
28
28
  /**
29
- * 发送Post请求,并得到响应体
29
+ * 发送Post请求,得到响应体
30
30
  */
31
31
  post(path: string, body?: any): Promise<any>;
32
32
  /**
33
- * 发送Post请求
33
+ * 发送Post请求,得到响应
34
34
  */
35
- sendPost(path: string, body?: any): Promise<HttpResponse>;
35
+ postAsync(path: string, body?: any): Promise<HttpResponse>;
36
36
  /**
37
- * 发送Patch请求,并得到响应体
37
+ * 发送Patch请求,得到响应体
38
38
  */
39
- patch(path: string, pairs: any): Promise<any>;
39
+ patch(path: string, body: any): Promise<any>;
40
40
  /**
41
- * 发送Patch请求
41
+ * 发送Patch请求,得到响应
42
42
  */
43
- sendPatch(path: string, pairs: any): Promise<HttpResponse>;
43
+ patchAsync(path: string, body: any): Promise<HttpResponse>;
44
44
  /**
45
- * 发送请求
45
+ * 发送请求,得到响应
46
46
  */
47
- send(request: HttpRequest): Promise<HttpResponse>;
47
+ sendAsync(request: HttpRequest): Promise<HttpResponse>;
48
48
  }
49
49
  export default IHttp;
@@ -7,7 +7,7 @@ declare class HttpResponse extends HttpMessage {
7
7
  /**
8
8
  * 是否成功
9
9
  */
10
- success: boolean;
10
+ ok: boolean;
11
11
  /**
12
12
  * 错误消息
13
13
  */
@@ -16,6 +16,10 @@ declare class HttpResponse extends HttpMessage {
16
16
  * 请求耗时(ms)
17
17
  */
18
18
  elapsed: number;
19
+ /**
20
+ * 内容长度
21
+ */
22
+ length: number;
19
23
  /**
20
24
  * 响应状态码
21
25
  */
@@ -14,7 +14,7 @@ declare class DefaultHttp extends Http {
14
14
  set onRequest(value: (request: HttpRequest) => Promise<void>);
15
15
  get onResponse(): (response: HttpResponse) => Promise<void>;
16
16
  set onResponse(value: (response: HttpResponse) => Promise<void>);
17
- send: (request: HttpRequest) => Promise<HttpResponse>;
17
+ sendAsync: (request: HttpRequest) => Promise<HttpResponse>;
18
18
  /**
19
19
  * 使用Fetch发送请求,谷歌插件场景专用
20
20
  */
@@ -35,7 +35,7 @@ declare class HaloHttp extends Http {
35
35
  * 单点登录配置
36
36
  */
37
37
  signer: ISigner;
38
- open: (conn: string) => Promise<void>;
38
+ openAsync: (conn: string) => Promise<void>;
39
39
  prepareAsync: (request: HttpRequest, variables: string[]) => Promise<void>;
40
40
  /**
41
41
  * 处理网络错误和响应错误场景
@@ -25,7 +25,7 @@ declare class MkHttp extends Http {
25
25
  /**
26
26
  * 危险操作,会暴露敏感信息
27
27
  */
28
- open: (conn: string) => Promise<void>;
28
+ openAsync: (conn: string) => Promise<void>;
29
29
  /**
30
30
  * 危险操作,会暴露敏感信息
31
31
  */
@@ -12,7 +12,7 @@ declare abstract class I18n implements II18n {
12
12
  * 已加载的语言集合
13
13
  */
14
14
  loaded: string[];
15
- open(conn?: string): Promise<void>;
15
+ openAsync(conn?: string): Promise<void>;
16
16
  t: (key: string, params?: any) => string;
17
17
  abstract translate(key: string, params: any): string;
18
18
  abstract t_exists(key: string): boolean;
@@ -1,4 +1,4 @@
1
- import Factory from "../../factorying/Factory";
1
+ import Factory from "../../factory/Factory";
2
2
  import II18n from "./II18n";
3
3
  /**
4
4
  * 多语言工厂
@@ -5,7 +5,7 @@ import I18n from "../I18n";
5
5
  */
6
6
  declare class DefaultI18n extends I18n {
7
7
  type: string;
8
- open(conn?: string): Promise<void>;
8
+ openAsync(conn?: string): Promise<void>;
9
9
  translate: (key: string, params?: any) => string;
10
10
  t_exists: (key: string) => boolean;
11
11
  load: (lang: string) => Promise<void>;
@@ -1,3 +1,53 @@
1
+ import { IEncoder } from "./encoders";
2
+ import { ICdn } from "./cdns";
3
+ import { IHttp } from "./https";
4
+ import { II18n } from "./i18ns";
5
+ import { IHasher } from "./hashers";
6
+ import { ISocket } from "./sockets";
7
+ import { ITemplate } from "./templates";
8
+ import { IMessenger } from "./messengers";
9
+ import { CreateFeOptions } from "../@types";
10
+ /**
11
+ * 默认base64编码
12
+ */
13
+ declare let base64: IEncoder;
14
+ /**
15
+ * CDN加载器
16
+ */
17
+ declare let cdn: ICdn;
18
+ /**
19
+ * 默认Http请求对象
20
+ */
21
+ declare let http: IHttp;
22
+ /**
23
+ * 多语言翻译对象
24
+ */
25
+ declare let i18n: II18n;
26
+ /**
27
+ * MD5 hash计算
28
+ */
29
+ declare let md5: IHasher;
30
+ /**
31
+ * Socket通信
32
+ */
33
+ declare let socket: ISocket;
34
+ /**
35
+ * 默认模板引擎
36
+ */
37
+ declare let template: ITemplate;
38
+ /**
39
+ * 初始化消息对象,保证后续更新能够被同步更新
40
+ */
41
+ declare let messenger: IMessenger;
42
+ /**
43
+ * 初始化默认驱动实例
44
+ */
45
+ declare let initDriverAsync: (options: CreateFeOptions) => Promise<void>;
46
+ /**
47
+ * 提取可导出的翻译方法,当i18n实例变化后,导出的方案会跟着变化?
48
+ */
49
+ 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;
50
+ export { base64, cdn, http, i18n, md5, socket, template, messenger, initDriverAsync, t, t_exists, t_sys, t_enum, t_field, t_field_choose_placeholder, t_field_placeholder, t_table, t_module, t_menu };
1
51
  export * from "./@types";
2
52
  export * from "./bridges";
3
53
  export * from "./builders";
@@ -1,10 +1,10 @@
1
- import Factory from "../../factorying/Factory";
1
+ import Factory from "../../factory/Factory";
2
2
  import IMessenger from "./IMessenger";
3
3
  /**
4
4
  * 消息工厂
5
5
  */
6
6
  declare class MessengerFactory extends Factory<IMessenger> {
7
- get instances(): IMessenger[];
7
+ open(): void;
8
8
  /**
9
9
  * 获取控制台消息提示类型
10
10
  */
@@ -1,48 +1,52 @@
1
- import { IDriver } from "../@types";
1
+ import { IDriver, IOpen } from "../@types";
2
2
  /**
3
3
  * 数据库提供程序接口
4
4
  */
5
- interface IProvider extends IDriver {
5
+ interface IProvider extends IDriver, IOpen {
6
6
  /**
7
7
  * 类型
8
8
  */
9
9
  type: string;
10
10
  /**
11
- * 开启数据库驱动
11
+ * 创建指定仓储,不指定行内key路径
12
12
  */
13
- openAsync(conn: string): Promise<number>;
13
+ createAsync(table: string): Promise<any>;
14
14
  /**
15
- * 创建指定仓储,不指定行内key路径
15
+ * 查询强类型数据
16
16
  */
17
- createAsync(store: string): Promise<any>;
17
+ getEntity<T>(table: string, key: any): Promise<T>;
18
18
  /**
19
19
  * 查询数据
20
20
  */
21
- getAsync(id: any): Promise<any>;
21
+ getAsync(table: string, key: any): Promise<any>;
22
22
  /**
23
- * 查询强类型数据
23
+ * 获取所有key
24
24
  */
25
- getEntity<T>(id: any): Promise<T>;
25
+ getKeysAsync(table: string): Promise<any[]>;
26
26
  /**
27
27
  * 添加数据
28
28
  */
29
- insertAsync(id: any, entity: any): Promise<any>;
29
+ insertAsync(table: string, key: any, entity: any): Promise<any>;
30
30
  /**
31
31
  * 修改数据
32
32
  */
33
- updateAsync(id: any, entity: any): Promise<any>;
33
+ updateAsync(table: string, key: any, entity: any): Promise<any>;
34
+ /**
35
+ * 保存强类型
36
+ */
37
+ saveEntity<T>(table: string, key: any, entity: T): Promise<any>;
34
38
  /**
35
39
  * 保存数据,entity中的id会被自动赋值成id,所以entity的id属性将不再能使用
36
40
  */
37
- saveAsync(id: any, entity: any): Promise<any>;
41
+ saveAsync(table: string, key: any, entity: any): Promise<any>;
38
42
  /**
39
- * 保存强类型
43
+ * 替换指定key的数据,到新key上,并返回替换后的数据
40
44
  */
41
- saveEntity<T>(id: any, entity: T): Promise<any>;
45
+ replaceEntityAsync(table: string, key: any, newKey: any): Promise<void>;
42
46
  /**
43
47
  * 删除数据
44
48
  */
45
- deleteAsync(id: any): Promise<any>;
49
+ deleteAsync(table: string, key: any): Promise<any>;
46
50
  /**
47
51
  * 提交事务
48
52
  */
@@ -4,15 +4,17 @@ import IProvider from "./IProvider";
4
4
  */
5
5
  declare abstract class Provider implements IProvider {
6
6
  type: string;
7
- abstract createAsync(store: string): Promise<any>;
8
- abstract deleteAsync(id: any): Promise<any>;
9
- abstract getAsync(id: any): Promise<any>;
10
- abstract getEntity<T>(id: any): Promise<T>;
11
- abstract insertAsync(id: any, entity: any): Promise<any>;
12
- abstract openAsync(conn: string): Promise<number>;
13
- abstract saveAsync(id: any, entity: any): Promise<any>;
14
- abstract saveEntity<T>(id: any, entity: T): Promise<any>;
15
- abstract updateAsync(id: any, entity: any): Promise<any>;
7
+ openAsync(conn: string): Promise<void>;
8
+ abstract createAsync(kind: string): Promise<any>;
9
+ abstract deleteAsync(kind: string, key: any): Promise<any>;
10
+ abstract getEntity<T>(kind: string, key: any): Promise<T>;
11
+ abstract getAsync(kind: string, key: any): Promise<any>;
12
+ abstract getKeysAsync(table: string): Promise<any[]>;
13
+ abstract insertAsync(kind: string, key: any, entity: any): Promise<any>;
14
+ abstract updateAsync(kind: string, key: any, entity: any): Promise<any>;
15
+ abstract saveEntity<T>(kind: string, key: any, entity: T): Promise<any>;
16
+ abstract saveAsync(kind: string, key: any, entity: any): Promise<any>;
17
+ replaceEntityAsync(table: string, key: any, newKey: any): Promise<void>;
16
18
  abstract commit(): void;
17
19
  abstract dispose(): void;
18
20
  }
@@ -1,22 +1,18 @@
1
1
  import IProvider from "./IProvider";
2
- import Factory from "../../factorying/Factory";
2
+ import Factory from "../../factory/Factory";
3
3
  /**
4
4
  * 数据库提供程序工厂类
5
5
  */
6
6
  declare class ProviderFactory extends Factory<IProvider> {
7
- get instances(): IProvider[];
8
- /**
9
- * 获取指定类型的提供程序
10
- */
11
- createAsync(type: string, conn?: string): Promise<IProvider>;
7
+ open(): void;
12
8
  private _default;
13
9
  /**
14
- * 获取并开启默认驱动程序
10
+ * 获取默认驱动程序,并自动决定创建指定名称的仓储
15
11
  */
16
- getDefault(store: string): Promise<IProvider>;
12
+ getDefaultAsync(table: string): Promise<IProvider>;
17
13
  /**
18
14
  * 获取默认Storage提供程序
19
15
  */
20
- getStorage(): Promise<IProvider>;
16
+ get storage(): IProvider;
21
17
  }
22
18
  export default ProviderFactory;
@@ -5,14 +5,14 @@ import Provider from "../Provider";
5
5
  declare class CookieProvider extends Provider {
6
6
  type: string;
7
7
  openAsync(conn: string): Promise<number>;
8
- createAsync(store: string): Promise<any>;
9
- deleteAsync(id: any): Promise<any>;
10
- getAsync(id: any): Promise<any>;
11
- getEntity<T>(id: any): Promise<T>;
12
- saveEntity<T>(id: any, entity: T): Promise<any>;
13
- insertAsync(id: any, entity: any): Promise<any>;
14
- saveAsync(id: any, entity: any): Promise<any>;
15
- updateAsync(id: any, entity: any): Promise<any>;
8
+ createAsync(kind: string): Promise<any>;
9
+ deleteAsync(kind: string, key: any): Promise<any>;
10
+ getAsync(kind: string, key: any): Promise<any>;
11
+ getEntity<T>(kind: string, key: any): Promise<T>;
12
+ insertAsync(kind: string, key: any, entity: any): Promise<any>;
13
+ saveEntity<T>(kind: string, key: any, entity: T): Promise<any>;
14
+ saveAsync(kind: string, key: any, entity: any): Promise<any>;
15
+ updateAsync(kind: string, key: any, entity: any): Promise<any>;
16
16
  commit(): void;
17
17
  dispose(): void;
18
18
  }
@@ -4,12 +4,17 @@ import Provider from "../Provider";
4
4
  */
5
5
  declare class IndexedDbProvider extends Provider {
6
6
  type: string;
7
- database: string;
8
- store: string;
9
7
  /**
10
8
  * 静态版本,保证所有数据库实例拿到最新版本信息
11
9
  */
12
10
  static version: number;
11
+ /**
12
+ * 当前数据库名
13
+ */
14
+ database: string;
15
+ /**
16
+ * 当前存在的仓储名集合
17
+ */
13
18
  objectStoreNames: DOMStringList;
14
19
  /**
15
20
  * 进行数据库初始化 或 从现有数据库中得到最新版本号(数据库首次初始化和open是版本号升级时,会触发升级事件)
@@ -18,33 +23,38 @@ declare class IndexedDbProvider extends Provider {
18
23
  /**
19
24
  * 保证创建存储Store
20
25
  */
21
- createAsync(store: string): Promise<any>;
26
+ createAsync(table: string): Promise<any>;
22
27
  /**
23
28
  * 打开数据库(不升级,用于执行命令)
24
29
  */
25
30
  openDbAsync(): Promise<IDBDatabase>;
31
+ /**
32
+ * 开启事务
33
+ */
34
+ openTransAsync(table: string, mode: string, db: IDBDatabase): Promise<IDBTransaction>;
35
+ getEntity<T>(table: string, id: any): Promise<T>;
26
36
  /**
27
37
  * 查询数据
28
38
  */
29
- getAsync(id: any): Promise<any>;
30
- getEntity<T>(id: any): Promise<T>;
39
+ getAsync(table: string, key: any): Promise<any>;
40
+ getKeysAsync(table: string): Promise<any[]>;
31
41
  /**
32
42
  * 添加数据
33
43
  */
34
- insertAsync(id: any, entity: any): Promise<any>;
44
+ insertAsync(table: string, key: any, entity: any): Promise<any>;
35
45
  /**
36
46
  * 修改数据
37
47
  */
38
- updateAsync(id: any, entity: any): Promise<any>;
48
+ updateAsync(table: string, key: any, entity: any): Promise<any>;
49
+ saveEntity<T>(table: string, key: any, entity: T): Promise<any>;
39
50
  /**
40
51
  * 保存数据,支持代理对象保存
41
52
  */
42
- saveAsync(id: any, entity: any): Promise<any>;
43
- saveEntity<T>(id: any, entity: T): Promise<any>;
53
+ saveAsync(table: string, key: any, entity: any): Promise<any>;
44
54
  /**
45
55
  * 删除数据
46
56
  */
47
- deleteAsync(id: any): Promise<any>;
57
+ deleteAsync: (table: string, key: any) => Promise<any>;
48
58
  /**
49
59
  * 提交事务
50
60
  */
@@ -5,14 +5,14 @@ import Provider from "../Provider";
5
5
  declare class StorageProvider extends Provider {
6
6
  type: string;
7
7
  openAsync(conn: string): Promise<number>;
8
- createAsync(store: string): Promise<any>;
9
- getAsync(id: any): Promise<any>;
10
- getEntity<T>(key: string): Promise<T>;
11
- insertAsync(id: any, entity: any): Promise<any>;
12
- saveAsync(id: any, entity: any): Promise<any>;
13
- saveEntity<T>(id: any, entity: T): Promise<any>;
14
- updateAsync(id: any, entity: any): Promise<any>;
15
- deleteAsync(id: any): Promise<any>;
8
+ createAsync(kind: string): Promise<any>;
9
+ getAsync(kind: string, key: any): Promise<any>;
10
+ getEntity<T>(kind: string, key: string): Promise<T>;
11
+ insertAsync(kind: string, key: any, entity: any): Promise<any>;
12
+ saveEntity<T>(kind: string, key: any, entity: T): Promise<any>;
13
+ saveAsync(kind: string, key: any, entity: any): Promise<any>;
14
+ updateAsync(kind: string, key: any, entity: any): Promise<any>;
15
+ deleteAsync(kind: string, key: any): Promise<any>;
16
16
  commit(): void;
17
17
  dispose(): void;
18
18
  /**
@@ -9,7 +9,7 @@ interface ISigner {
9
9
  /**
10
10
  * 开启连接
11
11
  */
12
- open(auth: {
12
+ openAsync(auth: {
13
13
  url: string;
14
14
  app_id: string;
15
15
  }): Promise<void>;
@@ -4,7 +4,7 @@ import ISigner from "./ISigner";
4
4
  */
5
5
  declare abstract class Signer implements ISigner {
6
6
  type: string;
7
- abstract open(auth: {
7
+ abstract openAsync(auth: {
8
8
  url: string;
9
9
  app_id: string;
10
10
  }): Promise<void>;
@@ -1,10 +1,10 @@
1
1
  import ISigner from "./ISigner";
2
- import Factory from "../../factorying/Factory";
2
+ import Factory from "../../factory/Factory";
3
3
  /**
4
4
  * 签名工厂类
5
5
  */
6
6
  declare class SignerFactory extends Factory<ISigner> {
7
- get instances(): ISigner[];
7
+ open(): void;
8
8
  /**
9
9
  * 获取指定签名实例
10
10
  */
@@ -4,7 +4,7 @@ import Signer from "../Signer";
4
4
  */
5
5
  declare class DefaultSigner extends Signer {
6
6
  type: string;
7
- open(auth: {
7
+ openAsync(auth: {
8
8
  url: string;
9
9
  app_id: string;
10
10
  }): Promise<void>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 订阅的窗口消息类型
3
+ */
4
+ interface SubscribedWindow {
5
+ /**
6
+ * 窗口ID
7
+ */
8
+ [win: string]: {
9
+ /**
10
+ * 键:消息类别
11
+ * 值:消息类型集合,一次可订阅多个
12
+ */
13
+ [kind: string]: string[];
14
+ };
15
+ }
16
+ export default SubscribedWindow;
@@ -0,0 +1,2 @@
1
+ import SubscribedWindow from "./SubscribedWindow";
2
+ export { type SubscribedWindow };
@@ -16,11 +16,15 @@ interface ISocket extends IDriver, IOpen {
16
16
  */
17
17
  connect(): Promise<void>;
18
18
  /**
19
- * 订阅并替换Socket事件处理程序
19
+ * 订阅多个消息类型,并缓存到订阅池
20
20
  */
21
- subscribe(win: string, kind: string, type: string): Promise<any>;
21
+ subscribe(win: string, kind: string, type: string | string[]): Promise<any>;
22
22
  /**
23
- * 取消订阅Socket事件处理程序,防止内存泄漏
23
+ * 重连时,重新订阅
24
+ */
25
+ resubscribe(): Promise<void>;
26
+ /**
27
+ * 取消订阅该窗口 所有Socket事件处理程序,防止内存泄漏
24
28
  */
25
29
  unsubscribe(win: string): Promise<any>;
26
30
  /**
@@ -1,8 +1,17 @@
1
1
  import ISocket from "./ISocket";
2
+ import { SubscribedWindow } from "./@types";
2
3
  /**
3
4
  * Socket基类
4
5
  */
5
6
  declare class Socket implements ISocket {
6
- open(conn?: string): Promise<void>;
7
+ /**
8
+ * 已订阅的消息类型列表
9
+ */
10
+ subscribed: SubscribedWindow;
11
+ openAsync(conn?: string): Promise<void>;
12
+ subscribe(win: string, kind: string, type: string | string[]): Promise<any>;
13
+ resubscribe(): Promise<void>;
14
+ unsubscribe(win: string): Promise<any>;
15
+ abstract send(data: any): void;
7
16
  }
8
17
  export default Socket;
@@ -1,4 +1,4 @@
1
- import { Factory } from "../../factorying";
1
+ import Factory from "../../factory/Factory";
2
2
  import ISocket from "./ISocket";
3
3
  /**
4
4
  * Socket工厂
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Socket进度消息
3
+ */
4
+ declare class SocketProgress<T> {
5
+ /**
6
+ * 成功数量
7
+ */
8
+ succeed: number;
9
+ /**
10
+ * 异常数量
11
+ */
12
+ errored: number;
13
+ /**
14
+ * 已处理数量
15
+ */
16
+ handled: number;
17
+ /**
18
+ * 总数量
19
+ */
20
+ total: number;
21
+ /**
22
+ * 当前消息体
23
+ */
24
+ current: T;
25
+ /**
26
+ * 增加成功进度
27
+ */
28
+ success(current: T): void;
29
+ /**
30
+ * 增加异常进度
31
+ */
32
+ error(current: T, message: string): void;
33
+ }
34
+ export default SocketProgress;