xpe 0.0.0-alpha.1
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/LICENSE +21 -0
- package/README.md +71 -0
- package/framework/es/core/Application.d.ts +126 -0
- package/framework/es/core/Command/Command.d.ts +7 -0
- package/framework/es/core/Container/Container.d.ts +80 -0
- package/framework/es/core/Contracts/AxiosAdapter.d.ts +12 -0
- package/framework/es/core/Helper/Helper.d.ts +43 -0
- package/framework/es/core/Helper/Storage/WebStorage.d.ts +71 -0
- package/framework/es/core/Libs/Exception.d.ts +24 -0
- package/framework/es/core/Libs/Lib.d.ts +72 -0
- package/framework/es/core/Provider/CommandProvider.d.ts +4 -0
- package/framework/es/core/Provider/HelperProvider.d.ts +4 -0
- package/framework/es/core/Provider/HttpProvider.d.ts +13 -0
- package/framework/es/core/Provider/ServiceProvider.d.ts +15 -0
- package/framework/es/core/Service/HttpService.d.ts +133 -0
- package/framework/es/core/Service/Service.d.ts +6 -0
- package/framework/es/core/Spanner/RESTful.d.ts +30 -0
- package/framework/es/core/Transformer/Transformer.d.ts +46 -0
- package/framework/es/core/Type/adapters.d.ts +25 -0
- package/framework/es/core/Type/types.d.ts +161 -0
- package/framework/es/core/TypeFunc/index.d.ts +6 -0
- package/framework/es/core/Wrenches/EventBus.d.ts +56 -0
- package/framework/es/core/Wrenches/is.d.ts +19 -0
- package/framework/es/ege.js +4 -0
- package/framework/es/ege.js.map +1 -0
- package/framework/es/index.d.ts +13 -0
- package/framework/es/pdd.js +4 -0
- package/framework/es/pdd.js.map +1 -0
- package/framework/es/src/core/Application.d.ts +127 -0
- package/framework/es/src/core/Application.d.ts.map +1 -0
- package/framework/es/src/core/Command/Command.d.ts +8 -0
- package/framework/es/src/core/Command/Command.d.ts.map +1 -0
- package/framework/es/src/core/Container/Container.d.ts +81 -0
- package/framework/es/src/core/Container/Container.d.ts.map +1 -0
- package/framework/es/src/core/Contracts/AxiosAdapter.d.ts +13 -0
- package/framework/es/src/core/Contracts/AxiosAdapter.d.ts.map +1 -0
- package/framework/es/src/core/Helper/Helper.d.ts +45 -0
- package/framework/es/src/core/Helper/Helper.d.ts.map +1 -0
- package/framework/es/src/core/Helper/Storage/WebStorage.d.ts +72 -0
- package/framework/es/src/core/Helper/Storage/WebStorage.d.ts.map +1 -0
- package/framework/es/src/core/Libs/Exception.d.ts +25 -0
- package/framework/es/src/core/Libs/Exception.d.ts.map +1 -0
- package/framework/es/src/core/Libs/Lib.d.ts +73 -0
- package/framework/es/src/core/Libs/Lib.d.ts.map +1 -0
- package/framework/es/src/core/Provider/CommandProvider.d.ts +5 -0
- package/framework/es/src/core/Provider/CommandProvider.d.ts.map +1 -0
- package/framework/es/src/core/Provider/HelperProvider.d.ts +5 -0
- package/framework/es/src/core/Provider/HelperProvider.d.ts.map +1 -0
- package/framework/es/src/core/Provider/HttpProvider.d.ts +14 -0
- package/framework/es/src/core/Provider/HttpProvider.d.ts.map +1 -0
- package/framework/es/src/core/Provider/ServiceProvider.d.ts +16 -0
- package/framework/es/src/core/Provider/ServiceProvider.d.ts.map +1 -0
- package/framework/es/src/core/Service/HttpService.d.ts +128 -0
- package/framework/es/src/core/Service/HttpService.d.ts.map +1 -0
- package/framework/es/src/core/Service/Service.d.ts +7 -0
- package/framework/es/src/core/Service/Service.d.ts.map +1 -0
- package/framework/es/src/core/Spanner/RESTful.d.ts +32 -0
- package/framework/es/src/core/Spanner/RESTful.d.ts.map +1 -0
- package/framework/es/src/core/Transformer/Transformer.d.ts +47 -0
- package/framework/es/src/core/Transformer/Transformer.d.ts.map +1 -0
- package/framework/es/src/core/Type/adapters.d.ts +26 -0
- package/framework/es/src/core/Type/adapters.d.ts.map +1 -0
- package/framework/es/src/core/Type/types.d.ts +186 -0
- package/framework/es/src/core/Type/types.d.ts.map +1 -0
- package/framework/es/src/core/TypeFunc/index.d.ts +8 -0
- package/framework/es/src/core/TypeFunc/index.d.ts.map +1 -0
- package/framework/es/src/core/Wrenches/EventBus.d.ts +57 -0
- package/framework/es/src/core/Wrenches/EventBus.d.ts.map +1 -0
- package/framework/es/src/core/Wrenches/is.d.ts +20 -0
- package/framework/es/src/core/Wrenches/is.d.ts.map +1 -0
- package/framework/es/src/index.d.ts +14 -0
- package/framework/es/src/index.d.ts.map +1 -0
- package/framework/es/src/utils.d.ts +17 -0
- package/framework/es/src/utils.d.ts.map +1 -0
- package/framework/es/utils.d.ts +16 -0
- package/framework/umd/core/Application.d.ts +126 -0
- package/framework/umd/core/Command/Command.d.ts +7 -0
- package/framework/umd/core/Container/Container.d.ts +80 -0
- package/framework/umd/core/Contracts/AxiosAdapter.d.ts +12 -0
- package/framework/umd/core/Helper/Helper.d.ts +43 -0
- package/framework/umd/core/Helper/Storage/WebStorage.d.ts +71 -0
- package/framework/umd/core/Libs/Exception.d.ts +24 -0
- package/framework/umd/core/Libs/Lib.d.ts +72 -0
- package/framework/umd/core/Provider/CommandProvider.d.ts +4 -0
- package/framework/umd/core/Provider/HelperProvider.d.ts +4 -0
- package/framework/umd/core/Provider/HttpProvider.d.ts +13 -0
- package/framework/umd/core/Provider/ServiceProvider.d.ts +15 -0
- package/framework/umd/core/Service/HttpService.d.ts +133 -0
- package/framework/umd/core/Service/Service.d.ts +6 -0
- package/framework/umd/core/Spanner/RESTful.d.ts +30 -0
- package/framework/umd/core/Transformer/Transformer.d.ts +46 -0
- package/framework/umd/core/Type/adapters.d.ts +25 -0
- package/framework/umd/core/Type/types.d.ts +161 -0
- package/framework/umd/core/TypeFunc/index.d.ts +6 -0
- package/framework/umd/core/Wrenches/EventBus.d.ts +56 -0
- package/framework/umd/core/Wrenches/is.d.ts +19 -0
- package/framework/umd/ege.js +4 -0
- package/framework/umd/ege.js.map +1 -0
- package/framework/umd/index.d.ts +13 -0
- package/framework/umd/pdd.js +4 -0
- package/framework/umd/pdd.js.map +1 -0
- package/framework/umd/src/core/Application.d.ts +127 -0
- package/framework/umd/src/core/Application.d.ts.map +1 -0
- package/framework/umd/src/core/Command/Command.d.ts +8 -0
- package/framework/umd/src/core/Command/Command.d.ts.map +1 -0
- package/framework/umd/src/core/Container/Container.d.ts +81 -0
- package/framework/umd/src/core/Container/Container.d.ts.map +1 -0
- package/framework/umd/src/core/Contracts/AxiosAdapter.d.ts +13 -0
- package/framework/umd/src/core/Contracts/AxiosAdapter.d.ts.map +1 -0
- package/framework/umd/src/core/Helper/Helper.d.ts +45 -0
- package/framework/umd/src/core/Helper/Helper.d.ts.map +1 -0
- package/framework/umd/src/core/Helper/Storage/WebStorage.d.ts +72 -0
- package/framework/umd/src/core/Helper/Storage/WebStorage.d.ts.map +1 -0
- package/framework/umd/src/core/Libs/Exception.d.ts +25 -0
- package/framework/umd/src/core/Libs/Exception.d.ts.map +1 -0
- package/framework/umd/src/core/Libs/Lib.d.ts +73 -0
- package/framework/umd/src/core/Libs/Lib.d.ts.map +1 -0
- package/framework/umd/src/core/Provider/CommandProvider.d.ts +5 -0
- package/framework/umd/src/core/Provider/CommandProvider.d.ts.map +1 -0
- package/framework/umd/src/core/Provider/HelperProvider.d.ts +5 -0
- package/framework/umd/src/core/Provider/HelperProvider.d.ts.map +1 -0
- package/framework/umd/src/core/Provider/HttpProvider.d.ts +14 -0
- package/framework/umd/src/core/Provider/HttpProvider.d.ts.map +1 -0
- package/framework/umd/src/core/Provider/ServiceProvider.d.ts +16 -0
- package/framework/umd/src/core/Provider/ServiceProvider.d.ts.map +1 -0
- package/framework/umd/src/core/Service/HttpService.d.ts +128 -0
- package/framework/umd/src/core/Service/HttpService.d.ts.map +1 -0
- package/framework/umd/src/core/Service/Service.d.ts +7 -0
- package/framework/umd/src/core/Service/Service.d.ts.map +1 -0
- package/framework/umd/src/core/Spanner/RESTful.d.ts +32 -0
- package/framework/umd/src/core/Spanner/RESTful.d.ts.map +1 -0
- package/framework/umd/src/core/Transformer/Transformer.d.ts +47 -0
- package/framework/umd/src/core/Transformer/Transformer.d.ts.map +1 -0
- package/framework/umd/src/core/Type/adapters.d.ts +26 -0
- package/framework/umd/src/core/Type/adapters.d.ts.map +1 -0
- package/framework/umd/src/core/Type/types.d.ts +186 -0
- package/framework/umd/src/core/Type/types.d.ts.map +1 -0
- package/framework/umd/src/core/TypeFunc/index.d.ts +8 -0
- package/framework/umd/src/core/TypeFunc/index.d.ts.map +1 -0
- package/framework/umd/src/core/Wrenches/EventBus.d.ts +57 -0
- package/framework/umd/src/core/Wrenches/EventBus.d.ts.map +1 -0
- package/framework/umd/src/core/Wrenches/is.d.ts +20 -0
- package/framework/umd/src/core/Wrenches/is.d.ts.map +1 -0
- package/framework/umd/src/index.d.ts +14 -0
- package/framework/umd/src/index.d.ts.map +1 -0
- package/framework/umd/src/utils.d.ts +17 -0
- package/framework/umd/src/utils.d.ts.map +1 -0
- package/framework/umd/utils.d.ts +16 -0
- package/index.d.ts +724 -0
- package/package.json +57 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpService.d.ts","sourceRoot":"","sources":["../../../../src/core/Service/HttpService.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,WAAW,CAAA;AAS/B,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EAEV,SAAS,EACT,eAAe,EACf,aAAa,EAEb,mBAAmB,EACnB,aAAa,EACd,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAGpD,aAAK,oBAAoB,GAAG,GAAG,CAAA;AAE/B;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,OAAO;IAE9C,KAAK,EAAE,GAAG,CAAO;IAEjB,IAAI,EAAE,aAAa,CAAK;IAExB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAK;IAElC,KAAK,SAAK;IAEV,UAAU,UAAO;IAEjB,aAAa,EAAE,aAAa,CAAK;IAEjC,KAAK,EAAE,YAAY,CAAoB;IAEvC,OAAO,OAAO;IAEd,kBAAkB,EAAE,gBAAgB,CAAA;IAEpC,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MAAM,EAAE,GAAG,EAAE,GAAG;IAKhC,YAAY,CAAC,IAAI,EAAE,MAAM;IAIzB;;;;;OAKG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG;CAO/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Service.d.ts","sourceRoot":"","sources":["../../../../src/core/Service/Service.ts"],"names":[],"mappings":"AACA,aAAK,oBAAoB,GAAG,GAAG,CAAC;AAEhC,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,OAAO;IACnC,SAAS,CAAC,GAAG,EAAE,oBAAoB,CAAC;gBAExB,GAAG,EAAE,oBAAoB;CAGtC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { UtilityObject } from '../Type/utility';
|
|
2
|
+
/**
|
|
3
|
+
* Class RESTful
|
|
4
|
+
* RESTful处理类
|
|
5
|
+
* @author SunnyXu <xy@ztes.com>
|
|
6
|
+
*/
|
|
7
|
+
export default class RESTful {
|
|
8
|
+
private readonly isRESTful;
|
|
9
|
+
private api;
|
|
10
|
+
private readonly requestData;
|
|
11
|
+
/**
|
|
12
|
+
* Method constructor
|
|
13
|
+
* @param {String} api
|
|
14
|
+
* @param {*} data
|
|
15
|
+
* @param {*} mode
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
constructor(api: string, data: UtilityObject, mode: boolean);
|
|
19
|
+
/**
|
|
20
|
+
* Method create
|
|
21
|
+
* 创建RESTful数据
|
|
22
|
+
*/
|
|
23
|
+
create(): {
|
|
24
|
+
api: string;
|
|
25
|
+
data: any;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* private method transformer
|
|
29
|
+
*/
|
|
30
|
+
private transformer;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=RESTful.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RESTful.d.ts","sourceRoot":"","sources":["../../../../src/core/Spanner/RESTful.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAEpD;;;;GAIG;AAEH,MAAM,CAAC,OAAO,OAAO,OAAO;IAE1B,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAgB;IAE1C,OAAO,CAAC,GAAG,CAAQ;IAEnB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAK;IAEjC;;;;;;OAMG;gBACS,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO;IAM3D;;;OAGG;IACH,MAAM;;;;IAWN;;OAEG;IACH,OAAO,CAAC,WAAW;CA2DpB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
declare type Callback = (item: Record<any, any>, index?: number) => Record<any, any>;
|
|
2
|
+
/**
|
|
3
|
+
* Class Transformer 转换器
|
|
4
|
+
* NewTransformer extends Transformer -> constructor(){super(data,payload)}
|
|
5
|
+
*/
|
|
6
|
+
export default class Transformer {
|
|
7
|
+
private readonly data;
|
|
8
|
+
private payload;
|
|
9
|
+
/**
|
|
10
|
+
* Method constructor
|
|
11
|
+
* @param {*} data 需处理的数据
|
|
12
|
+
* @param {*} payload 携带的载荷
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
constructor(data: any, payload?: unknown);
|
|
16
|
+
/**
|
|
17
|
+
* Method transform
|
|
18
|
+
* 转换方法
|
|
19
|
+
* @param {Object|String|Number} data
|
|
20
|
+
* @param tData
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
transform(data: any, tData?: any): any;
|
|
24
|
+
/**
|
|
25
|
+
* Method create
|
|
26
|
+
* 创建新数据
|
|
27
|
+
* @return {Array/Object|String|Number|*}
|
|
28
|
+
*/
|
|
29
|
+
create(callback?: Callback): any;
|
|
30
|
+
/**
|
|
31
|
+
* 格式化数字
|
|
32
|
+
* @param {String|Number} number 待处理数字
|
|
33
|
+
* @param {Number} places 小数点位数 -1为原样保留
|
|
34
|
+
* @param {String} thousand 千位字符串 默认为空
|
|
35
|
+
* @param {String} decimal 小数点替换字符 默认为.
|
|
36
|
+
* @return {String|Number}
|
|
37
|
+
*/
|
|
38
|
+
formatNumber(number: string | number, places?: number | string, thousand?: string, decimal?: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* formatDate 日期格式化
|
|
41
|
+
* @param {string|number} timestamp
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
formatDate(timestamp?: number | string | unknown): Record<string, number | string>;
|
|
45
|
+
}
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=Transformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transformer.d.ts","sourceRoot":"","sources":["../../../../src/core/Transformer/Transformer.ts"],"names":[],"mappings":"AAEA,aAAK,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAE7E;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,WAAW;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAM;IAE3B,OAAO,CAAC,OAAO,CAAM;IAErB;;;;;OAKG;gBACgB,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,OAAO;IAO/C;;;;;;OAMG;IACH,SAAS,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,GAAG,GAAG;IAKtC;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,EAAE,QAAQ;IAgB1B;;;;;;;OAOG;IACH,YAAY,CACV,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,MAAM,GAAE,MAAM,GAAG,MAAW,EAC5B,QAAQ,SAAK,EACb,OAAO,SAAM;IA8Cf;;;;OAIG;IACH,UAAU,CACR,SAAS,GAAE,MAAM,GAAG,MAAM,GAAG,OAAoB,GAChD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAiDnC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { IHttpAdapter, RequestConfig, RequestMethod } from './types';
|
|
2
|
+
export declare abstract class HttpAdapterInterface<T> {
|
|
3
|
+
protected http: IHttpAdapter<T>;
|
|
4
|
+
protected method: RequestMethod;
|
|
5
|
+
protected url: string;
|
|
6
|
+
protected data: {};
|
|
7
|
+
protected headers: {};
|
|
8
|
+
/**
|
|
9
|
+
* Method constructor 注入Axios
|
|
10
|
+
* @param {*} $function
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
protected constructor($function: IHttpAdapter<T>);
|
|
14
|
+
/**
|
|
15
|
+
* Method setConfig
|
|
16
|
+
* 设置配置信息
|
|
17
|
+
* @param {method,url,data,headers} param
|
|
18
|
+
*/
|
|
19
|
+
setConfig({ method, url, data, headers }: RequestConfig): void;
|
|
20
|
+
/**
|
|
21
|
+
* Method request
|
|
22
|
+
* @returns Promise
|
|
23
|
+
*/
|
|
24
|
+
request(): Promise<unknown>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../../../src/core/Type/adapters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACZ,aAAa,EACb,aAAa,EACd,MAAM,SAAS,CAAA;AAGhB,8BAAsB,oBAAoB,CAAC,CAAC;IAC1C,SAAS,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAC/B,SAAS,CAAC,MAAM,EAAE,aAAa,CAAS;IACxC,SAAS,CAAC,GAAG,SAAK;IAClB,SAAS,CAAC,IAAI,KAAK;IACnB,SAAS,CAAC,OAAO,KAAK;IAEtB;;;;OAIG;IACH,SAAS,aAAa,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC;IAUhD;;;;OAIG;IACI,SAAS,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,aAAa;IAO9D;;;OAGG;IACI,OAAO;CAgBf"}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import type { UtilityFunction, UtilityObject, UtilityClass } from './utility';
|
|
2
|
+
import type ServiceProvider from '../Provider/ServiceProvider';
|
|
3
|
+
/**
|
|
4
|
+
* Interface Container
|
|
5
|
+
* @description 容器接口
|
|
6
|
+
*/
|
|
7
|
+
export interface IContainer {
|
|
8
|
+
/**
|
|
9
|
+
* bind 绑定实体
|
|
10
|
+
* @param {String|Array} abstract
|
|
11
|
+
* @param {*} concrete
|
|
12
|
+
*/
|
|
13
|
+
bind(abstract: string | string[], concrete: any): void;
|
|
14
|
+
/**
|
|
15
|
+
* make 创建类的实例/获取对象 create instance/object
|
|
16
|
+
* @param abstract
|
|
17
|
+
* @param params
|
|
18
|
+
* @param shared
|
|
19
|
+
*/
|
|
20
|
+
make(abstract: string, params?: object | [], shared?: boolean): any;
|
|
21
|
+
/**
|
|
22
|
+
* has as existence
|
|
23
|
+
* 是否存在标识 existence 的别名
|
|
24
|
+
* @param {String} name
|
|
25
|
+
*/
|
|
26
|
+
has(name: string): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* existence 存在标识
|
|
29
|
+
* @param {String} name
|
|
30
|
+
*/
|
|
31
|
+
existence(name: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* getAlias 获取别名
|
|
34
|
+
* @param abstract
|
|
35
|
+
*/
|
|
36
|
+
getAlias(abstract: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* get 获取实例
|
|
39
|
+
* @param abstract
|
|
40
|
+
*/
|
|
41
|
+
get(abstract: string): any;
|
|
42
|
+
/**
|
|
43
|
+
* singleton 单例
|
|
44
|
+
* @param abstract
|
|
45
|
+
* @param concrete
|
|
46
|
+
*/
|
|
47
|
+
singleton(abstract: string, concrete: any): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Interface Application
|
|
51
|
+
* @description 应用接口
|
|
52
|
+
*/
|
|
53
|
+
export interface IApplication extends IContainer {
|
|
54
|
+
/**
|
|
55
|
+
* getterProviders Providers 获取器
|
|
56
|
+
*/
|
|
57
|
+
getterProviders(): any[];
|
|
58
|
+
/**
|
|
59
|
+
* setterProviders Providers
|
|
60
|
+
* 设置器
|
|
61
|
+
* @param providers
|
|
62
|
+
*/
|
|
63
|
+
setterProviders<T>(providers: T[]): void;
|
|
64
|
+
/**
|
|
65
|
+
* static getAdapter
|
|
66
|
+
* 适配器 获取器
|
|
67
|
+
* @param adapter
|
|
68
|
+
*/
|
|
69
|
+
getterAdapter(adapter: UtilityClass): any;
|
|
70
|
+
/**
|
|
71
|
+
* setAdapter
|
|
72
|
+
* 新增
|
|
73
|
+
* @param adapter
|
|
74
|
+
* @param instance
|
|
75
|
+
* @protected
|
|
76
|
+
*/
|
|
77
|
+
setterAdapter(adapter: UtilityClass, instance: UtilityObject): void;
|
|
78
|
+
}
|
|
79
|
+
export declare type IApplicationInstance = IApplication;
|
|
80
|
+
export declare type RequestMethod = 'post' | 'get' | 'put' | 'delete' | 'POST' | 'GET' | 'PUT' | 'DELETE';
|
|
81
|
+
export declare type TContentType = 'REQUEST_PAYLOAD' | 'FORM_DATA';
|
|
82
|
+
export declare type TCarryData = 'REQUEST_HEADERS' | 'REQUEST_DATA';
|
|
83
|
+
export declare type TApiRoute = [
|
|
84
|
+
string,
|
|
85
|
+
(RequestMethod | [RequestMethod, TContentType])?,
|
|
86
|
+
(true | false)?,
|
|
87
|
+
(true | false | undefined)?
|
|
88
|
+
];
|
|
89
|
+
export interface HttpApis {
|
|
90
|
+
[api: string]: TApiRoute;
|
|
91
|
+
}
|
|
92
|
+
export declare type IHttpSendConfig = {
|
|
93
|
+
host?: string;
|
|
94
|
+
headers?: Record<string, any>;
|
|
95
|
+
mode?: TContentType;
|
|
96
|
+
responseData?: boolean;
|
|
97
|
+
};
|
|
98
|
+
export declare type TResponseDataReturn = {
|
|
99
|
+
statusCode: number;
|
|
100
|
+
msg: string;
|
|
101
|
+
data: any;
|
|
102
|
+
timestamp: number;
|
|
103
|
+
};
|
|
104
|
+
export interface IResponseReturn extends Response {
|
|
105
|
+
data: TResponseDataReturn;
|
|
106
|
+
}
|
|
107
|
+
export declare type TApiRoute1 = {
|
|
108
|
+
bb: boolean;
|
|
109
|
+
cc: number;
|
|
110
|
+
};
|
|
111
|
+
export interface IHelper {
|
|
112
|
+
env(): Record<any, any>;
|
|
113
|
+
storage(name: string): Record<any, any>;
|
|
114
|
+
storage(name: string, payload?: any): void;
|
|
115
|
+
cookies(name: string): Record<any, any>;
|
|
116
|
+
cookies(name: string, payload?: any): void;
|
|
117
|
+
session(name: string): Record<any, any>;
|
|
118
|
+
session(name: string, payload?: any): void;
|
|
119
|
+
/**
|
|
120
|
+
* 发送一个http请求
|
|
121
|
+
* @param api 接口key
|
|
122
|
+
* @param data 请求数据
|
|
123
|
+
* @param headers 自定义头
|
|
124
|
+
*/
|
|
125
|
+
http(api: string | TApiRoute, data?: UtilityObject, headers?: Record<string, string | number>): Promise<TResponseDataReturn>;
|
|
126
|
+
fetch(api: string | TApiRoute, data?: UtilityObject, headers?: Record<string, string | number>): Promise<IResponseReturn>;
|
|
127
|
+
send(api: string | TApiRoute, data?: UtilityObject, handle?: (response: IResponseReturn) => void, config?: IHttpSendConfig, returnResponse?: boolean): Promise<IResponseReturn>;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Adapter Interface
|
|
131
|
+
*/
|
|
132
|
+
export declare type RequestConfig = {
|
|
133
|
+
method?: RequestMethod;
|
|
134
|
+
url?: string;
|
|
135
|
+
data?: Record<string, any>;
|
|
136
|
+
headers?: HeadersInit | Record<string, string | number>;
|
|
137
|
+
};
|
|
138
|
+
export declare type IHttpAdapter<T> = (config: RequestConfig) => Promise<T>;
|
|
139
|
+
export declare type IAxiosAdapterHttp<T> = (config: RequestConfig) => Promise<T>;
|
|
140
|
+
/**
|
|
141
|
+
* Service Interface
|
|
142
|
+
*/
|
|
143
|
+
export interface IHttpService {
|
|
144
|
+
send(apiRoute: string, data: Record<string, any>, config?: IHttpSendConfig, returnResponse?: boolean): Promise<any>;
|
|
145
|
+
http(api: string | TApiRoute, data?: UtilityObject, headers?: Record<string, string | number>): Promise<IResponseReturn>;
|
|
146
|
+
}
|
|
147
|
+
export declare type IServiceProvider = typeof ServiceProvider;
|
|
148
|
+
export declare type APP_CONFIG = {
|
|
149
|
+
PROVIDERS?: IServiceProvider[];
|
|
150
|
+
APP_TYPE: 'VUE' | 'REACT' | 'UNI_APP' | 'MP_VUE' | 'WX_APP';
|
|
151
|
+
HTTP_CONFIG: HTTP_CONFIG;
|
|
152
|
+
};
|
|
153
|
+
export declare type HTTP_CONFIG = {
|
|
154
|
+
HTTP_ADAPTER: any;
|
|
155
|
+
HTTP_LIB: UtilityFunction | UtilityClass;
|
|
156
|
+
HTTP_API: any;
|
|
157
|
+
HTTP_HOST: string;
|
|
158
|
+
IS_RESTFUL: boolean;
|
|
159
|
+
CONTENT_TYPE: TContentType;
|
|
160
|
+
DATA_CARRYING: DATA_CARRYING;
|
|
161
|
+
REQUEST_MIDDLEWARE?: HttpMiddleware<any>;
|
|
162
|
+
RESPONSE_MIDDLEWARE?: HttpMiddleware<any>;
|
|
163
|
+
};
|
|
164
|
+
export declare type DATA_CARRYING = {
|
|
165
|
+
REQUEST_DATA?: Record<any, any>;
|
|
166
|
+
REQUEST_HEADERS?: Record<any, any>;
|
|
167
|
+
};
|
|
168
|
+
export declare type HttpMiddleware<T> = (context?: any) => void;
|
|
169
|
+
export declare type HTTP_SERVICE_CONFIG = Pick<HTTP_CONFIG, 'HTTP_ADAPTER' | 'HTTP_API' | 'HTTP_HOST' | 'IS_RESTFUL' | 'CONTENT_TYPE' | 'DATA_CARRYING' | 'REQUEST_MIDDLEWARE' | 'RESPONSE_MIDDLEWARE'>;
|
|
170
|
+
export interface IMiddleware<TContext> {
|
|
171
|
+
handle(context: TContext, next: UtilityFunction): void;
|
|
172
|
+
}
|
|
173
|
+
export declare type HttpContext<T> = {
|
|
174
|
+
request: {
|
|
175
|
+
hairstyle: TApiRoute;
|
|
176
|
+
body: Record<string, any>;
|
|
177
|
+
data: Record<string, any>;
|
|
178
|
+
auth: boolean;
|
|
179
|
+
headers: Record<string, string | number>;
|
|
180
|
+
method: RequestMethod;
|
|
181
|
+
api: string;
|
|
182
|
+
url: string;
|
|
183
|
+
};
|
|
184
|
+
response: T;
|
|
185
|
+
};
|
|
186
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/core/Type/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC7E,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAA;AAG9D;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG,GAAG,IAAI,CAAA;IAEtD;;;;;OAKG;IACH,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,GAAG,CAAA;IAMnE;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAE1B;;;OAGG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAEhC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;IAElC;;;OAGG;IACH,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAA;IAE1B;;;;OAIG;IACH,S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AAE,GAAG,CAAC,CAAA;QACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QACzB,IAAI,EAAE,OAAO,CAAA;QACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;QACxC,MAAM,EAAE,aAAa,CAAA;QACrB,GAAG,EAAE,MAAM,CAAA;QACX,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,QAAQ,EAAE,CAAC,CAAA;CACZ,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { APP_CONFIG, HTTP_CONFIG } from '../Type/types';
|
|
2
|
+
import { HttpApis } from '../Type/types';
|
|
3
|
+
export declare function defineAppConfig(config: APP_CONFIG): APP_CONFIG;
|
|
4
|
+
export declare function defineAppHttpConfig<T>(config: HTTP_CONFIG | T): T | HTTP_CONFIG;
|
|
5
|
+
export declare function defineHttpConfig<T>(config: HTTP_CONFIG | T): HTTP_CONFIG | T;
|
|
6
|
+
export declare function defineHttpApis(apis: HttpApis): HttpApis;
|
|
7
|
+
export declare function defineHttpRequestConfig(apis: HttpApis): HttpApis;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/TypeFunc/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,cAEjD;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,GAAG,CAAC,mBAE7D;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,GAAG,CAAC,mBAE1D;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,YAE5C;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,QAAQ,YAErD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare type Function = (...args: any[]) => any;
|
|
2
|
+
export default class EventBus {
|
|
3
|
+
_events: Map<any, any>;
|
|
4
|
+
static _instance: InstanceType<typeof EventBus>;
|
|
5
|
+
/**
|
|
6
|
+
* 获取EventBus实例
|
|
7
|
+
* @return {EventBus}
|
|
8
|
+
*/
|
|
9
|
+
static getInstance(): EventBus;
|
|
10
|
+
/**
|
|
11
|
+
* EventBus.getEvents
|
|
12
|
+
* @return {Map<any, any>}
|
|
13
|
+
*/
|
|
14
|
+
static getEvents(): Map<any, any>;
|
|
15
|
+
static getEventsSize(): number;
|
|
16
|
+
static getEvent(name: string): any;
|
|
17
|
+
static hasEvent(name: string): boolean;
|
|
18
|
+
static deleteEvent(name: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Method EventBus.setEvent
|
|
21
|
+
* @param name
|
|
22
|
+
* @param callback
|
|
23
|
+
* @return {Map<any, any>}
|
|
24
|
+
*/
|
|
25
|
+
static setEvent(name: string, callback: CallableFunction): Map<any, any>;
|
|
26
|
+
/**
|
|
27
|
+
* Method EventBus.on as EventBus.setEvent
|
|
28
|
+
* 绑定事件
|
|
29
|
+
* @param name
|
|
30
|
+
* @param callback
|
|
31
|
+
* @return {Map<*, *>}
|
|
32
|
+
*/
|
|
33
|
+
static on(name: string, callback: CallableFunction): Map<any, any>;
|
|
34
|
+
/**
|
|
35
|
+
* Method EventBus.emit
|
|
36
|
+
* 执行事件
|
|
37
|
+
* @param name
|
|
38
|
+
* @param payload
|
|
39
|
+
* @return {*}
|
|
40
|
+
*/
|
|
41
|
+
static emit(name: string, ...payload: any[]): any;
|
|
42
|
+
/**
|
|
43
|
+
* Method EventBus.once
|
|
44
|
+
* 执行事件并关闭事件
|
|
45
|
+
* @param name
|
|
46
|
+
* @param payload
|
|
47
|
+
*/
|
|
48
|
+
static once(name: string, ...payload: any[]): void;
|
|
49
|
+
/**
|
|
50
|
+
* EventBus.off
|
|
51
|
+
* 关闭事件
|
|
52
|
+
* @param name
|
|
53
|
+
* @return {boolean}
|
|
54
|
+
*/
|
|
55
|
+
static off(name: string): boolean;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=EventBus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventBus.d.ts","sourceRoot":"","sources":["../../../../src/core/Wrenches/EventBus.ts"],"names":[],"mappings":"AAEA,oBAAY,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;AAE9C,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,OAAO,gBAAY;IACnB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,OAAO,QAAQ,CAAC,CAAA;IAE/C;;;OAGG;IACH,MAAM,CAAC,WAAW;IAOlB;;;OAGG;IACH,MAAM,CAAC,SAAS;IAIhB,MAAM,CAAC,aAAa;IAIpB,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAI5B,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM;IAI5B,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM;IAK/B;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB;IAOxD;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB;IAOlD;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE;IAO3C;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE;IAK3C;;;;;OAKG;IACH,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAYlC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function isArray(obj: any): obj is any[];
|
|
2
|
+
export declare function isNull(obj: any): obj is null;
|
|
3
|
+
export declare function isBoolean(obj: unknown): obj is boolean;
|
|
4
|
+
export declare function isObject(obj: any): obj is Record<string, unknown>;
|
|
5
|
+
export declare const isPromise: <T>(obj: unknown) => obj is Promise<T>;
|
|
6
|
+
export declare function isString(obj: any): obj is string;
|
|
7
|
+
export declare function isNumber(obj: any): obj is number;
|
|
8
|
+
export declare function isRegExp(obj: any): boolean;
|
|
9
|
+
export declare function isDate(obj: any): boolean;
|
|
10
|
+
export declare function isColor(color: any): boolean;
|
|
11
|
+
export declare function isUndefined(obj: any): obj is undefined;
|
|
12
|
+
export declare function isFunction(obj: any): obj is (...args: any[]) => any;
|
|
13
|
+
export declare function isClass(value: unknown): boolean;
|
|
14
|
+
export declare function isEmptyObject(obj: any): boolean;
|
|
15
|
+
export declare function isEmpty(obj: any): boolean;
|
|
16
|
+
export declare function isExist(obj: any): boolean;
|
|
17
|
+
export declare function isWindow(el: any): el is Window;
|
|
18
|
+
export declare function isPhone(obj: any): boolean;
|
|
19
|
+
export declare function isEmail(obj: any): boolean;
|
|
20
|
+
//# sourceMappingURL=is.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is.d.ts","sourceRoot":"","sources":["../../../../src/core/Wrenches/is.ts"],"names":[],"mappings":"AAMA,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,GAAG,EAAE,CAE9C;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,IAAI,CAE5C;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,OAAO,CAEtD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEjE;AAED,eAAO,MAAM,SAAS,WAAY,OAAO,sBAExC,CAAC;AAEF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAEhD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,MAAM,CAEhD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,GAAG,WAEhC;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,WAE9B;AAcD,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAE3C;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,SAAS,CAEtD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAEnE;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAsB/C;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAE/C;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAMzC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAEzC;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,GAAG,GAAG,EAAE,IAAI,MAAM,CAE9C;AA2BD,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAKzC;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAGzC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Application from "./core/Application";
|
|
2
|
+
import Exception from "./core/Libs/Exception";
|
|
3
|
+
import Container from "./core/Container/Container";
|
|
4
|
+
import Command from "./core/Command/Command";
|
|
5
|
+
import Transformer from "./core/Transformer/Transformer";
|
|
6
|
+
import Lib from "./core/Libs/Lib";
|
|
7
|
+
import AxiosAdapter from "./core/Contracts/AxiosAdapter";
|
|
8
|
+
import ServiceProvider from "./core/Provider/ServiceProvider";
|
|
9
|
+
import EventBus from "./core/Wrenches/EventBus";
|
|
10
|
+
import * as Is from "./core/Wrenches/is";
|
|
11
|
+
export * from "./core/TypeFunc";
|
|
12
|
+
export * from "./core/Type/types";
|
|
13
|
+
export { Application as default, Command, Container, ServiceProvider, Exception, Transformer, Lib, AxiosAdapter, EventBus, Is, };
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,SAAS,MAAM,4BAA4B,CAAC;AACnD,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,WAAW,MAAM,gCAAgC,CAAC;AACzD,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAElC,OAAO,YAAY,MAAM,+BAA+B,CAAC;AAIzD,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAE9D,OAAO,QAAQ,MAAM,0BAA0B,CAAC;AAEhD,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAGzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAKlC,OAAO,EACL,WAAW,IAAI,OAAO,EACtB,OAAO,EACP,SAAS,EACT,eAAe,EACf,SAAS,EACT,WAAW,EACX,GAAG,EAEH,YAAY,EAEZ,QAAQ,EACR,EAAE,GACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const getType: (val: unknown) => string;
|
|
2
|
+
export declare const getShortType: (type: string) => string;
|
|
3
|
+
export declare const isString: (val: unknown) => boolean;
|
|
4
|
+
export declare const isNumber: (val: unknown) => boolean;
|
|
5
|
+
export declare const isBoolean: (val: unknown) => boolean;
|
|
6
|
+
export declare const isArray: (val: unknown) => boolean;
|
|
7
|
+
export declare const isObject: (val: unknown) => boolean;
|
|
8
|
+
export interface PresetData {
|
|
9
|
+
String: string;
|
|
10
|
+
Number: number;
|
|
11
|
+
Boolean: boolean;
|
|
12
|
+
Array: unknown[];
|
|
13
|
+
Object: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export declare type PresetDataKeyType = 'String' | 'Number' | 'Boolean' | 'Array' | 'Object';
|
|
16
|
+
export declare const PRESET_DATA: PresetData;
|
|
17
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,QAAS,OAAO,KAAG,MAA6C,CAAA;AAEpF,eAAO,MAAM,YAAY,SAAU,MAAM,KAAG,MAAyC,CAAA;AAErF,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,OAA6C,CAAA;AAErF,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,OAA6C,CAAA;AAErF,eAAO,MAAM,SAAS,QAAS,OAAO,KAAG,OAA8C,CAAA;AAEvF,eAAO,MAAM,OAAO,QAAS,OAAO,KAAG,OAA6B,CAAA;AAEpE,eAAO,MAAM,QAAQ,QAAS,OAAO,KAAG,OAA6C,CAAA;AAErF,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAED,oBAAY,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAA;AAEpF,eAAO,MAAM,WAAW,EAAE,UAMzB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const getType: (val: unknown) => string;
|
|
2
|
+
export declare const getShortType: (type: string) => string;
|
|
3
|
+
export declare const isString: (val: unknown) => boolean;
|
|
4
|
+
export declare const isNumber: (val: unknown) => boolean;
|
|
5
|
+
export declare const isBoolean: (val: unknown) => boolean;
|
|
6
|
+
export declare const isArray: (val: unknown) => boolean;
|
|
7
|
+
export declare const isObject: (val: unknown) => boolean;
|
|
8
|
+
export interface PresetData {
|
|
9
|
+
String: string;
|
|
10
|
+
Number: number;
|
|
11
|
+
Boolean: boolean;
|
|
12
|
+
Array: unknown[];
|
|
13
|
+
Object: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export declare type PresetDataKeyType = 'String' | 'Number' | 'Boolean' | 'Array' | 'Object';
|
|
16
|
+
export declare const PRESET_DATA: PresetData;
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import Container from './Container/Container';
|
|
2
|
+
import type { UtilityClass, UtilityObject } from './Type/utility';
|
|
3
|
+
import type { APP_CONFIG, IServiceProvider } from './Type/types';
|
|
4
|
+
/**
|
|
5
|
+
* Application 核心应用
|
|
6
|
+
* @extends Container
|
|
7
|
+
* @author SunnyXu <xy@ztes.com>
|
|
8
|
+
*/
|
|
9
|
+
export default class Application extends Container {
|
|
10
|
+
private static VERSION;
|
|
11
|
+
private adapters;
|
|
12
|
+
private providers;
|
|
13
|
+
/**
|
|
14
|
+
* lifecycle
|
|
15
|
+
* 生命周期
|
|
16
|
+
* @private
|
|
17
|
+
*/
|
|
18
|
+
private static lifecycle;
|
|
19
|
+
/**
|
|
20
|
+
* getterProviders Providers 获取器
|
|
21
|
+
*/
|
|
22
|
+
getterProviders(): IServiceProvider[];
|
|
23
|
+
/**
|
|
24
|
+
* getProviders
|
|
25
|
+
* 获取
|
|
26
|
+
* @protected
|
|
27
|
+
*/
|
|
28
|
+
private static getProviders;
|
|
29
|
+
/**
|
|
30
|
+
* setterProviders Providers
|
|
31
|
+
* 设置器
|
|
32
|
+
* @param providers
|
|
33
|
+
*/
|
|
34
|
+
setterProviders(providers: IServiceProvider[]): void;
|
|
35
|
+
/**
|
|
36
|
+
* setProviders
|
|
37
|
+
* 设置
|
|
38
|
+
* @param providers
|
|
39
|
+
*/
|
|
40
|
+
static setProviders(providers: IServiceProvider[]): void;
|
|
41
|
+
/**
|
|
42
|
+
* registerProvider
|
|
43
|
+
* @description 注册服务提供者
|
|
44
|
+
* @param provider
|
|
45
|
+
*/
|
|
46
|
+
static registerProvider(provider: any): void;
|
|
47
|
+
/**
|
|
48
|
+
* registerProviders
|
|
49
|
+
* 批量注册
|
|
50
|
+
* @param providers
|
|
51
|
+
*/
|
|
52
|
+
static registerProviders(providers: IServiceProvider[]): void;
|
|
53
|
+
/**
|
|
54
|
+
* config
|
|
55
|
+
* 配置
|
|
56
|
+
* @param {Object} config
|
|
57
|
+
* @param {String} name
|
|
58
|
+
*/
|
|
59
|
+
static setConfig(name: string, config: UtilityObject): void;
|
|
60
|
+
/**
|
|
61
|
+
* getConfig
|
|
62
|
+
* 获取
|
|
63
|
+
* @param name
|
|
64
|
+
* @param {Object} def 默认值
|
|
65
|
+
*/
|
|
66
|
+
static getConfig(name: string, def?: any): UtilityObject;
|
|
67
|
+
/**
|
|
68
|
+
* setAppConfig
|
|
69
|
+
* 设置App配置
|
|
70
|
+
* @param config
|
|
71
|
+
*/
|
|
72
|
+
static setAppConfig(config: APP_CONFIG): void;
|
|
73
|
+
/**
|
|
74
|
+
* getAppConfig
|
|
75
|
+
* 获取App配置
|
|
76
|
+
* @param name
|
|
77
|
+
* @description 遵守getAppConfig中参数值和返回值的约定
|
|
78
|
+
*/
|
|
79
|
+
static getAppConfig<T extends keyof APP_CONFIG>(name: T): APP_CONFIG[T];
|
|
80
|
+
/**
|
|
81
|
+
* bindAdapter
|
|
82
|
+
* 绑定
|
|
83
|
+
* @param adapter
|
|
84
|
+
* @param payload
|
|
85
|
+
*/
|
|
86
|
+
static bindAdapter(adapter: UtilityClass, payload?: UtilityObject): void;
|
|
87
|
+
/**
|
|
88
|
+
* setAdapter
|
|
89
|
+
* 新增
|
|
90
|
+
* @param adapter
|
|
91
|
+
* @param instance
|
|
92
|
+
* @protected
|
|
93
|
+
*/
|
|
94
|
+
setterAdapter(adapter: UtilityClass, instance: UtilityObject): void;
|
|
95
|
+
/**
|
|
96
|
+
* static getAdapter
|
|
97
|
+
* 获取适配器
|
|
98
|
+
* @param adapter 必须是个类
|
|
99
|
+
* @return instance
|
|
100
|
+
*/
|
|
101
|
+
static getAdapter(adapter: UtilityClass): any;
|
|
102
|
+
/**
|
|
103
|
+
* static getAdapter
|
|
104
|
+
* 适配器 获取器
|
|
105
|
+
* @param adapter
|
|
106
|
+
*/
|
|
107
|
+
getterAdapter(adapter: UtilityClass): any;
|
|
108
|
+
/**
|
|
109
|
+
* getService
|
|
110
|
+
* 获取服务实例
|
|
111
|
+
* @param serviceName
|
|
112
|
+
*/
|
|
113
|
+
static getService<T>(serviceName: string): T;
|
|
114
|
+
/**
|
|
115
|
+
* Application instance
|
|
116
|
+
* 获取应用实例
|
|
117
|
+
* @description 应该使用Proxy进行拦截,目前先放行
|
|
118
|
+
*/
|
|
119
|
+
static getInstance(): InstanceType<typeof Application>;
|
|
120
|
+
/**
|
|
121
|
+
* App run
|
|
122
|
+
* 框架应用运行
|
|
123
|
+
* @param {CallableFunction} callback
|
|
124
|
+
*/
|
|
125
|
+
static run(callback?: CallableFunction): void;
|
|
126
|
+
}
|