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,127 @@
|
|
|
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
|
+
}
|
|
127
|
+
//# sourceMappingURL=Application.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../../../../src/core/Application.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAajE;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS;IAE9C,OAAO,CAAC,MAAM,CAAC,OAAO,CAAmB;IAEzC,OAAO,CAAC,QAAQ,CAAiB;IAEjC,OAAO,CAAC,SAAS,CAA0B;IAI3C;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,SAAS;IAwBxB;;OAEG;IACI,eAAe,IAAI,gBAAgB,EAAE;IAK5C;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;IAI3B;;;;OAIG;IACI,eAAe,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,IAAI;IAa3D;;;;OAIG;WACW,YAAY,CAAC,SAAS,EAAE,gBAAgB,EAAE,GAAG,IAAI;IAI/D;;;;OAIG;WACW,gBAAgB,CAAC,QAAQ,EAAE,GAAG;IAO5C;;;;OAIG;WACW,iBAAiB,CAAC,SAAS,EAAE,gBAAgB,EAAE;IAQ7D;;;;;OAKG;WACW,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI;IAKlE;;;;;OAKG;WACW,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,GAAG,aAAa;IAU/D;;;;OAIG;WACW,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI;IAIpD;;;;;OAKG;WACW,YAAY,CAAC,CAAC,SAAS,MAAM,UAAU,EAAE,IAAI,EAAE,CAAC;IAI9D;;;;;OAKG;WACW,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,aAAa;IAUxE;;;;;;OAMG;IACI,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa;IAWnE;;;;;OAKG;WACW,UAAU,CAAC,OAAO,EAAE,YAAY;IAO9C;;;;OAIG;IACI,aAAa,CAAC,OAAO,EAAE,YAAY;IAI1C;;;;OAIG;WACW,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC;IAQnD;;;;OAIG;WACoB,WAAW,IAAI,YAAY,CAAC,OAAO,WAAW,CAAC;IAStE;;;;OAIG;WACW,GAAG,CAAC,QAAQ,CAAC,EAAE,gBAAgB;CAShD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IHelper } from '../Type/types';
|
|
2
|
+
export default abstract class Command {
|
|
3
|
+
protected payload: any[];
|
|
4
|
+
protected $helper: IHelper;
|
|
5
|
+
protected constructor(...payload: any[]);
|
|
6
|
+
abstract handle(...args: any[]): any | Promise<any> | void;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=Command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Command.d.ts","sourceRoot":"","sources":["../../../../src/core/Command/Command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,OAAO;IACjC,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC;IAEzB,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC;IAE3B,SAAS,aAAa,GAAG,OAAO,EAAE,GAAG,EAAE;aAKvB,MAAM,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI;CACpE"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { ClassConstructor } from '../Type/utility';
|
|
2
|
+
import type { IContainer } from '../Type/types';
|
|
3
|
+
/**
|
|
4
|
+
* Class Container
|
|
5
|
+
* 容器类
|
|
6
|
+
* @author SunnyXu <xy@ztes.com>
|
|
7
|
+
*/
|
|
8
|
+
export default class Container implements IContainer {
|
|
9
|
+
protected static instance: unknown;
|
|
10
|
+
protected instances: Map<any, any>;
|
|
11
|
+
protected bindings: Record<string, any>;
|
|
12
|
+
protected aliases: Record<string, any>;
|
|
13
|
+
/**
|
|
14
|
+
* bind 绑定实体
|
|
15
|
+
* @param {String|Array} abstract
|
|
16
|
+
* @param {*} concrete
|
|
17
|
+
*/
|
|
18
|
+
bind(abstract: string | string[], concrete: any): void;
|
|
19
|
+
/**
|
|
20
|
+
* make 创建类的实例/获取对象 create instance/object
|
|
21
|
+
* @param abstract
|
|
22
|
+
* @param params
|
|
23
|
+
* @param shared
|
|
24
|
+
*/
|
|
25
|
+
make(abstract: string, params?: object | [], shared?: boolean): any;
|
|
26
|
+
/**
|
|
27
|
+
* makeClass 创建类
|
|
28
|
+
* @param name
|
|
29
|
+
* @param executor
|
|
30
|
+
* @param params
|
|
31
|
+
* @param shared
|
|
32
|
+
*/
|
|
33
|
+
protected makeClass(name: string, executor: ClassConstructor, params: unknown, shared?: boolean): any;
|
|
34
|
+
/**
|
|
35
|
+
* makeFunc 创建函数
|
|
36
|
+
* @param name
|
|
37
|
+
* @param executor
|
|
38
|
+
* @param params
|
|
39
|
+
* @param shared
|
|
40
|
+
* @protected
|
|
41
|
+
*/
|
|
42
|
+
protected makeFunc(name: string, executor: CallableFunction, params: unknown, shared?: boolean): any;
|
|
43
|
+
/**
|
|
44
|
+
* has as existence
|
|
45
|
+
* 是否存在标识 existence 的别名
|
|
46
|
+
* @param {String} name
|
|
47
|
+
*/
|
|
48
|
+
has(name: string): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* existence 存在标识
|
|
51
|
+
* @param {String} name
|
|
52
|
+
*/
|
|
53
|
+
existence(name: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* getAlias 获取别名
|
|
56
|
+
* @param abstract
|
|
57
|
+
*/
|
|
58
|
+
getAlias(abstract: string): any;
|
|
59
|
+
/**
|
|
60
|
+
* get 获取实例
|
|
61
|
+
* @param abstract
|
|
62
|
+
*/
|
|
63
|
+
get(abstract: string): any;
|
|
64
|
+
/**
|
|
65
|
+
* singleton 单例
|
|
66
|
+
* @param abstract
|
|
67
|
+
* @param concrete
|
|
68
|
+
*/
|
|
69
|
+
singleton(abstract: string, concrete: any): void;
|
|
70
|
+
/**
|
|
71
|
+
* getInstance 获取实例
|
|
72
|
+
*
|
|
73
|
+
*/
|
|
74
|
+
static getInstance<Instance>(): Container | Instance;
|
|
75
|
+
/**
|
|
76
|
+
* proxyInstance 代理实例
|
|
77
|
+
*
|
|
78
|
+
*/
|
|
79
|
+
protected proxyInstance(): this;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=Container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/core/Container/Container.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,YAAW,UAAU;IAEhD,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC;IAEnC,SAAS,CAAC,SAAS,gBAAa;IAEhC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAE7C,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAE5C;;;;OAIG;IACI,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG;IA2BtD;;;;;OAKG;IACI,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,EAAE,EAAE,MAAM,UAAQ;IAiClE;;;;;;OAMG;IACH,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAQ;IAY7F;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAAQ;IAU5F;;;;OAIG;IACI,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC;;;OAGG;IACI,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAKvC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAKzB;;;OAGG;IACI,GAAG,CAAC,QAAQ,EAAE,MAAM;IAO3B;;;;OAIG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG;IAIhD;;;OAGG;WACW,WAAW,CAAC,QAAQ;IASlC;;;OAGG;IACH,SAAS,CAAC,aAAa,IAAI,IAAI;CASlC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HttpAdapterInterface } from '../Type/adapters';
|
|
2
|
+
/**
|
|
3
|
+
* Class AxiosAdapter
|
|
4
|
+
* @description axios适配器,适配器主要完成
|
|
5
|
+
*/
|
|
6
|
+
export default class AxiosAdapter extends HttpAdapterInterface<{}> {
|
|
7
|
+
/**
|
|
8
|
+
* Method request
|
|
9
|
+
* @returns Promise
|
|
10
|
+
*/
|
|
11
|
+
request(): Promise<unknown>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=AxiosAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AxiosAdapter.d.ts","sourceRoot":"","sources":["../../../../src/core/Contracts/AxiosAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAEvD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,oBAAoB,CAAC,EAAE,CAAC;IAChE;;;OAGG;IACH,OAAO;CAgBR"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Service from '../Service/Service';
|
|
2
|
+
import type { IResponseReturn, TResponseDataReturn, IHelper } from '../Type/types';
|
|
3
|
+
/**
|
|
4
|
+
* Class Helper
|
|
5
|
+
* @extends Service
|
|
6
|
+
*/
|
|
7
|
+
export default class Helper extends Service implements IHelper {
|
|
8
|
+
env(): Record<any, any>;
|
|
9
|
+
private webStorage;
|
|
10
|
+
/**
|
|
11
|
+
* Local storage
|
|
12
|
+
* @param name
|
|
13
|
+
* @param payload
|
|
14
|
+
*/
|
|
15
|
+
storage(name?: string, payload?: any): any | Record<any, any>;
|
|
16
|
+
cookie(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Session storage
|
|
19
|
+
* @param name
|
|
20
|
+
* @param payload
|
|
21
|
+
*/
|
|
22
|
+
session(name?: string, payload?: any): any | Record<any, any>;
|
|
23
|
+
/**
|
|
24
|
+
* Method http
|
|
25
|
+
* 发起一个http请求
|
|
26
|
+
* @param api
|
|
27
|
+
* @param data
|
|
28
|
+
* @param headers
|
|
29
|
+
*/
|
|
30
|
+
http(api: any, data: any, headers?: {}): Promise<IResponseReturn | undefined>;
|
|
31
|
+
/**
|
|
32
|
+
* 发送一个Http请求
|
|
33
|
+
* @param api
|
|
34
|
+
* @param data
|
|
35
|
+
* @param handle
|
|
36
|
+
* @param config
|
|
37
|
+
* @param returnResponse
|
|
38
|
+
*/
|
|
39
|
+
send(api: any, data: any, handle: any, config: any, returnResponse?: boolean): Promise<TResponseDataReturn | IResponseReturn>;
|
|
40
|
+
checkAuth(): void;
|
|
41
|
+
cookies(name: string): Record<any, any>;
|
|
42
|
+
cookies(name: string, payload?: any): void;
|
|
43
|
+
request(api: any, data: any, config: any): void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=Helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Helper.d.ts","sourceRoot":"","sources":["../../../../src/core/Helper/Helper.ts"],"names":[],"mappings":"AAMA,OAAO,OAAO,MAAM,oBAAoB,CAAA;AAExC,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,OAAO,EAER,MAAM,eAAe,CAAA;AA0BtB;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,OAAQ,YAAW,OAAO;IACrD,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;IAI9B,OAAO,CAAC,UAAU;IAoBlB;;;;OAIG;IACI,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;IAK7D,MAAM;IAEb;;;;OAIG;IACI,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;IAIpE;;;;;;OAMG;IAKU,IAAI,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA,EAAE,OAAO,KAAK;IA0BzC;;;;;;;OAOG;IAGU,IAAI,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA,EAAE,MAAM,KAAA,EAAE,MAAM,KAAA,EAAE,cAAc,UAAO;IAoB3D,SAAS,IAAI,IAAI;IAExB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;IACvC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,IAAI;IAO1C,OAAO,CAAC,GAAG,KAAA,EAAE,IAAI,KAAA,EAAE,MAAM,KAAA;CAC1B"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
declare type Type = "localStorage" | "sessionStorage";
|
|
2
|
+
/**
|
|
3
|
+
* Class WebStorage
|
|
4
|
+
* 浏览器存储
|
|
5
|
+
*/
|
|
6
|
+
export default class WebStorage {
|
|
7
|
+
type: Type;
|
|
8
|
+
storage: Storage;
|
|
9
|
+
/**
|
|
10
|
+
* constructor
|
|
11
|
+
* @param {String} type 存储类型
|
|
12
|
+
*/
|
|
13
|
+
constructor({ type }: {
|
|
14
|
+
type: Type;
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* get get|getAll storage
|
|
18
|
+
* @param key
|
|
19
|
+
*/
|
|
20
|
+
get(key?: string): string | any;
|
|
21
|
+
/**
|
|
22
|
+
* set
|
|
23
|
+
* Set storage 保持/设置数据
|
|
24
|
+
* @param key
|
|
25
|
+
* @param value
|
|
26
|
+
*/
|
|
27
|
+
set(key: string, value: string | any[] | Record<any, any>): void;
|
|
28
|
+
/**
|
|
29
|
+
* save
|
|
30
|
+
* Save storage as set set的别名
|
|
31
|
+
* @param key
|
|
32
|
+
* @param value
|
|
33
|
+
*/
|
|
34
|
+
save(key: string, value: string | any[] | Record<any, any>): void;
|
|
35
|
+
/**
|
|
36
|
+
* delete
|
|
37
|
+
* Delete storage 删除一个或数组内多个
|
|
38
|
+
* @param {String|Array<string>} key
|
|
39
|
+
*/
|
|
40
|
+
delete(key: string | string[]): void;
|
|
41
|
+
/**
|
|
42
|
+
* remove
|
|
43
|
+
* Remove storage as delete delete的别名
|
|
44
|
+
* @param key
|
|
45
|
+
*/
|
|
46
|
+
remove(key: string | string[]): void;
|
|
47
|
+
/**
|
|
48
|
+
* clear
|
|
49
|
+
* Clear storage 清空
|
|
50
|
+
*/
|
|
51
|
+
clear(): void;
|
|
52
|
+
/**
|
|
53
|
+
* keys
|
|
54
|
+
* Get storage keys 获取全部键
|
|
55
|
+
* @return keys
|
|
56
|
+
*/
|
|
57
|
+
keys(): string[];
|
|
58
|
+
/**
|
|
59
|
+
* getAll
|
|
60
|
+
* Get storage key & val 获取全部键值对
|
|
61
|
+
*/
|
|
62
|
+
getAll(): Record<any, any>;
|
|
63
|
+
/**
|
|
64
|
+
* setConfig
|
|
65
|
+
* @param type
|
|
66
|
+
*/
|
|
67
|
+
setConfig({ type }: {
|
|
68
|
+
type: Type;
|
|
69
|
+
}): void;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=WebStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WebStorage.d.ts","sourceRoot":"","sources":["../../../../src/core/Helper/Storage/WebStorage.ts"],"names":[],"mappings":"AAGA,aAAK,IAAI,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAEtB,IAAI,EAAE,IAAI,CAAkB;IAE5B,OAAO,UAAgE;IAE9E;;;OAGG;gBACS,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE;IAIpC;;;OAGG;IACI,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG;IAUtC;;;;;OAKG;IACI,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI;IAUvE;;;;;OAKG;IACI,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI;IAIxE;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAY3C;;;;OAIG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAI3C;;;OAGG;IACI,KAAK,IAAI,IAAI;IAIpB;;;;OAIG;IACI,IAAI,IAAI,MAAM,EAAE;IAKvB;;;OAGG;IACI,MAAM,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;IAKjC;;;OAGG;IACI,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE;CAG1C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exception Class
|
|
3
|
+
* 目前原生的错误类型
|
|
4
|
+
* Error [一般错误类型]
|
|
5
|
+
* SyntaxError [语法错误]
|
|
6
|
+
* ReferenceError [不存在的变量]
|
|
7
|
+
* RangeError [超出有效范围]
|
|
8
|
+
* TypeError [非预期类型]
|
|
9
|
+
* URIError [URI参数错误]
|
|
10
|
+
* EvalError [eval函数没有正确执行]
|
|
11
|
+
* Example: throw new Exception() catch(error) error.name,error.message,error.code,error.stack
|
|
12
|
+
*/
|
|
13
|
+
export default class Exception extends Error {
|
|
14
|
+
name: string;
|
|
15
|
+
message: string;
|
|
16
|
+
code: number;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param {String} name 错误名称
|
|
20
|
+
* @param {String} message 错误提示
|
|
21
|
+
* @param {Number} code 错误码
|
|
22
|
+
*/
|
|
23
|
+
constructor(name: string, message: string, code?: number);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=Exception.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Exception.d.ts","sourceRoot":"","sources":["../../../../src/core/Libs/Exception.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,KAAK;IAEnC,IAAI,SAAW;IAEf,OAAO,SAAmB;IAE1B,IAAI,SAAO;IAElB;;;;;OAKG;gBACS,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,GAAE,MAAY;CAM9D"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
declare type variableType = "string" | "number" | "object" | "undefined" | "function" | "boolean" | "bigInt" | "symbol";
|
|
2
|
+
declare type TrimType = "R" | "L" | "";
|
|
3
|
+
/**
|
|
4
|
+
* Class Lib
|
|
5
|
+
* 基础函数库,Lodash、Underscore... So big
|
|
6
|
+
*/
|
|
7
|
+
export default class Lib {
|
|
8
|
+
/**
|
|
9
|
+
* typeOf 判断变量类型
|
|
10
|
+
* @param value
|
|
11
|
+
* @param type
|
|
12
|
+
*/
|
|
13
|
+
static typeOf<T>(value: unknown, type: variableType): value is T;
|
|
14
|
+
/**
|
|
15
|
+
* getTag 判断变量类型
|
|
16
|
+
* @param value
|
|
17
|
+
*/
|
|
18
|
+
static getTag(value: unknown): string;
|
|
19
|
+
/**
|
|
20
|
+
* isFunction 是否函数
|
|
21
|
+
* @param {Function} value
|
|
22
|
+
* @return {Boolean}
|
|
23
|
+
*/
|
|
24
|
+
static isFunction(value: unknown): value is typeof Function;
|
|
25
|
+
/**
|
|
26
|
+
* isString 是否字符串
|
|
27
|
+
* @param {String} value
|
|
28
|
+
* @return {Boolean}
|
|
29
|
+
*/
|
|
30
|
+
static isString(value: unknown): value is string;
|
|
31
|
+
/**
|
|
32
|
+
* isNumber 是否数字
|
|
33
|
+
* @param value
|
|
34
|
+
* @return {Boolean}
|
|
35
|
+
*/
|
|
36
|
+
static isNumber(value: unknown): value is number;
|
|
37
|
+
/**
|
|
38
|
+
* isObject 是否对象
|
|
39
|
+
* @param {Object} value
|
|
40
|
+
*/
|
|
41
|
+
static isObject(value: unknown): value is Record<any, any>;
|
|
42
|
+
/**
|
|
43
|
+
* isObject 是否Undefined
|
|
44
|
+
* @param {*} value
|
|
45
|
+
* @return boolean
|
|
46
|
+
*/
|
|
47
|
+
static isUndefined(value: unknown): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* isNull 是否Null
|
|
50
|
+
* @param value
|
|
51
|
+
*/
|
|
52
|
+
static isNull(value: unknown): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* isEmpty 是否空
|
|
55
|
+
* 目前只对 null undefined '' {} [] 做处理
|
|
56
|
+
* @param value
|
|
57
|
+
*/
|
|
58
|
+
static isEmpty(value: unknown): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* isClass 是否类
|
|
61
|
+
* @param value
|
|
62
|
+
*/
|
|
63
|
+
static isClass(value: unknown): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* 字符串去除首尾字符
|
|
66
|
+
* @param str 字符串
|
|
67
|
+
* @param char 字符
|
|
68
|
+
* @param type 类型
|
|
69
|
+
*/
|
|
70
|
+
static strTrim(str: string, char: string, type?: TrimType): string;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=Lib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Lib.d.ts","sourceRoot":"","sources":["../../../../src/core/Libs/Lib.ts"],"names":[],"mappings":"AAAA,aAAK,YAAY,GACb,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,WAAW,GACX,UAAU,GACV,SAAS,GACT,QAAQ,GACR,QAAQ,CAAC;AAEb,aAAK,QAAQ,GAAG,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;AAE/B;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,GAAG;IACtB;;;;OAIG;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,KAAK,IAAI,CAAC;IAIhE;;;OAGG;WACW,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAI5C;;;;OAIG;WACW,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,QAAQ;IAMlE;;;;OAIG;WACW,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM;IAMvD;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM;IAIhD;;;OAGG;WACW,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC;IAIjE;;;;OAIG;IACH,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAI3C;;;OAGG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAItC;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IAavC;;;OAGG;WACW,OAAO,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;IA2B9C;;;;;OAKG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,QAAQ;CAc1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/Provider/CommandProvider.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,eAAe;IACnD,QAAQ,IAAI,IAAI;CAKxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelperProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/Provider/HelperProvider.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAGhD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,eAAe;IAClD,QAAQ,IAAI,IAAI;CAKxB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import ServiceProvider from "./ServiceProvider";
|
|
2
|
+
/**
|
|
3
|
+
* @name HttpProvider
|
|
4
|
+
* @description HTTP服务提供者,对HTTP服务进行注册
|
|
5
|
+
*/
|
|
6
|
+
export default class HttpProvider extends ServiceProvider {
|
|
7
|
+
/**
|
|
8
|
+
* Method Register
|
|
9
|
+
* 注册服务
|
|
10
|
+
* @protected
|
|
11
|
+
*/
|
|
12
|
+
register(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=HttpProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HttpProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/Provider/HttpProvider.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAKhD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,eAAe;IACvD;;;;OAIG;IACI,QAAQ,IAAI,IAAI;CA2ExB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { IApplicationInstance } from '../Type/types';
|
|
2
|
+
export default abstract class ServiceProvider {
|
|
3
|
+
protected app: import("../Type/types").IApplication;
|
|
4
|
+
/**
|
|
5
|
+
* constructor
|
|
6
|
+
* @param app Application instance
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
constructor(app: IApplicationInstance);
|
|
10
|
+
/**
|
|
11
|
+
* register
|
|
12
|
+
* 注册 provider
|
|
13
|
+
*/
|
|
14
|
+
register(): void;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=ServiceProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ServiceProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/Provider/ServiceProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AAEzD,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,eAAe;IAE3C,SAAS,CAAC,GAAG,uCAAA;IAEb;;;;OAIG;gBACS,GAAG,EAAE,oBAAoB;IAKrC;;;OAGG;IACI,QAAQ,IAAI,IAAI;CAGxB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import Service from './Service';
|
|
2
|
+
import type { TContentType, TCarryData, TApiRoute, IHttpSendConfig, RequestMethod, HTTP_SERVICE_CONFIG, DATA_CARRYING } from '../Type/types';
|
|
3
|
+
import type { UtilityObject } from '../Type/utility';
|
|
4
|
+
declare type IApplicationInstance = any;
|
|
5
|
+
/**
|
|
6
|
+
* Class HttpService
|
|
7
|
+
*/
|
|
8
|
+
export default class HttpService extends Service {
|
|
9
|
+
_http: any;
|
|
10
|
+
_api: UtilityObject;
|
|
11
|
+
_headers: Record<string, any>;
|
|
12
|
+
_host: string;
|
|
13
|
+
_isRESTful: boolean;
|
|
14
|
+
_carryingData: UtilityObject;
|
|
15
|
+
_mode: TContentType;
|
|
16
|
+
$helper: null;
|
|
17
|
+
_requestMiddleware: CallableFunction;
|
|
18
|
+
_responseMiddleware: CallableFunction;
|
|
19
|
+
_context: any;
|
|
20
|
+
/**
|
|
21
|
+
* _contentType Request type 请求类型
|
|
22
|
+
* 'application/json' 为 Request Payload 请求方式
|
|
23
|
+
* 'application/x-www-form-urlencoded;charset=UTF-8' 为 Form Data 请求方式 需QS配合使用
|
|
24
|
+
* OTHER Query String Parameters 为 _method = 'GET'
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Constructor
|
|
28
|
+
* @param {Object} app
|
|
29
|
+
* @param {Object} HTTP_ADAPTER
|
|
30
|
+
* @param {String} HTTP_API
|
|
31
|
+
* @param {String} HTTP_HOST
|
|
32
|
+
* @param {Boolean} IS_RESTFUL
|
|
33
|
+
* @param {String} CONTENT_TYPE
|
|
34
|
+
* @param {Object} DATA_CARRYING
|
|
35
|
+
* @param {Function} REQUEST_MIDDLEWARE
|
|
36
|
+
* @param {Function} RESPONSE_MIDDLEWARE
|
|
37
|
+
*/
|
|
38
|
+
constructor(app: IApplicationInstance, { HTTP_ADAPTER, HTTP_API, HTTP_HOST, IS_RESTFUL, CONTENT_TYPE, DATA_CARRYING, REQUEST_MIDDLEWARE, RESPONSE_MIDDLEWARE }: HTTP_SERVICE_CONFIG);
|
|
39
|
+
/**
|
|
40
|
+
* Method setContentType 设置请求类型
|
|
41
|
+
* @param {String} mode
|
|
42
|
+
*/
|
|
43
|
+
setContentType(mode: TContentType): void;
|
|
44
|
+
/**
|
|
45
|
+
* Method setDataCarry 处理携带数据
|
|
46
|
+
* @param {*} REQUEST_HEADERS
|
|
47
|
+
* @param {*} REQUEST_DATA
|
|
48
|
+
*/
|
|
49
|
+
setDataCarry(REQUEST_HEADERS: DATA_CARRYING['REQUEST_HEADERS'], REQUEST_DATA: DATA_CARRYING['REQUEST_DATA']): void;
|
|
50
|
+
/**
|
|
51
|
+
* Method carryingHandle 携带数据处理
|
|
52
|
+
* @param {String} name
|
|
53
|
+
* @param {*} val
|
|
54
|
+
* @param {*} type
|
|
55
|
+
*/
|
|
56
|
+
carryingHandle(name: string, val: any, type?: TCarryData): void;
|
|
57
|
+
/**
|
|
58
|
+
* Method http 发送一个请求
|
|
59
|
+
* @param api
|
|
60
|
+
* @param {JSON} data
|
|
61
|
+
* @param headers
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
http(api: string | TApiRoute, data: Record<string, any>, headers: Record<string, any>): Promise<any>;
|
|
65
|
+
/**
|
|
66
|
+
* Send Request
|
|
67
|
+
* @returns {Promise<*|*>}
|
|
68
|
+
* @param returnResponse 返回响应数据
|
|
69
|
+
*/
|
|
70
|
+
request(returnResponse: boolean): Promise<any>;
|
|
71
|
+
/**
|
|
72
|
+
* Method Send
|
|
73
|
+
* 发送一个自定义请求
|
|
74
|
+
* @param apiRoute
|
|
75
|
+
* @param data
|
|
76
|
+
* @param config
|
|
77
|
+
* @param returnResponse
|
|
78
|
+
* @returns {Promise<void>}
|
|
79
|
+
*/
|
|
80
|
+
send(apiRoute: string | TApiRoute, data: Record<string, any>, config?: IHttpSendConfig, returnResponse?: boolean): Promise<any>;
|
|
81
|
+
/**
|
|
82
|
+
* 制作一个发型,目前发型用于二次请求相关
|
|
83
|
+
* @param apiRoute
|
|
84
|
+
*/
|
|
85
|
+
makeHairstyle(apiRoute: string | TApiRoute): TApiRoute;
|
|
86
|
+
/**
|
|
87
|
+
* Method getParameters
|
|
88
|
+
* 从Api里读取请求方法、参数和地址
|
|
89
|
+
* @param {*} apiRoute
|
|
90
|
+
* @param {*} data
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
getParameters(apiRoute: string | TApiRoute, data: Record<string, any>): {
|
|
94
|
+
api: string;
|
|
95
|
+
url: string;
|
|
96
|
+
method: string | undefined;
|
|
97
|
+
type: TContentType;
|
|
98
|
+
data: any;
|
|
99
|
+
auth: boolean | undefined;
|
|
100
|
+
hairstyle: (string | boolean | [RequestMethod, TContentType] | undefined)[];
|
|
101
|
+
body: Record<string, any>;
|
|
102
|
+
payload: any;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* Method setHeaders
|
|
106
|
+
* 设置Headers multiple
|
|
107
|
+
* @param {JSON|Object} config
|
|
108
|
+
*/
|
|
109
|
+
setHeaders(config?: {}): void;
|
|
110
|
+
getHeaders(): Record<string, any>;
|
|
111
|
+
/**
|
|
112
|
+
* Method setHeader
|
|
113
|
+
* 设置Headers single
|
|
114
|
+
* @param {String} name
|
|
115
|
+
* @param {String} val
|
|
116
|
+
*/
|
|
117
|
+
setHeader(name: string, val: any): void;
|
|
118
|
+
deleteHeader(name: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* Method setData
|
|
121
|
+
* 设置携带数据 通过Data
|
|
122
|
+
* @param {*} name
|
|
123
|
+
* @param {*} val
|
|
124
|
+
*/
|
|
125
|
+
setData(name: string, val: any): void;
|
|
126
|
+
}
|
|
127
|
+
export {};
|
|
128
|
+
//# sourceMappingURL=HttpService.d.ts.map
|