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.
Files changed (150) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/framework/es/core/Application.d.ts +126 -0
  4. package/framework/es/core/Command/Command.d.ts +7 -0
  5. package/framework/es/core/Container/Container.d.ts +80 -0
  6. package/framework/es/core/Contracts/AxiosAdapter.d.ts +12 -0
  7. package/framework/es/core/Helper/Helper.d.ts +43 -0
  8. package/framework/es/core/Helper/Storage/WebStorage.d.ts +71 -0
  9. package/framework/es/core/Libs/Exception.d.ts +24 -0
  10. package/framework/es/core/Libs/Lib.d.ts +72 -0
  11. package/framework/es/core/Provider/CommandProvider.d.ts +4 -0
  12. package/framework/es/core/Provider/HelperProvider.d.ts +4 -0
  13. package/framework/es/core/Provider/HttpProvider.d.ts +13 -0
  14. package/framework/es/core/Provider/ServiceProvider.d.ts +15 -0
  15. package/framework/es/core/Service/HttpService.d.ts +133 -0
  16. package/framework/es/core/Service/Service.d.ts +6 -0
  17. package/framework/es/core/Spanner/RESTful.d.ts +30 -0
  18. package/framework/es/core/Transformer/Transformer.d.ts +46 -0
  19. package/framework/es/core/Type/adapters.d.ts +25 -0
  20. package/framework/es/core/Type/types.d.ts +161 -0
  21. package/framework/es/core/TypeFunc/index.d.ts +6 -0
  22. package/framework/es/core/Wrenches/EventBus.d.ts +56 -0
  23. package/framework/es/core/Wrenches/is.d.ts +19 -0
  24. package/framework/es/ege.js +4 -0
  25. package/framework/es/ege.js.map +1 -0
  26. package/framework/es/index.d.ts +13 -0
  27. package/framework/es/pdd.js +4 -0
  28. package/framework/es/pdd.js.map +1 -0
  29. package/framework/es/src/core/Application.d.ts +127 -0
  30. package/framework/es/src/core/Application.d.ts.map +1 -0
  31. package/framework/es/src/core/Command/Command.d.ts +8 -0
  32. package/framework/es/src/core/Command/Command.d.ts.map +1 -0
  33. package/framework/es/src/core/Container/Container.d.ts +81 -0
  34. package/framework/es/src/core/Container/Container.d.ts.map +1 -0
  35. package/framework/es/src/core/Contracts/AxiosAdapter.d.ts +13 -0
  36. package/framework/es/src/core/Contracts/AxiosAdapter.d.ts.map +1 -0
  37. package/framework/es/src/core/Helper/Helper.d.ts +45 -0
  38. package/framework/es/src/core/Helper/Helper.d.ts.map +1 -0
  39. package/framework/es/src/core/Helper/Storage/WebStorage.d.ts +72 -0
  40. package/framework/es/src/core/Helper/Storage/WebStorage.d.ts.map +1 -0
  41. package/framework/es/src/core/Libs/Exception.d.ts +25 -0
  42. package/framework/es/src/core/Libs/Exception.d.ts.map +1 -0
  43. package/framework/es/src/core/Libs/Lib.d.ts +73 -0
  44. package/framework/es/src/core/Libs/Lib.d.ts.map +1 -0
  45. package/framework/es/src/core/Provider/CommandProvider.d.ts +5 -0
  46. package/framework/es/src/core/Provider/CommandProvider.d.ts.map +1 -0
  47. package/framework/es/src/core/Provider/HelperProvider.d.ts +5 -0
  48. package/framework/es/src/core/Provider/HelperProvider.d.ts.map +1 -0
  49. package/framework/es/src/core/Provider/HttpProvider.d.ts +14 -0
  50. package/framework/es/src/core/Provider/HttpProvider.d.ts.map +1 -0
  51. package/framework/es/src/core/Provider/ServiceProvider.d.ts +16 -0
  52. package/framework/es/src/core/Provider/ServiceProvider.d.ts.map +1 -0
  53. package/framework/es/src/core/Service/HttpService.d.ts +128 -0
  54. package/framework/es/src/core/Service/HttpService.d.ts.map +1 -0
  55. package/framework/es/src/core/Service/Service.d.ts +7 -0
  56. package/framework/es/src/core/Service/Service.d.ts.map +1 -0
  57. package/framework/es/src/core/Spanner/RESTful.d.ts +32 -0
  58. package/framework/es/src/core/Spanner/RESTful.d.ts.map +1 -0
  59. package/framework/es/src/core/Transformer/Transformer.d.ts +47 -0
  60. package/framework/es/src/core/Transformer/Transformer.d.ts.map +1 -0
  61. package/framework/es/src/core/Type/adapters.d.ts +26 -0
  62. package/framework/es/src/core/Type/adapters.d.ts.map +1 -0
  63. package/framework/es/src/core/Type/types.d.ts +186 -0
  64. package/framework/es/src/core/Type/types.d.ts.map +1 -0
  65. package/framework/es/src/core/TypeFunc/index.d.ts +8 -0
  66. package/framework/es/src/core/TypeFunc/index.d.ts.map +1 -0
  67. package/framework/es/src/core/Wrenches/EventBus.d.ts +57 -0
  68. package/framework/es/src/core/Wrenches/EventBus.d.ts.map +1 -0
  69. package/framework/es/src/core/Wrenches/is.d.ts +20 -0
  70. package/framework/es/src/core/Wrenches/is.d.ts.map +1 -0
  71. package/framework/es/src/index.d.ts +14 -0
  72. package/framework/es/src/index.d.ts.map +1 -0
  73. package/framework/es/src/utils.d.ts +17 -0
  74. package/framework/es/src/utils.d.ts.map +1 -0
  75. package/framework/es/utils.d.ts +16 -0
  76. package/framework/umd/core/Application.d.ts +126 -0
  77. package/framework/umd/core/Command/Command.d.ts +7 -0
  78. package/framework/umd/core/Container/Container.d.ts +80 -0
  79. package/framework/umd/core/Contracts/AxiosAdapter.d.ts +12 -0
  80. package/framework/umd/core/Helper/Helper.d.ts +43 -0
  81. package/framework/umd/core/Helper/Storage/WebStorage.d.ts +71 -0
  82. package/framework/umd/core/Libs/Exception.d.ts +24 -0
  83. package/framework/umd/core/Libs/Lib.d.ts +72 -0
  84. package/framework/umd/core/Provider/CommandProvider.d.ts +4 -0
  85. package/framework/umd/core/Provider/HelperProvider.d.ts +4 -0
  86. package/framework/umd/core/Provider/HttpProvider.d.ts +13 -0
  87. package/framework/umd/core/Provider/ServiceProvider.d.ts +15 -0
  88. package/framework/umd/core/Service/HttpService.d.ts +133 -0
  89. package/framework/umd/core/Service/Service.d.ts +6 -0
  90. package/framework/umd/core/Spanner/RESTful.d.ts +30 -0
  91. package/framework/umd/core/Transformer/Transformer.d.ts +46 -0
  92. package/framework/umd/core/Type/adapters.d.ts +25 -0
  93. package/framework/umd/core/Type/types.d.ts +161 -0
  94. package/framework/umd/core/TypeFunc/index.d.ts +6 -0
  95. package/framework/umd/core/Wrenches/EventBus.d.ts +56 -0
  96. package/framework/umd/core/Wrenches/is.d.ts +19 -0
  97. package/framework/umd/ege.js +4 -0
  98. package/framework/umd/ege.js.map +1 -0
  99. package/framework/umd/index.d.ts +13 -0
  100. package/framework/umd/pdd.js +4 -0
  101. package/framework/umd/pdd.js.map +1 -0
  102. package/framework/umd/src/core/Application.d.ts +127 -0
  103. package/framework/umd/src/core/Application.d.ts.map +1 -0
  104. package/framework/umd/src/core/Command/Command.d.ts +8 -0
  105. package/framework/umd/src/core/Command/Command.d.ts.map +1 -0
  106. package/framework/umd/src/core/Container/Container.d.ts +81 -0
  107. package/framework/umd/src/core/Container/Container.d.ts.map +1 -0
  108. package/framework/umd/src/core/Contracts/AxiosAdapter.d.ts +13 -0
  109. package/framework/umd/src/core/Contracts/AxiosAdapter.d.ts.map +1 -0
  110. package/framework/umd/src/core/Helper/Helper.d.ts +45 -0
  111. package/framework/umd/src/core/Helper/Helper.d.ts.map +1 -0
  112. package/framework/umd/src/core/Helper/Storage/WebStorage.d.ts +72 -0
  113. package/framework/umd/src/core/Helper/Storage/WebStorage.d.ts.map +1 -0
  114. package/framework/umd/src/core/Libs/Exception.d.ts +25 -0
  115. package/framework/umd/src/core/Libs/Exception.d.ts.map +1 -0
  116. package/framework/umd/src/core/Libs/Lib.d.ts +73 -0
  117. package/framework/umd/src/core/Libs/Lib.d.ts.map +1 -0
  118. package/framework/umd/src/core/Provider/CommandProvider.d.ts +5 -0
  119. package/framework/umd/src/core/Provider/CommandProvider.d.ts.map +1 -0
  120. package/framework/umd/src/core/Provider/HelperProvider.d.ts +5 -0
  121. package/framework/umd/src/core/Provider/HelperProvider.d.ts.map +1 -0
  122. package/framework/umd/src/core/Provider/HttpProvider.d.ts +14 -0
  123. package/framework/umd/src/core/Provider/HttpProvider.d.ts.map +1 -0
  124. package/framework/umd/src/core/Provider/ServiceProvider.d.ts +16 -0
  125. package/framework/umd/src/core/Provider/ServiceProvider.d.ts.map +1 -0
  126. package/framework/umd/src/core/Service/HttpService.d.ts +128 -0
  127. package/framework/umd/src/core/Service/HttpService.d.ts.map +1 -0
  128. package/framework/umd/src/core/Service/Service.d.ts +7 -0
  129. package/framework/umd/src/core/Service/Service.d.ts.map +1 -0
  130. package/framework/umd/src/core/Spanner/RESTful.d.ts +32 -0
  131. package/framework/umd/src/core/Spanner/RESTful.d.ts.map +1 -0
  132. package/framework/umd/src/core/Transformer/Transformer.d.ts +47 -0
  133. package/framework/umd/src/core/Transformer/Transformer.d.ts.map +1 -0
  134. package/framework/umd/src/core/Type/adapters.d.ts +26 -0
  135. package/framework/umd/src/core/Type/adapters.d.ts.map +1 -0
  136. package/framework/umd/src/core/Type/types.d.ts +186 -0
  137. package/framework/umd/src/core/Type/types.d.ts.map +1 -0
  138. package/framework/umd/src/core/TypeFunc/index.d.ts +8 -0
  139. package/framework/umd/src/core/TypeFunc/index.d.ts.map +1 -0
  140. package/framework/umd/src/core/Wrenches/EventBus.d.ts +57 -0
  141. package/framework/umd/src/core/Wrenches/EventBus.d.ts.map +1 -0
  142. package/framework/umd/src/core/Wrenches/is.d.ts +20 -0
  143. package/framework/umd/src/core/Wrenches/is.d.ts.map +1 -0
  144. package/framework/umd/src/index.d.ts +14 -0
  145. package/framework/umd/src/index.d.ts.map +1 -0
  146. package/framework/umd/src/utils.d.ts +17 -0
  147. package/framework/umd/src/utils.d.ts.map +1 -0
  148. package/framework/umd/utils.d.ts +16 -0
  149. package/index.d.ts +724 -0
  150. package/package.json +57 -0
@@ -0,0 +1,161 @@
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 = [string, RequestMethod?, boolean?];
84
+ export interface HttpApis {
85
+ [api: string]: TApiRoute;
86
+ }
87
+ export declare type IHttpSendConfig = {
88
+ host?: string;
89
+ headers?: Record<string, any>;
90
+ mode?: TContentType;
91
+ responseData?: boolean;
92
+ };
93
+ export declare type TResponseDataReturn = {
94
+ statusCode: number;
95
+ msg: string;
96
+ data: any;
97
+ timestamp: number;
98
+ };
99
+ export interface IResponseReturn extends Response {
100
+ data: TResponseDataReturn;
101
+ }
102
+ export interface IHelper {
103
+ env(): Record<any, any>;
104
+ storage(name: string): Record<any, any>;
105
+ storage(name: string, payload?: any): void;
106
+ cookies(name: string): Record<any, any>;
107
+ cookies(name: string, payload?: any): void;
108
+ session(name: string): Record<any, any>;
109
+ session(name: string, payload?: any): void;
110
+ /**
111
+ * 发送一个http请求
112
+ * @param api 接口key
113
+ * @param data 请求数据
114
+ * @param handle 处理Response的函数
115
+ */
116
+ http(api: string, data?: UtilityObject, handle?: (response: IResponseReturn) => void): Promise<TResponseDataReturn>;
117
+ send(api: string, data?: UtilityObject, handle?: (response: IResponseReturn) => void, config?: IHttpSendConfig, returnResponse?: boolean): Promise<IResponseReturn>;
118
+ }
119
+ /**
120
+ * Adapter Interface
121
+ */
122
+ export declare type RequestConfig = {
123
+ method?: RequestMethod;
124
+ url?: string;
125
+ data?: Record<string, any>;
126
+ headers?: HeadersInit | Record<string, string | number>;
127
+ };
128
+ export declare type IHttpAdapter<T> = (config: RequestConfig) => Promise<T>;
129
+ export declare type IAxiosAdapterHttp<T> = (config: RequestConfig) => Promise<T>;
130
+ /**
131
+ * Service Interface
132
+ */
133
+ export interface IHttpService {
134
+ send(apiRoute: string, data: Record<string, any>, config?: IHttpSendConfig, returnResponse?: boolean): Promise<any>;
135
+ }
136
+ export declare type IServiceProvider = typeof ServiceProvider;
137
+ export declare type APP_CONFIG = {
138
+ PROVIDERS?: IServiceProvider[];
139
+ APP_TYPE: 'VUE' | 'REACT' | 'UNI_APP' | 'MP_VUE' | 'WX_APP';
140
+ HTTP_CONFIG: HTTP_CONFIG;
141
+ };
142
+ export declare type HTTP_CONFIG = {
143
+ HTTP_ADAPTER: any;
144
+ HTTP_LIB: UtilityFunction | UtilityClass;
145
+ HTTP_API: any;
146
+ HTTP_HOST: string;
147
+ IS_RESTFUL: boolean;
148
+ CONTENT_TYPE: TContentType;
149
+ DATA_CARRYING: DATA_CARRYING;
150
+ REQUEST_MIDDLEWARE?: HttpMiddleware<any>;
151
+ RESPONSE_MIDDLEWARE?: HttpMiddleware<any>;
152
+ };
153
+ export declare type DATA_CARRYING = {
154
+ REQUEST_DATA?: Record<any, any>;
155
+ REQUEST_HEADERS?: Record<any, any>;
156
+ };
157
+ export declare type HttpMiddleware<T> = (http: T | any) => void;
158
+ 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'>;
159
+ export interface IMiddleware<TContext> {
160
+ handle(context: TContext, next: UtilityFunction): void;
161
+ }
@@ -0,0 +1,6 @@
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;
@@ -0,0 +1,56 @@
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
+ }
@@ -0,0 +1,19 @@
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;
@@ -0,0 +1,4 @@
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("qs")):"function"==typeof define&&define.amd?define(["exports","qs"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Transform={},t.qs)}(this,function(t,e){"use strict";function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c=s(e);class u extends Error{name="Error";message="Error message";code=500;constructor(t,e,s=500){super(e),this.name=t??"Error",this.message=e??"Error message",this.code=s??500}}class g{static typeOf(t,e){return typeof t===e}static getTag(t){return Object.prototype.toString.call(t)}static isFunction(t){return g.typeOf(t,"function")&&"[object Function]"===g.getTag(t)}static isString(t){return g.typeOf(t,"string")||"[object String]"===g.getTag(t)}static isNumber(t){return"number"==typeof t}static isObject(t){return"[object Object]"===g.getTag(t)}static isUndefined(t){return void 0===t||"[object Undefined]"===g.getTag(t)}static isNull(t){return null===t||"[object Null]"===g.getTag(t)}static isEmpty(t){return!t&&0!==t||!(!g.isObject(t)&&!Array.isArray(t))&&("{}"===JSON.stringify(t)||"[]"===JSON.stringify(t))}static isClass(t){if(g.isFunction(t)){const e=t.toString();if(void 0!==t.prototype&&t.prototype.constructor===t){if("class "===e.slice(0,6))return!0;if(2<=Object.getOwnPropertyNames(t.prototype).length)return!0;/^function\s+\(|^function\s+anonymous\(/.test(e)}}return!1}static strTrim(t,e,s){return e?"L"===s?t.replace(new RegExp("^\\"+e+"+","g"),""):"R"===s?t.replace(new RegExp("\\"+e+"+$","g"),""):t.replace(new RegExp("^\\"+e+"+|\\"+e+"+$","g"),""):t.replace(/^\s+|\s+$/g,"")}}class r{static instance;instances=new Map;bindings={};aliases={};bind(t,e){if(!t)throw new u("Abstract Error","Abstract not null");if(Array.isArray(t))t.map(t=>{this.bind(t,e)});else{if(!g.isString(t))throw new u("Abstract Error","The abstract name is a string");g.isObject(e)||g.isClass(e)?this.bindings[t]=e:g.isFunction(e)&&!g.isClass(e)&&this.instances.set(t,e)}}make(t,e,s=!1){var r;if(t=this.getAlias(t),this.has(t))return r=this.instances.get(t)||this.bindings[t],g.isClass(r)?this.makeClass(t,r,e,s):g.isFunction(r)?this.makeFunc(t,r,e,s):r;throw new u("Container Error","The abstract does not exist")}makeClass(t,e,s,r=!1){var i=()=>new e(s);return r?(this.bind(t,i),this.instances.get(t)):i}makeFunc(t,e,s,r=!1){e=e(s);return r?(this.bind(t,e),this.instances.get(t)):e}has(t){return this.existence(t)}existence(t){return!this.bindings[t]||!this.instances.get(t)||!this.getAlias(t)}getAlias(t){return this.aliases[t]||t}get(t){if(this.has(t))return this.make(t);throw new u("Container Error","The abstract does not exist")}singleton(t,e){this.bind(t,e)}static getInstance(){let t=this.instance;return t=t&&t instanceof r?t:this.instance=new r}proxyInstance(){return new Proxy(this,{get:(t,e)=>t[e]})}}const i=Object.prototype.toString;function h(t){return"[object Object]"===i.call(t)}function d(t){return"function"==typeof t}function n(t){if("function"==typeof t){const e=t.toString();if(void 0!==t.prototype&&t.prototype.constructor===t){if("class "===e.slice(0,6))return!0;if(2<=Object.getOwnPropertyNames(t.prototype).length)return!0;/^function\s+\(|^function\s+anonymous\(/.test(e)}}return!1}function a(t){return h(t)&&0===Object.keys(t).length}function o(t){return!t&&0!==t||a(t)}e=Object.freeze({__proto__:null,isArray:function(t){return"[object Array]"===i.call(t)},isNull:function(t){return"[object Null]"===i.call(t)},isBoolean:function(t){return"[object Boolean]"===i.call(t)},isObject:h,isPromise:t=>"[object Promise]"===i.call(t),isString:function(t){return"[object String]"===i.call(t)},isNumber:function(t){return"[object Number]"===i.call(t)&&t==t},isRegExp:function(t){return"[object RegExp]"===i.call(t)},isDate:function(t){return"[object Date]"===i.call(t)},isColor:function(t){return/^#[a-fA-F0-9]{3}$|#[a-fA-F0-9]{6}$/.test(t)||/^rgb\((\s*\d+\s*,?){3}\)$/.test(t)||/^rgba\((\s*\d+\s*,\s*){3}\s*\d(\.\d+)?\s*\)$/.test(t)},isUndefined:function(t){return void 0===t},isFunction:d,isClass:n,isEmptyObject:a,isEmpty:o,isExist:function(t){return t||0===t},isWindow:function(t){return t===window},isPhone:function(t){return/^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$/.test(t)},isEmail:function(t){return/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(t)}});class l extends r{static VERSION="localhost";adapters=new WeakMap;providers=[];static lifecycle(){const t=(new Date).getTime();return{created:()=>{l.registerProviders(l.getProviders()),l.registerProviders(l.getConfig("APP_CONFIG").PROVIDERS)},mounted:()=>{},unmounted:()=>{console.log(`
2
+ %c pdd %c ${l.VERSION} ${(new Date).getTime()-t}ms
3
+ `,"color: #fadfa3; background: #030307; padding:5px 0;border-radius:3px 0 0 3px;","color:#000000;background: #ebd29a; padding:5px 0;border-radius:0 3px 3px 0;")}}}getterProviders(){var t=this.providers;return Array.isArray(t)&&0<t.length?t:[]}static getProviders(){return l.getInstance().getterProviders()}setterProviders(t){const e=this.providers;Array.isArray(e)&&(this.providers=e.filter(e=>{return!t.find(t=>e===t)}),this.providers=this.getterProviders().concat(t))}static setProviders(t){l.getInstance().setterProviders(t)}static registerProvider(t){if(!n(t))throw new u("Provider Error","The first argument must be a class");new t(l.getInstance()).register()}static registerProviders(t){Array.isArray(t)&&t.map(t=>{l.registerProvider(t)})}static setConfig(t,e){l.getInstance().singleton(t,e)}static getConfig(t,e){if(l.getInstance().has(t))return l.getInstance().get(t);if(o(e))throw new u("Application Config Error","Configuration information does not exist");return e}static setAppConfig(t){l.setConfig("APP_CONFIG",t)}static getAppConfig(t){return l.getConfig("APP_CONFIG",{})[t]}static bindAdapter(t,e){if(!n(t))throw new u("Adapter Error","The first argument must be a class");e=o(e)?new t:new t(e);l.getInstance().setterAdapter(t,e)}setterAdapter(t,e){if(!n(t))throw new u("Adapter Error","The first argument must be a class");l.getAdapter(t)&&console.warn("Adapter Warn",`The adapter ${t.name||""} is already bound`),this.adapters.set(t,e)}static getAdapter(t){if(n(t))return l.getInstance().getterAdapter(t);throw new u("Adapter Error","The argument must be a class")}getterAdapter(t){return this.adapters.get(t)}static getService(t){return l.getInstance().get(t)}static getInstance(){let t=l.instance;return t=t&&t instanceof l?t:l.instance=new l}static run(t){const e=l.lifecycle();e.created(),e.mounted(),e.unmounted(),d(t)&&t()}}class p{app;constructor(t){this.app=t,this.register()}register(){console.log("Service is already registered")}}class f{type="localStorage";storage="localStorage"===this.type?localStorage:sessionStorage;constructor({type:t}){this.setConfig({type:t})}get(t){if(!t)return this.getAll();if(g.isString(t))return this.storage.getItem(t);throw new u("","The first parameter is a string")}set(t,e){if("length"===t)throw new u("WebStorage Error","The key of data must not be length");this.storage.setItem(t,JSON.stringify(e))}save(t,e){this.set(t,e)}delete(t){t?Array.isArray(t)?t.map(t=>{this.delete(t)}):this.storage.removeItem(t):this.clear()}remove(t){this.delete(t)}clear(){this.storage.clear()}keys(){var t=this.getAll();return Object.keys(t)}getAll(){const{length:t,...e}=this.storage;return e}setConfig({type:t}){this.type=t}}class m{app;constructor(t){this.app=t}}class E extends m{env(){return{}}webStorage(t,e,s){const r=new f({type:t});if(e&&!g.isString(e))throw new u("WebStorage Error","The first argument must be a string");return void 0!==e||g.isString(e)?void 0===s?r.get(e):void r.save(e,s):r.getAll()}storage(t,e){return this.webStorage("localStorage",t,e)}cookie(){}session(t,e){return this.webStorage("sessionStorage",t,e)}async http(t,e,s){try{return await this.send(t,e,s,{},!1)}catch(t){new u("HttpError","")}}async send(t,e,s,r,i=!0){if(!this.app.has("$request"))throw new u("RequestService Error","");let n=await l.getService("$request").send(t,e,r);return g.isFunction(s)&&(n=s(n)),i?n:n.data}checkAuth(){}cookies(t,e){}}class T{isRESTful=!0;uri;requestData;constructor(t,e,s){this.isRESTful=s??this.isRESTful,this.uri=t,this.requestData=e}create(){return this.isRESTful?this.transformer():{uri:this.uri,data:this.requestData}}transformer(){let t=Object.keys(this.requestData),r={},i={},e=(t.map(t=>{var e=t.match(/^__/g),s=t.replace(/^__/g,"");e?r[s]=this.requestData[t]:i[s]=this.requestData[t]}),this.uri.match(/<(.*?)>/g)),s={};if(e&&Array.isArray(e)){let t=e.map(t=>{let e=t.replace(/(^<)|(>$)/g,"");t=e.split("=");return 2===t.length?(s[t[0]]=t[1],t[0]):(s[e]=null,e)});return Object.assign(s,r),this.uri=this.uri.replace(/=(.*?)>/g,">"),t.map(t=>{this.uri=this.uri.replace(`<${t}>`,s[t])}),{uri:this.uri,data:i}}return{uri:this.uri,data:this.requestData}}}class A extends m{_http=null;_api={};_headers={};_host="";_isRESTful=!0;_RESTful;_carryingData={};_mode="REQUEST_PAYLOAD";$helper=null;_requestMiddleware;_responseMiddleware;constructor(t,{HTTP_ADAPTER:e,HTTP_API:s,HTTP_HOST:r,IS_RESTFUL:i,CONTENT_TYPE:n,DATA_CARRYING:a,REQUEST_MIDDLEWARE:o,RESPONSE_MIDDLEWARE:c}){super(t),this._http=e??this._http,this._api=s??this._api,this._host=r??this._host,this._isRESTful=i??!0,this._RESTful=T??null,this.setContentType(n),this.setDataCarry(a.REQUEST_HEADERS,a.REQUEST_DATA),this._requestMiddleware=d(o)?o:t=>t,this._responseMiddleware=d(c)?c:t=>t}setContentType(t){"REQUEST_PAYLOAD"===t?(this._mode=t,this.setHeader("Content-Type","application/json")):"FORM_DATA"===t&&(this._mode=t,this.setHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8"))}setDataCarry(e,s){if(e){const t=Object.keys(e);Array.isArray(t)&&t.map(t=>{this.carryingHandle(t,e[t],"REQUEST_HEADERS")})}if(s){const r=Object.keys(s);Array.isArray(r)&&r.map(t=>{this.carryingHandle(t,s[t],"REQUEST_DATA")})}}carryingHandle(e,s,r="REQUEST_HEADERS"){if(e&&s)if(d(s))try{"REQUEST_HEADERS"===r?this.setHeader(e,s()):"REQUEST_DATA"===r&&this.setData(e,s())}catch(t){console.warn("Application Error",t)}else{let t=null;"LOCAL"===s?t=l.getService("$helper").storage(e):"SESSION"===s?t=l.getService("$helper").session(e):"COOKIES"===s?t=l.getService("$helper").cookies(e):"STORAGE"===s&&(t=l.getService("$helper").storage(e)),"REQUEST_HEADERS"===r?this.setHeader(e,t):"REQUEST_DATA"===r&&this.setData(e,t)}}async http(t,e,s=!1){try{var r={...this.getParameters(t,e),headers:this._headers},r=this._requestMiddleware(r);this._http.setConfig(r)}catch(t){console.warn("Request config warn",t)}try{return await this.request(s)}catch(t){console.warn("Request interceptor warn",t)}}async request(t){try{var e=await this._http.request();try{var s=this._responseMiddleware(e);return t?s:s.data}catch(t){console.warn("Response middleware Error",t)}return t?e:e.data}catch(t){if(t&&t.response)switch(t.response.status){case 400:t.message="请求参数错误";break;case 401:t.message="未授权,请登录";break;case 403:t.message="跨域拒绝访问";break;case 404:t.message="请求地址出错: "+t.response.config.url;break;case 408:t.message="请求超时";break;case 500:t.message="服务器内部错误";break;case 501:t.message="服务未实现";break;case 502:t.message="网关错误";break;case 503:t.message="服务不可用";break;case 504:t.message="网关超时";break;case 505:t.message="HTTP版本不受支持"}throw this._responseMiddleware({...t.response,message:t.message}),t}}async send(t,e,s={}){return s.host&&(this._host=s.host),s.headers&&this.setHeaders(s.headers),s.mode&&this.setContentType(s.mode),this.http(t,e,!0)}getParameters(t,e){let s=this._api[t];if(!s&&!t)throw new u("The api route does not exist","ApiRouteError");let r="",i="POST",n=!0;switch((s=!s&&t?[t]:s).length){case 1:r=s[0];break;case 2:r=s[0],i=s[1];break;case 3:r=s[0],i=s[1],n=s[2];break;default:throw new u("ApiRoute Error","The api route does not exist")}i=i.toUpperCase();t={...this._carryingData,...e};const a=this.transformRESTful(r,t);let o=g.strTrim(this._host,"/")+"/"+g.strTrim(a.uri,"/");return"FORM_DATA"===this._mode&&(a.data=c.default.stringify(a.data)),"GET"===i&&(h(a.data)&&"REQUEST_PAYLOAD"===this._mode?o=o+"?"+c.default.stringify(a.data):a.data&&"FORM_DATA"===this._mode&&(o=o+"?"+a.data)),{url:o,method:i,data:a.data,auth:n,params:{host:this._host.trim(),method:i,uri:a.uri.trim(),data:a.data,auth:n}}}transformRESTful(t,e={}){return new this._RESTful(t,e,this._isRESTful).create()}setHeaders(t={}){this._headers=t}setHeader(t,e){this._headers[t]=e}setData(t,e){this._carryingData[t]=e}}class _{_events=new Map;static _instance;static getInstance(){return _._instance&&_._instance instanceof _||(_._instance=new _),_._instance}static getEvents(){return _.getInstance()._events}static getEventsSize(){return _.getInstance()._events.size}static getEvent(t){return _.getInstance()._events.get(t)}static hasEvent(t){return _.getInstance()._events.has(t)}static deleteEvent(t){return _.getInstance()._events.delete(t),_.hasEvent(t)}static setEvent(t,e){return _.hasEvent(t),_.getInstance()._events.set(t,e)}static on(t,e){return d(e)||console.warn("The second argument to the on method must be a function"),_.setEvent(t,e)}static emit(t,...e){if(d(_.getEvent(t)))return _.getEvent(t)(...e);console.error(`You need to bind the ${t} event and method before emit`)}static once(t,...e){_.emit(t,...e),_.off(t)}static off(t){if(Array.isArray(t)){const e=t.map(t=>_.off(t));return e.indexOf(!1)<0}return!!_.hasEvent(t)&&_.getInstance()._events.delete(t)}}l.setProviders([class extends p{register(){this.app.singleton("$command",()=>{console.log("COMMAND_REGISTERED")})}},class extends p{register(){this.app.singleton("$helper",()=>new E(this.app))}},class extends p{register(){var t=l.getAppConfig("HTTP_CONFIG").HTTP_ADAPTER,e=l.getAppConfig("HTTP_CONFIG").HTTP_LIB;const s=l.getAppConfig("HTTP_CONFIG").HTTP_API,r=l.getAppConfig("HTTP_CONFIG").HTTP_HOST,i=l.getAppConfig("HTTP_CONFIG").IS_RESTFUL,n=l.getAppConfig("HTTP_CONFIG").CONTENT_TYPE,a=l.getAppConfig("HTTP_CONFIG").DATA_CARRYING;if(!t||!e)throw new u("ADAPTER Error","Bind http adapter error");l.bindAdapter(t,e);const o=l.getAdapter(t),c=l.getAppConfig("HTTP_CONFIG").REQUEST_MIDDLEWARE,h=l.getAppConfig("HTTP_CONFIG").RESPONSE_MIDDLEWARE;this.app.singleton("$request",()=>new A(this.app,{HTTP_ADAPTER:o,HTTP_API:s,HTTP_HOST:r,IS_RESTFUL:i,CONTENT_TYPE:n,DATA_CARRYING:a,REQUEST_MIDDLEWARE:c,RESPONSE_MIDDLEWARE:h}))}}]),t.AxiosAdapter=class extends class{http;method="POST";url="";data={};headers={};constructor(t){if("function"!=typeof t)throw new u("HTTP Adapter Error","The first argument must be a function");this.http=t}setConfig({method:t,url:e,data:s,headers:r}){this.method=t??this.method,this.url=e??this.url,this.data=s??this.data,this.headers=r??this.headers}request(){return new Promise((e,s)=>{this.http({method:this.method,url:this.url,data:this.data,headers:this.headers}).then(t=>{e(t)}).catch(t=>{s(t)})})}}{request(){return new Promise((e,s)=>{this.http({method:this.method,url:this.url,data:this.data,headers:this.headers}).then(t=>{e(t)}).catch(t=>{s(t)})})}},t.Command=class{payload;$helper;constructor(...t){this.payload=[...t],this.$helper=l.getService("$helper")}},t.Container=r,t.EventBus=_,t.Exception=u,t.Is=e,t.Lib=g,t.ServiceProvider=p,t.Transformer=class{data;payload;constructor(t,e){this.data=t,this.payload=e}transform(t,e){return t}create(s){return Array.isArray(this.data)?this.data.map((t,e)=>g.isFunction(s)?s(t,e):this.transform(t)):g.isFunction(s)?s(this.data,0):this.transform(this.data)}formatNumber(t,e=-1,s="",r="."){"number"!=typeof t&&(t=g.typeOf(t,"string")?parseFloat(t):0);var i=(t=isNaN(t)?0:t).toString().split("."),i=(e=parseInt(e),e=isNaN(Math.abs(e))||-1===e?-1:Math.abs(e),i[1]&&-1===e?e=i[1].length:i[1]||-1!==e||(e=0),s="string"==typeof s?s:",",r=r||".",t<0?"-":"");let n,a;return n=parseInt(t=Math.abs(+t||0).toFixed(e),10).toString(),i+((a=3<(a=n.length)?a%3:0)?n.substr(0,a)+s:"")+n.substr(a).replace(/(\d{3})(?=\d)/g,"$1"+s)+(e?r+Math.abs(Number(t)-Number(n)).toFixed(e).slice(2):"")}formatDate(t=Date.now()){if(g.typeOf(t,"string"))return isNaN(Date.parse(t))?this.formatDate():this.formatDate(Date.parse(t));const e=new Date(t),s=e.getFullYear(),r=e.getMonth()+1<10?"0"+(e.getMonth()+1):e.getMonth()+1,i=e.getDate()<10?"0"+e.getDate():e.getDate(),n=e.getHours()<10?"0"+e.getHours():e.getHours(),a=e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes(),o=e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds();var t=e.getDay(),c=0<=e.getHours()&&n<12?"AM":"PM",h=0<=e.getHours()&&n<12?"上午":"下午";return{Y:s.toString(),M:r.toString(),D:i.toString(),h:n.toString(),m:a.toString(),s:o.toString(),week:["日","一","二","三","四","五","六"][t],ap:c,apCn:h}}},t.default=l,t.defineAppConfig=function(t){return t},t.defineAppHttpConfig=function(t){return t},t.defineHttpApis=function(t){return t},t.defineHttpConfig=function(t){return t},Object.defineProperty(t,"__esModule",{value:!0})});
4
+ //# sourceMappingURL=ege.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ege.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,13 @@
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, };
@@ -0,0 +1,4 @@
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("qs")):"function"==typeof define&&define.amd?define(["exports","qs"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Transform={},t.qs)}(this,function(t,e){"use strict";function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c=s(e);class u extends Error{name="Error";message="Error message";code=500;constructor(t,e,s=500){super(e),this.name=t??"Error",this.message=e??"Error message",this.code=s??500}}class g{static typeOf(t,e){return typeof t===e}static getTag(t){return Object.prototype.toString.call(t)}static isFunction(t){return g.typeOf(t,"function")&&"[object Function]"===g.getTag(t)}static isString(t){return g.typeOf(t,"string")||"[object String]"===g.getTag(t)}static isNumber(t){return"number"==typeof t}static isObject(t){return"[object Object]"===g.getTag(t)}static isUndefined(t){return void 0===t||"[object Undefined]"===g.getTag(t)}static isNull(t){return null===t||"[object Null]"===g.getTag(t)}static isEmpty(t){return!t&&0!==t||!(!g.isObject(t)&&!Array.isArray(t))&&("{}"===JSON.stringify(t)||"[]"===JSON.stringify(t))}static isClass(t){if(g.isFunction(t)){const e=t.toString();if(void 0!==t.prototype&&t.prototype.constructor===t){if("class "===e.slice(0,6))return!0;if(2<=Object.getOwnPropertyNames(t.prototype).length)return!0;/^function\s+\(|^function\s+anonymous\(/.test(e)}}return!1}static strTrim(t,e,s){return e?"L"===s?t.replace(new RegExp("^\\"+e+"+","g"),""):"R"===s?t.replace(new RegExp("\\"+e+"+$","g"),""):t.replace(new RegExp("^\\"+e+"+|\\"+e+"+$","g"),""):t.replace(/^\s+|\s+$/g,"")}}class r{static instance;instances=new Map;bindings={};aliases={};bind(t,e){if(!t)throw new u("Abstract Error","Abstract not null");if(Array.isArray(t))t.map(t=>{this.bind(t,e)});else{if(!g.isString(t))throw new u("Abstract Error","The abstract name is a string");g.isObject(e)||g.isClass(e)?this.bindings[t]=e:g.isFunction(e)&&!g.isClass(e)&&this.instances.set(t,e)}}make(t,e,s=!1){var r;if(t=this.getAlias(t),this.has(t))return r=this.instances.get(t)||this.bindings[t],g.isClass(r)?this.makeClass(t,r,e,s):g.isFunction(r)?this.makeFunc(t,r,e,s):r;throw new u("Container Error","The abstract does not exist")}makeClass(t,e,s,r=!1){var i=()=>new e(s);return r?(this.bind(t,i),this.instances.get(t)):i}makeFunc(t,e,s,r=!1){e=e(s);return r?(this.bind(t,e),this.instances.get(t)):e}has(t){return this.existence(t)}existence(t){return!this.bindings[t]||!this.instances.get(t)||!this.getAlias(t)}getAlias(t){return this.aliases[t]||t}get(t){if(this.has(t))return this.make(t);throw new u("Container Error","The abstract does not exist")}singleton(t,e){this.bind(t,e)}static getInstance(){let t=this.instance;return t=t&&t instanceof r?t:this.instance=new r}proxyInstance(){return new Proxy(this,{get:(t,e)=>t[e]})}}const i=Object.prototype.toString;function h(t){return"[object Object]"===i.call(t)}function d(t){return"function"==typeof t}function n(t){if("function"==typeof t){const e=t.toString();if(void 0!==t.prototype&&t.prototype.constructor===t){if("class "===e.slice(0,6))return!0;if(2<=Object.getOwnPropertyNames(t.prototype).length)return!0;/^function\s+\(|^function\s+anonymous\(/.test(e)}}return!1}function a(t){return h(t)&&0===Object.keys(t).length}function o(t){return!t&&0!==t||a(t)}e=Object.freeze({__proto__:null,isArray:function(t){return"[object Array]"===i.call(t)},isNull:function(t){return"[object Null]"===i.call(t)},isBoolean:function(t){return"[object Boolean]"===i.call(t)},isObject:h,isPromise:t=>"[object Promise]"===i.call(t),isString:function(t){return"[object String]"===i.call(t)},isNumber:function(t){return"[object Number]"===i.call(t)&&t==t},isRegExp:function(t){return"[object RegExp]"===i.call(t)},isDate:function(t){return"[object Date]"===i.call(t)},isColor:function(t){return/^#[a-fA-F0-9]{3}$|#[a-fA-F0-9]{6}$/.test(t)||/^rgb\((\s*\d+\s*,?){3}\)$/.test(t)||/^rgba\((\s*\d+\s*,\s*){3}\s*\d(\.\d+)?\s*\)$/.test(t)},isUndefined:function(t){return void 0===t},isFunction:d,isClass:n,isEmptyObject:a,isEmpty:o,isExist:function(t){return t||0===t},isWindow:function(t){return t===window},isPhone:function(t){return/^(13[0-9]|14[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9])[0-9]{8}$/.test(t)},isEmail:function(t){return/^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/.test(t)}});class p extends r{static VERSION="0.3.23";adapters=new WeakMap;providers=[];static lifecycle(){const t=(new Date).getTime();return{created:()=>{p.registerProviders(p.getProviders()),p.registerProviders(p.getConfig("APP_CONFIG").PROVIDERS)},mounted:()=>{},unmounted:()=>{console.log(`
2
+ %c pdd %c ${p.VERSION} ${(new Date).getTime()-t}ms
3
+ `,"color: #fadfa3; background: #030307; padding:5px 0;border-radius:3px 0 0 3px;","color:#000000;background: #ebd29a; padding:5px 0;border-radius:0 3px 3px 0;")}}}getterProviders(){var t=this.providers;return Array.isArray(t)&&0<t.length?t:[]}static getProviders(){return p.getInstance().getterProviders()}setterProviders(t){const e=this.providers;Array.isArray(e)&&(this.providers=e.filter(e=>{return!t.find(t=>e===t)}),this.providers=this.getterProviders().concat(t))}static setProviders(t){p.getInstance().setterProviders(t)}static registerProvider(t){if(!n(t))throw new u("Provider Error","The first argument must be a class");new t(p.getInstance()).register()}static registerProviders(t){Array.isArray(t)&&t.map(t=>{p.registerProvider(t)})}static setConfig(t,e){p.getInstance().singleton(t,e)}static getConfig(t,e){if(p.getInstance().has(t))return p.getInstance().get(t);if(o(e))throw new u("Application Config Error","Configuration information does not exist");return e}static setAppConfig(t){p.setConfig("APP_CONFIG",t)}static getAppConfig(t){return p.getConfig("APP_CONFIG",{})[t]}static bindAdapter(t,e){if(!n(t))throw new u("Adapter Error","The first argument must be a class");e=o(e)?new t:new t(e);p.getInstance().setterAdapter(t,e)}setterAdapter(t,e){if(!n(t))throw new u("Adapter Error","The first argument must be a class");p.getAdapter(t)&&console.warn("Adapter Warn",`The adapter ${t.name||""} is already bound`),this.adapters.set(t,e)}static getAdapter(t){if(n(t))return p.getInstance().getterAdapter(t);throw new u("Adapter Error","The argument must be a class")}getterAdapter(t){return this.adapters.get(t)}static getService(t){return p.getInstance().get(t)}static getInstance(){let t=p.instance;return t=t&&t instanceof p?t:p.instance=new p}static run(t){const e=p.lifecycle();e.created(),e.mounted(),e.unmounted(),d(t)&&t()}}class l{app;constructor(t){this.app=t,this.register()}register(){console.log("Service is already registered")}}class f{type="localStorage";storage="localStorage"===this.type?localStorage:sessionStorage;constructor({type:t}){this.setConfig({type:t})}get(t){if(!t)return this.getAll();if(g.isString(t))return this.storage.getItem(t);throw new u("","The first parameter is a string")}set(t,e){if("length"===t)throw new u("WebStorage Error","The key of data must not be length");this.storage.setItem(t,JSON.stringify(e))}save(t,e){this.set(t,e)}delete(t){t?Array.isArray(t)?t.map(t=>{this.delete(t)}):this.storage.removeItem(t):this.clear()}remove(t){this.delete(t)}clear(){this.storage.clear()}keys(){var t=this.getAll();return Object.keys(t)}getAll(){const{length:t,...e}=this.storage;return e}setConfig({type:t}){this.type=t}}class m{app;constructor(t){this.app=t}}class T extends m{env(){return{}}webStorage(t,e,s){const r=new f({type:t});if(e&&!g.isString(e))throw new u("WebStorage Error","The first argument must be a string");return void 0!==e||g.isString(e)?void 0===s?r.get(e):void r.save(e,s):r.getAll()}storage(t,e){return this.webStorage("localStorage",t,e)}cookie(){}session(t,e){return this.webStorage("sessionStorage",t,e)}async http(t,e,s={}){try{return await p.getService("$request").http(t,e,s)}catch(t){new u("HttpError","")}}async send(t,e,s,r,i=!0){if(!this.app.has("$request"))throw new u("RequestService Error","");let n=await p.getService("$request").send(t,e,r,i);return g.isFunction(s)&&(n=s(n)),i?n:n.data}checkAuth(){}cookies(t,e){}request(t,e,s){}}class E{isRESTful=!0;api;requestData;constructor(t,e,s){this.isRESTful=s??this.isRESTful,this.api=t,this.requestData=e}create(){return this.isRESTful?this.transformer():{api:this.api,data:this.requestData}}transformer(){let t=Object.keys(this.requestData),r={},i={},e=(t.map(t=>{var e=t.match(/^__/g),s=t.replace(/^__/g,"");e?r[s]=this.requestData[t]:i[s]=this.requestData[t]}),this.api.match(/<(.*?)>/g)),s={};if(e&&Array.isArray(e)){let t=e.map(t=>{let e=t.replace(/(^<)|(>$)/g,"");t=e.split("=");return 2===t.length?(s[t[0]]=t[1],t[0]):(s[e]=null,e)});return Object.assign(s,r),this.api=this.api.replace(/=(.*?)>/g,">"),t.map(t=>{this.api=this.api.replace(`<${t}>`,s[t])}),{api:this.api,data:i}}return{api:this.api,data:this.requestData}}}class A extends m{_http=null;_api={};_headers={};_host="";_isRESTful=!0;_carryingData={};_mode="REQUEST_PAYLOAD";$helper=null;_requestMiddleware;_responseMiddleware;_context={request:{hairstyle:null,body:null},response:null};constructor(t,{HTTP_ADAPTER:e,HTTP_API:s,HTTP_HOST:r,IS_RESTFUL:i,CONTENT_TYPE:n,DATA_CARRYING:a,REQUEST_MIDDLEWARE:o,RESPONSE_MIDDLEWARE:c}){super(t),this._http=e??this._http,this._api=s??this._api,this._host=r??this._host,this._isRESTful=i??!0,this.setContentType(n),this.setDataCarry(a.REQUEST_HEADERS,a.REQUEST_DATA),this._requestMiddleware=d(o)?o:t=>t,this._responseMiddleware=d(c)?c:t=>t}setContentType(t){"REQUEST_PAYLOAD"===t?(this._mode=t,this.setHeader("Content-Type","application/json")):"FORM_DATA"===t&&(this._mode=t,this.setHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8"))}setDataCarry(e,s){if(e){const t=Object.keys(e);Array.isArray(t)&&t.map(t=>{this.carryingHandle(t,e[t],"REQUEST_HEADERS")})}if(s){const r=Object.keys(s);Array.isArray(r)&&r.map(t=>{this.carryingHandle(t,s[t],"REQUEST_DATA")})}}carryingHandle(e,s,r="REQUEST_HEADERS"){if(e&&s)if(d(s))try{"REQUEST_HEADERS"===r?this.setHeader(e,s()):"REQUEST_DATA"===r&&this.setData(e,s())}catch(t){console.warn("Application Error",t)}else{let t=null;"LOCAL"===s?t=p.getService("$helper").storage(e):"SESSION"===s?t=p.getService("$helper").session(e):"COOKIES"===s?t=p.getService("$helper").cookies(e):"STORAGE"===s&&(t=p.getService("$helper").storage(e)),"REQUEST_HEADERS"===r?this.setHeader(e,t):"REQUEST_DATA"===r&&this.setData(e,t)}}async http(t,e,s){try{var r=this.getParameters(t,e);this.setContentType(r.type),this._context.request={...this._context.request,headers:this._headers,...r},this._context.request.headers={...this._context.request.headers,...s},this._context=this._requestMiddleware(this._context),this._context.request.headers={...this._context.request.headers,...s},this._http.setConfig(this._context.request)}catch(t){console.warn("Request config warn",t)}try{return await this.request(this._context.request.hairstyle[3])}catch(t){console.warn("Request interceptor warn",t)}}async request(t){try{var e=await this._http.request();try{this._context.response=e;var s=await this._responseMiddleware(this._context);return t?s.response:s.response.data}catch(t){console.warn("Response middleware Error",t)}}catch(t){if(t&&t.response)switch(t.response.status){case 400:t.message="请求参数错误";break;case 401:t.message="未授权,请登录";break;case 403:t.message="跨域拒绝访问";break;case 404:t.message="请求地址出错: "+t.response.config.url;break;case 408:t.message="请求超时";break;case 500:t.message="服务器内部错误";break;case 501:t.message="服务未实现";break;case 502:t.message="网关错误";break;case 503:t.message="服务不可用";break;case 504:t.message="网关超时";break;case 505:t.message="HTTP版本不受支持"}throw this._context.response={...t.response,message:t.message},this._responseMiddleware(this._context),t}}async send(t,e,s={},r=!1){s.host&&(this._host=s.host),s.headers&&this.setHeaders(s.headers),s.mode&&this.setContentType(s.mode);const i=this.makeHairstyle(t);return r&&(i[3]=r),this.http(i,e,{})}makeHairstyle(t){let e;if(!(e="string"==typeof t?this._api[t]:t)&&!t)throw new u("The api route does not exist","ApiRouteError");t=e[0];let s=["POST","REQUEST_PAYLOAD"];var r=e[2]||!0,i=e[3]||!1;return(s="string"==typeof e[1]?[e[1]||"POST",this._mode]:Array.isArray(e[1])?[e[1][0]||"POST",e[1][1]||this._mode]:["POST",this._mode])[0]=s[0].toUpperCase(),[t,s,r,i]}getParameters(t,e){var[t,s,r,i]=this.makeHairstyle(t),n={...this._carryingData,...e};const a=new E(t,n,this._isRESTful).create();let o=g.strTrim(this._host,"/")+"/"+g.strTrim(a.api,"/");return"FORM_DATA"===s?.[1]&&(a.data=c.default.stringify(a.data)),"GET"===s?.[0]&&(this.deleteHeader("Content-Type"),h(a.data)&&"REQUEST_PAYLOAD"===this._mode?o=o+"?"+c.default.stringify(a.data):a.data&&"FORM_DATA"===this._mode&&(o=o+"?"+a.data)),{api:a.api.trim(),url:o,method:s?.[0],type:s?.[1],data:a.data,auth:r,hairstyle:[t,s,r,i],body:e,payload:a.data}}setHeaders(t={}){this._headers={...this._headers,...t}}getHeaders(){return this._headers}setHeader(t,e){this._headers[t]=e}deleteHeader(t){delete this._headers[t]}setData(t,e){this._carryingData[t]=e}}class _{_events=new Map;static _instance;static getInstance(){return _._instance&&_._instance instanceof _||(_._instance=new _),_._instance}static getEvents(){return _.getInstance()._events}static getEventsSize(){return _.getInstance()._events.size}static getEvent(t){return _.getInstance()._events.get(t)}static hasEvent(t){return _.getInstance()._events.has(t)}static deleteEvent(t){return _.getInstance()._events.delete(t),_.hasEvent(t)}static setEvent(t,e){return _.hasEvent(t),_.getInstance()._events.set(t,e)}static on(t,e){return d(e)||console.warn("The second argument to the on method must be a function"),_.setEvent(t,e)}static emit(t,...e){if(d(_.getEvent(t)))return _.getEvent(t)(...e);console.error(`You need to bind the ${t} event and method before emit`)}static once(t,...e){_.emit(t,...e),_.off(t)}static off(t){if(Array.isArray(t)){const e=t.map(t=>_.off(t));return e.indexOf(!1)<0}return!!_.hasEvent(t)&&_.getInstance()._events.delete(t)}}p.setProviders([class extends l{register(){this.app.singleton("$command",()=>{console.log("COMMAND_REGISTERED")})}},class extends l{register(){this.app.singleton("$helper",()=>new T(this.app))}},class extends l{register(){var t=p.getAppConfig("HTTP_CONFIG").HTTP_ADAPTER,e=p.getAppConfig("HTTP_CONFIG").HTTP_LIB;const s=p.getAppConfig("HTTP_CONFIG").HTTP_API,r=p.getAppConfig("HTTP_CONFIG").HTTP_HOST,i=p.getAppConfig("HTTP_CONFIG").IS_RESTFUL,n=p.getAppConfig("HTTP_CONFIG").CONTENT_TYPE,a=p.getAppConfig("HTTP_CONFIG").DATA_CARRYING;if(!t||!e)throw new u("ADAPTER Error","Bind http adapter error");p.bindAdapter(t,e);const o=p.getAdapter(t),c=p.getAppConfig("HTTP_CONFIG").REQUEST_MIDDLEWARE,h=p.getAppConfig("HTTP_CONFIG").RESPONSE_MIDDLEWARE;this.app.singleton("$request",()=>new A(this.app,{HTTP_ADAPTER:o,HTTP_API:s,HTTP_HOST:r,IS_RESTFUL:i,CONTENT_TYPE:n,DATA_CARRYING:a,REQUEST_MIDDLEWARE:c,RESPONSE_MIDDLEWARE:h}))}}]),t.AxiosAdapter=class extends class{http;method="POST";url="";data={};headers={};constructor(t){if("function"!=typeof t)throw new u("HTTP Adapter Error","The first argument must be a function");this.http=t}setConfig({method:t,url:e,data:s,headers:r}){this.method=t??this.method,this.url=e??this.url,this.data=s??this.data,this.headers=r??this.headers}request(){return new Promise((e,s)=>{this.http({method:this.method,url:this.url,data:this.data,headers:this.headers}).then(t=>{e(t)}).catch(t=>{s(t)})})}}{request(){return new Promise((e,s)=>{this.http({method:this.method,url:this.url,data:this.data,headers:this.headers}).then(t=>{e(t)}).catch(t=>{s(t)})})}},t.Command=class{payload;$helper;constructor(...t){this.payload=[...t],this.$helper=p.getService("$helper")}},t.Container=r,t.EventBus=_,t.Exception=u,t.Is=e,t.Lib=g,t.ServiceProvider=l,t.Transformer=class{data;payload;constructor(t,e){this.data=t,this.payload=e}transform(t,e){return t}create(s){return Array.isArray(this.data)?this.data.map((t,e)=>g.isFunction(s)?s(t,e):this.transform(t)):g.isFunction(s)?s(this.data,0):this.transform(this.data)}formatNumber(t,e=-1,s="",r="."){"number"!=typeof t&&(t=g.typeOf(t,"string")?parseFloat(t):0);var i=(t=isNaN(t)?0:t).toString().split("."),i=(e=parseInt(e),e=isNaN(Math.abs(e))||-1===e?-1:Math.abs(e),i[1]&&-1===e?e=i[1].length:i[1]||-1!==e||(e=0),s="string"==typeof s?s:",",r=r||".",t<0?"-":"");let n,a;return n=parseInt(t=Math.abs(+t||0).toFixed(e),10).toString(),i+((a=3<(a=n.length)?a%3:0)?n.substr(0,a)+s:"")+n.substr(a).replace(/(\d{3})(?=\d)/g,"$1"+s)+(e?r+Math.abs(Number(t)-Number(n)).toFixed(e).slice(2):"")}formatDate(t=Date.now()){if(g.typeOf(t,"string"))return isNaN(Date.parse(t))?this.formatDate():this.formatDate(Date.parse(t));const e=new Date(t),s=e.getFullYear(),r=e.getMonth()+1<10?"0"+(e.getMonth()+1):e.getMonth()+1,i=e.getDate()<10?"0"+e.getDate():e.getDate(),n=e.getHours()<10?"0"+e.getHours():e.getHours(),a=e.getMinutes()<10?"0"+e.getMinutes():e.getMinutes(),o=e.getSeconds()<10?"0"+e.getSeconds():e.getSeconds();var t=e.getDay(),c=0<=e.getHours()&&n<12?"AM":"PM",h=0<=e.getHours()&&n<12?"上午":"下午";return{Y:s.toString(),M:r.toString(),D:i.toString(),h:n.toString(),m:a.toString(),s:o.toString(),week:["日","一","二","三","四","五","六"][t],ap:c,apCn:h}}},t.default=p,t.defineAppConfig=function(t){return t},t.defineAppHttpConfig=function(t){return t},t.defineHttpApis=function(t){return t},t.defineHttpConfig=function(t){return t},t.defineHttpRequestConfig=function(t){return t},Object.defineProperty(t,"__esModule",{value:!0})});
4
+ //# sourceMappingURL=pdd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pdd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -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