@pisell/core 0.0.2

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 (296) hide show
  1. package/README.md +1 -0
  2. package/es/app/app.d.ts +101 -0
  3. package/es/app/app.js +177 -0
  4. package/es/app/const.d.ts +4 -0
  5. package/es/app/const.js +6 -0
  6. package/es/app/index.d.ts +14 -0
  7. package/es/app/index.js +52 -0
  8. package/es/applicationManager/application.d.ts +197 -0
  9. package/es/applicationManager/application.js +469 -0
  10. package/es/applicationManager/index.d.ts +19 -0
  11. package/es/applicationManager/index.js +206 -0
  12. package/es/aws/index.d.ts +16 -0
  13. package/es/aws/index.js +76 -0
  14. package/es/cmd/const.d.ts +11 -0
  15. package/es/cmd/const.js +13 -0
  16. package/es/cmd/index.d.ts +13 -0
  17. package/es/cmd/index.js +91 -0
  18. package/es/cmd/type.d.ts +5 -0
  19. package/es/cmd/type.js +1 -0
  20. package/es/communicationManager/index.d.ts +59 -0
  21. package/es/communicationManager/index.js +174 -0
  22. package/es/config.d.ts +3 -0
  23. package/es/config.js +14 -0
  24. package/es/cookie/index.d.ts +13 -0
  25. package/es/cookie/index.js +47 -0
  26. package/es/css/global.less +73 -0
  27. package/es/css/index.less +31 -0
  28. package/es/css/variables.css +84 -0
  29. package/es/data/index.d.ts +8 -0
  30. package/es/data/index.js +16 -0
  31. package/es/history/config.d.ts +24 -0
  32. package/es/history/config.js +43 -0
  33. package/es/history/index.d.ts +26 -0
  34. package/es/history/index.js +80 -0
  35. package/es/history/type.d.ts +2 -0
  36. package/es/history/type.js +1 -0
  37. package/es/hooks/index.d.ts +12 -0
  38. package/es/hooks/index.js +13 -0
  39. package/es/hooks/useDelayedValue/index.d.ts +2 -0
  40. package/es/hooks/useDelayedValue/index.js +26 -0
  41. package/es/hooks/useDispatch/index.d.ts +2 -0
  42. package/es/hooks/useDispatch/index.js +2 -0
  43. package/es/hooks/useLowCode/index.d.ts +13 -0
  44. package/es/hooks/useLowCode/index.js +74 -0
  45. package/es/hooks/useStore/index.d.ts +6 -0
  46. package/es/hooks/useStore/index.js +11 -0
  47. package/es/index.d.ts +8 -0
  48. package/es/index.js +10 -0
  49. package/es/indexDB/index.d.ts +296 -0
  50. package/es/indexDB/index.js +1619 -0
  51. package/es/locales/en.d.ts +3 -0
  52. package/es/locales/en.js +5 -0
  53. package/es/locales/index.d.ts +39 -0
  54. package/es/locales/index.js +199 -0
  55. package/es/locales/original.d.ts +3 -0
  56. package/es/locales/original.js +7 -0
  57. package/es/locales/type.d.ts +19 -0
  58. package/es/locales/type.js +1 -0
  59. package/es/locales/zh-CN.d.ts +3 -0
  60. package/es/locales/zh-CN.js +5 -0
  61. package/es/locales/zh-HK.d.ts +3 -0
  62. package/es/locales/zh-HK.js +5 -0
  63. package/es/logger/feishu.d.ts +11 -0
  64. package/es/logger/feishu.js +50 -0
  65. package/es/logger/index.d.ts +135 -0
  66. package/es/logger/index.js +870 -0
  67. package/es/menuManager/hooks.d.ts +17 -0
  68. package/es/menuManager/hooks.js +136 -0
  69. package/es/menuManager/index.d.ts +28 -0
  70. package/es/menuManager/index.js +165 -0
  71. package/es/models/global.d.ts +32 -0
  72. package/es/models/global.js +66 -0
  73. package/es/models/index.d.ts +45 -0
  74. package/es/models/index.js +65 -0
  75. package/es/models/type.d.ts +2 -0
  76. package/es/models/type.js +1 -0
  77. package/es/plugin/index.d.ts +0 -0
  78. package/es/plugin/index.js +0 -0
  79. package/es/pubsub/example.d.ts +5 -0
  80. package/es/pubsub/example.js +92 -0
  81. package/es/pubsub/index.d.ts +73 -0
  82. package/es/pubsub/index.js +166 -0
  83. package/es/render/index.d.ts +0 -0
  84. package/es/render/index.js +0 -0
  85. package/es/request/cache.d.ts +46 -0
  86. package/es/request/cache.js +372 -0
  87. package/es/request/cancelToken.d.ts +38 -0
  88. package/es/request/cancelToken.js +59 -0
  89. package/es/request/config.d.ts +3 -0
  90. package/es/request/config.js +63 -0
  91. package/es/request/constants.d.ts +2 -0
  92. package/es/request/constants.js +6 -0
  93. package/es/request/index.d.ts +24 -0
  94. package/es/request/index.js +267 -0
  95. package/es/request/pisell2Request.d.ts +6 -0
  96. package/es/request/pisell2Request.js +62 -0
  97. package/es/request/type.d.ts +57 -0
  98. package/es/request/type.js +10 -0
  99. package/es/request/utils.d.ts +46 -0
  100. package/es/request/utils.js +147 -0
  101. package/es/routes/config.d.ts +7 -0
  102. package/es/routes/config.js +17 -0
  103. package/es/routes/index.d.ts +28 -0
  104. package/es/routes/index.js +151 -0
  105. package/es/socket/components/SocketMonitorPage.d.ts +6 -0
  106. package/es/socket/components/SocketMonitorPage.js +485 -0
  107. package/es/socket/components/index.d.ts +2 -0
  108. package/es/socket/components/index.js +2 -0
  109. package/es/socket/constants.d.ts +33 -0
  110. package/es/socket/constants.js +39 -0
  111. package/es/socket/events.d.ts +31 -0
  112. package/es/socket/events.js +19 -0
  113. package/es/socket/heartbeat.d.ts +66 -0
  114. package/es/socket/heartbeat.js +184 -0
  115. package/es/socket/index.d.ts +61 -0
  116. package/es/socket/index.js +246 -0
  117. package/es/socket/monitor.d.ts +169 -0
  118. package/es/socket/monitor.js +448 -0
  119. package/es/socket/reconnect.d.ts +61 -0
  120. package/es/socket/reconnect.js +199 -0
  121. package/es/socket/socket.d.ts +130 -0
  122. package/es/socket/socket.js +613 -0
  123. package/es/socket/types.d.ts +85 -0
  124. package/es/socket/types.js +35 -0
  125. package/es/storage/index.d.ts +17 -0
  126. package/es/storage/index.js +46 -0
  127. package/es/tasks/index.d.ts +127 -0
  128. package/es/tasks/index.js +1119 -0
  129. package/es/tasks/scheduledTasksExample.d.ts +61 -0
  130. package/es/tasks/scheduledTasksExample.js +351 -0
  131. package/es/tasks/type.d.ts +100 -0
  132. package/es/tasks/type.js +1 -0
  133. package/es/tasks/useTasks.d.ts +5 -0
  134. package/es/tasks/useTasks.js +25 -0
  135. package/es/type.d.ts +2 -0
  136. package/es/type.js +1 -0
  137. package/es/utils/adaptiveThrottle/index.d.ts +36 -0
  138. package/es/utils/adaptiveThrottle/index.js +136 -0
  139. package/es/variables/VariablesProvider.d.ts +7 -0
  140. package/es/variables/VariablesProvider.js +12 -0
  141. package/es/variables/config.d.ts +3 -0
  142. package/es/variables/config.js +16 -0
  143. package/es/variables/index.d.ts +6 -0
  144. package/es/variables/index.js +5 -0
  145. package/es/variables/type.d.ts +2 -0
  146. package/es/variables/type.js +1 -0
  147. package/es/website/index.d.ts +6 -0
  148. package/es/website/index.js +65 -0
  149. package/lib/app/app.d.ts +101 -0
  150. package/lib/app/app.js +171 -0
  151. package/lib/app/const.d.ts +4 -0
  152. package/lib/app/const.js +33 -0
  153. package/lib/app/index.d.ts +14 -0
  154. package/lib/app/index.js +76 -0
  155. package/lib/applicationManager/application.d.ts +197 -0
  156. package/lib/applicationManager/application.js +280 -0
  157. package/lib/applicationManager/index.d.ts +19 -0
  158. package/lib/applicationManager/index.js +88 -0
  159. package/lib/aws/index.d.ts +16 -0
  160. package/lib/aws/index.js +67 -0
  161. package/lib/cmd/const.d.ts +11 -0
  162. package/lib/cmd/const.js +39 -0
  163. package/lib/cmd/index.d.ts +13 -0
  164. package/lib/cmd/index.js +96 -0
  165. package/lib/cmd/type.d.ts +5 -0
  166. package/lib/cmd/type.js +17 -0
  167. package/lib/communicationManager/index.d.ts +59 -0
  168. package/lib/communicationManager/index.js +102 -0
  169. package/lib/config.d.ts +3 -0
  170. package/lib/config.js +36 -0
  171. package/lib/cookie/index.d.ts +13 -0
  172. package/lib/cookie/index.js +62 -0
  173. package/lib/css/global.less +73 -0
  174. package/lib/css/index.less +31 -0
  175. package/lib/css/variables.css +84 -0
  176. package/lib/data/index.d.ts +8 -0
  177. package/lib/data/index.js +38 -0
  178. package/lib/history/config.d.ts +24 -0
  179. package/lib/history/config.js +41 -0
  180. package/lib/history/index.d.ts +26 -0
  181. package/lib/history/index.js +99 -0
  182. package/lib/history/type.d.ts +2 -0
  183. package/lib/history/type.js +17 -0
  184. package/lib/hooks/index.d.ts +12 -0
  185. package/lib/hooks/index.js +44 -0
  186. package/lib/hooks/useDelayedValue/index.d.ts +2 -0
  187. package/lib/hooks/useDelayedValue/index.js +36 -0
  188. package/lib/hooks/useDispatch/index.d.ts +2 -0
  189. package/lib/hooks/useDispatch/index.js +26 -0
  190. package/lib/hooks/useLowCode/index.d.ts +13 -0
  191. package/lib/hooks/useLowCode/index.js +75 -0
  192. package/lib/hooks/useStore/index.d.ts +6 -0
  193. package/lib/hooks/useStore/index.js +33 -0
  194. package/lib/index.d.ts +8 -0
  195. package/lib/index.js +58 -0
  196. package/lib/indexDB/index.d.ts +296 -0
  197. package/lib/indexDB/index.js +767 -0
  198. package/lib/locales/en.d.ts +3 -0
  199. package/lib/locales/en.js +29 -0
  200. package/lib/locales/index.d.ts +39 -0
  201. package/lib/locales/index.js +159 -0
  202. package/lib/locales/original.d.ts +3 -0
  203. package/lib/locales/original.js +31 -0
  204. package/lib/locales/type.d.ts +19 -0
  205. package/lib/locales/type.js +17 -0
  206. package/lib/locales/zh-CN.d.ts +3 -0
  207. package/lib/locales/zh-CN.js +29 -0
  208. package/lib/locales/zh-HK.d.ts +3 -0
  209. package/lib/locales/zh-HK.js +29 -0
  210. package/lib/logger/feishu.d.ts +11 -0
  211. package/lib/logger/feishu.js +52 -0
  212. package/lib/logger/index.d.ts +135 -0
  213. package/lib/logger/index.js +476 -0
  214. package/lib/menuManager/hooks.d.ts +17 -0
  215. package/lib/menuManager/hooks.js +135 -0
  216. package/lib/menuManager/index.d.ts +28 -0
  217. package/lib/menuManager/index.js +125 -0
  218. package/lib/models/global.d.ts +32 -0
  219. package/lib/models/global.js +62 -0
  220. package/lib/models/index.d.ts +45 -0
  221. package/lib/models/index.js +69 -0
  222. package/lib/models/type.d.ts +2 -0
  223. package/lib/models/type.js +17 -0
  224. package/lib/plugin/index.d.ts +0 -0
  225. package/lib/plugin/index.js +0 -0
  226. package/lib/pubsub/example.d.ts +5 -0
  227. package/lib/pubsub/example.js +61 -0
  228. package/lib/pubsub/index.d.ts +73 -0
  229. package/lib/pubsub/index.js +141 -0
  230. package/lib/render/index.d.ts +0 -0
  231. package/lib/render/index.js +0 -0
  232. package/lib/request/cache.d.ts +46 -0
  233. package/lib/request/cache.js +195 -0
  234. package/lib/request/cancelToken.d.ts +38 -0
  235. package/lib/request/cancelToken.js +59 -0
  236. package/lib/request/config.d.ts +3 -0
  237. package/lib/request/config.js +69 -0
  238. package/lib/request/constants.d.ts +2 -0
  239. package/lib/request/constants.js +34 -0
  240. package/lib/request/index.d.ts +24 -0
  241. package/lib/request/index.js +210 -0
  242. package/lib/request/pisell2Request.d.ts +6 -0
  243. package/lib/request/pisell2Request.js +75 -0
  244. package/lib/request/type.d.ts +57 -0
  245. package/lib/request/type.js +36 -0
  246. package/lib/request/utils.d.ts +46 -0
  247. package/lib/request/utils.js +113 -0
  248. package/lib/routes/config.d.ts +7 -0
  249. package/lib/routes/config.js +50 -0
  250. package/lib/routes/index.d.ts +28 -0
  251. package/lib/routes/index.js +121 -0
  252. package/lib/socket/components/SocketMonitorPage.d.ts +6 -0
  253. package/lib/socket/components/SocketMonitorPage.js +340 -0
  254. package/lib/socket/components/index.d.ts +2 -0
  255. package/lib/socket/components/index.js +39 -0
  256. package/lib/socket/constants.d.ts +33 -0
  257. package/lib/socket/constants.js +62 -0
  258. package/lib/socket/events.d.ts +31 -0
  259. package/lib/socket/events.js +44 -0
  260. package/lib/socket/heartbeat.d.ts +66 -0
  261. package/lib/socket/heartbeat.js +157 -0
  262. package/lib/socket/index.d.ts +61 -0
  263. package/lib/socket/index.js +198 -0
  264. package/lib/socket/monitor.d.ts +169 -0
  265. package/lib/socket/monitor.js +350 -0
  266. package/lib/socket/reconnect.d.ts +61 -0
  267. package/lib/socket/reconnect.js +157 -0
  268. package/lib/socket/socket.d.ts +130 -0
  269. package/lib/socket/socket.js +426 -0
  270. package/lib/socket/types.d.ts +85 -0
  271. package/lib/socket/types.js +36 -0
  272. package/lib/storage/index.d.ts +17 -0
  273. package/lib/storage/index.js +64 -0
  274. package/lib/tasks/index.d.ts +127 -0
  275. package/lib/tasks/index.js +710 -0
  276. package/lib/tasks/scheduledTasksExample.d.ts +61 -0
  277. package/lib/tasks/scheduledTasksExample.js +267 -0
  278. package/lib/tasks/type.d.ts +100 -0
  279. package/lib/tasks/type.js +17 -0
  280. package/lib/tasks/useTasks.d.ts +5 -0
  281. package/lib/tasks/useTasks.js +37 -0
  282. package/lib/type.d.ts +2 -0
  283. package/lib/type.js +17 -0
  284. package/lib/utils/adaptiveThrottle/index.d.ts +36 -0
  285. package/lib/utils/adaptiveThrottle/index.js +121 -0
  286. package/lib/variables/VariablesProvider.d.ts +7 -0
  287. package/lib/variables/VariablesProvider.js +51 -0
  288. package/lib/variables/config.d.ts +3 -0
  289. package/lib/variables/config.js +38 -0
  290. package/lib/variables/index.d.ts +6 -0
  291. package/lib/variables/index.js +29 -0
  292. package/lib/variables/type.d.ts +2 -0
  293. package/lib/variables/type.js +17 -0
  294. package/lib/website/index.d.ts +6 -0
  295. package/lib/website/index.js +75 -0
  296. package/package.json +49 -0
@@ -0,0 +1,75 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/request/pisell2Request.ts
20
+ var pisell2Request_exports = {};
21
+ __export(pisell2Request_exports, {
22
+ get: () => pisell2Get,
23
+ post: () => pisell2Post,
24
+ put: () => pisell2Put,
25
+ remove: () => pisell2Remove
26
+ });
27
+ module.exports = __toCommonJS(pisell2Request_exports);
28
+ var import_index = require("./index");
29
+ var pisell2Get = (url, data = {}, config = {}) => {
30
+ return (0, import_index.get)(url, data, {
31
+ ...config,
32
+ pisell2: true,
33
+ headers: {
34
+ ...(config == null ? void 0 : config.headers) || {},
35
+ Accept: "*/json"
36
+ }
37
+ });
38
+ };
39
+ var pisell2Post = (url, data = {}, config = {}) => {
40
+ return (0, import_index.post)(url, data, {
41
+ ...config,
42
+ pisell2: true,
43
+ headers: {
44
+ ...(config == null ? void 0 : config.headers) || {},
45
+ Accept: "*/json"
46
+ }
47
+ });
48
+ };
49
+ var pisell2Put = (url, data = {}, config = {}) => {
50
+ return (0, import_index.put)(url, data, {
51
+ ...config,
52
+ pisell2: true,
53
+ headers: {
54
+ ...(config == null ? void 0 : config.headers) || {},
55
+ Accept: "*/json"
56
+ }
57
+ });
58
+ };
59
+ var pisell2Remove = (url, data = {}, config = {}) => {
60
+ return (0, import_index.remove)(url, data, {
61
+ ...config,
62
+ pisell2: true,
63
+ headers: {
64
+ ...(config == null ? void 0 : config.headers) || {},
65
+ Accept: "*/json"
66
+ }
67
+ });
68
+ };
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ get,
72
+ post,
73
+ put,
74
+ remove
75
+ });
@@ -0,0 +1,57 @@
1
+ import { CreateAxiosDefaults } from "axios";
2
+ import { CacheType } from './cache';
3
+ export interface RequestConfig {
4
+ logger: {
5
+ maxRequestCount: number;
6
+ maxRequestTime: number;
7
+ filterUrls: string[];
8
+ };
9
+ interceptorsRequest?: ((value: any) => any | Promise<any>) | null;
10
+ interceptorsRequestError?: ((error: any) => any) | null;
11
+ interceptorsResponse?: any;
12
+ interceptorsResponseError?: ((error: any) => any) | null;
13
+ axiosConfig?: CreateAxiosDefaults;
14
+ storage?: any;
15
+ getToken?: () => string | null;
16
+ setToken?: (token: string) => void;
17
+ getLocale?: () => string | null;
18
+ getUrl?: (config: any) => string;
19
+ requestCallbacks?: {
20
+ 200?: (data: any) => void;
21
+ 401?: (data: any) => void;
22
+ 403?: (data: any) => void;
23
+ other?: (data: any) => void;
24
+ [key: string]: any;
25
+ };
26
+ }
27
+ export declare enum RequestModeENUM {
28
+ LOCAL = "local",
29
+ REMOTE = "remote",
30
+ LOCAL_REMOTE = "local_remote",
31
+ REMOTE_LOCAL = "remote_local",
32
+ OS_SERVER = "os_server"
33
+ }
34
+ export declare type RequestModeType = RequestModeENUM.LOCAL | RequestModeENUM.REMOTE | RequestModeENUM.LOCAL_REMOTE | RequestModeENUM.REMOTE_LOCAL | RequestModeENUM.OS_SERVER;
35
+ export interface CacheProps {
36
+ key?: string;
37
+ type?: CacheType;
38
+ updateCache?: boolean;
39
+ cacheUpdateChange?: (data: any) => void;
40
+ mode?: RequestModeType;
41
+ cacheKeyData?: any;
42
+ }
43
+ export interface RequestSetting {
44
+ abort?: boolean;
45
+ headers?: any;
46
+ cache?: CacheProps;
47
+ signal?: any;
48
+ token?: string;
49
+ osServer?: boolean;
50
+ [key: string]: any;
51
+ }
52
+ export interface RequestWrapperProps {
53
+ url: string;
54
+ method: 'get' | 'post' | 'remove' | 'put';
55
+ data?: any;
56
+ config?: RequestSetting;
57
+ }
@@ -0,0 +1,36 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/request/type.ts
20
+ var type_exports = {};
21
+ __export(type_exports, {
22
+ RequestModeENUM: () => RequestModeENUM
23
+ });
24
+ module.exports = __toCommonJS(type_exports);
25
+ var RequestModeENUM = /* @__PURE__ */ ((RequestModeENUM2) => {
26
+ RequestModeENUM2["LOCAL"] = "local";
27
+ RequestModeENUM2["REMOTE"] = "remote";
28
+ RequestModeENUM2["LOCAL_REMOTE"] = "local_remote";
29
+ RequestModeENUM2["REMOTE_LOCAL"] = "remote_local";
30
+ RequestModeENUM2["OS_SERVER"] = "os_server";
31
+ return RequestModeENUM2;
32
+ })(RequestModeENUM || {});
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ RequestModeENUM
36
+ });
@@ -0,0 +1,46 @@
1
+ import { InternalAxiosRequestConfig } from "axios";
2
+ import { RequestSetting, RequestConfig, RequestWrapperProps } from "./type";
3
+ export declare const getRequestHeaders: (config: InternalAxiosRequestConfig<RequestSetting> & Record<string, any>) => Record<string, string | null>;
4
+ /**
5
+ * @title: 请求前拦截
6
+ * @description:
7
+ * @param {any} config
8
+ * @return {*}
9
+ * @Author: zhiwei.Wang
10
+ * @Date: 2024-07-04 10:51
11
+ */
12
+ export declare const interceptorsRequest: (config: InternalAxiosRequestConfig<RequestSetting> & Record<string, any>) => Promise<InternalAxiosRequestConfig<RequestSetting> & Record<string, any>>;
13
+ /**
14
+ * @title: 请求前error
15
+ * @description:
16
+ * @param {any} err
17
+ * @return {*}
18
+ * @Author: zhiwei.Wang
19
+ * @Date: 2024-07-04 10:51
20
+ */
21
+ export declare const interceptorsRequestError: (err: RequestConfig["interceptorsRequestError"]) => any;
22
+ /**
23
+ * @title: 请求后拦截
24
+ * @description:
25
+ * @param {any} response
26
+ * @return {*}
27
+ * @Author: zhiwei.Wang
28
+ * @Date: 2024-07-04 10:51
29
+ */
30
+ export declare const interceptorsResponse: (response: RequestConfig["interceptorsResponse"]) => any;
31
+ /**
32
+ * @title: 请求后错误拦截
33
+ * @description:
34
+ * @param {any} response
35
+ * @return {*}
36
+ * @Author: zhiwei.Wang
37
+ * @Date: 2024-07-04 10:51
38
+ */
39
+ export declare const interceptorsResponseError: (response: RequestConfig["interceptorsResponseError"]) => any;
40
+ export declare const requestCallback: (resData: {
41
+ res?: any;
42
+ props: RequestWrapperProps;
43
+ resolve: (value: unknown) => void;
44
+ reject: () => void;
45
+ err?: any;
46
+ }) => void;
@@ -0,0 +1,113 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/request/utils.ts
20
+ var utils_exports = {};
21
+ __export(utils_exports, {
22
+ getRequestHeaders: () => getRequestHeaders,
23
+ interceptorsRequest: () => interceptorsRequest,
24
+ interceptorsRequestError: () => interceptorsRequestError,
25
+ interceptorsResponse: () => interceptorsResponse,
26
+ interceptorsResponseError: () => interceptorsResponseError,
27
+ requestCallback: () => requestCallback
28
+ });
29
+ module.exports = __toCommonJS(utils_exports);
30
+ var import_cache = require("./cache");
31
+ var import_config = require("./config");
32
+ var getRequestHeaders = (config) => {
33
+ const { getToken, getLocale, getUrl } = (0, import_config.getConfig)();
34
+ const token = getToken == null ? void 0 : getToken();
35
+ let authorization = (config == null ? void 0 : config.token) || token || "";
36
+ const headers = {
37
+ Accept: "*/json",
38
+ Timezone: "Australia/Sydney",
39
+ // 'X-Timezone': "+00:00",
40
+ locale: getLocale == null ? void 0 : getLocale(),
41
+ authorization
42
+ };
43
+ if (config == null ? void 0 : config.third) {
44
+ headers.authorization = null;
45
+ }
46
+ return headers;
47
+ };
48
+ var interceptorsRequest = async (config) => {
49
+ const { getUrl } = (0, import_config.getConfig)();
50
+ config.url = getUrl == null ? void 0 : getUrl(config);
51
+ const headers = getRequestHeaders(config);
52
+ config.headers["authorization"] = headers.authorization;
53
+ config.headers["locale"] = headers.locale;
54
+ const _interceptorsRequest = (0, import_config.getConfig)().interceptorsRequest;
55
+ if (_interceptorsRequest) {
56
+ config = await _interceptorsRequest(config);
57
+ }
58
+ return config;
59
+ };
60
+ var interceptorsRequestError = (err) => {
61
+ var _a, _b;
62
+ return (_b = (_a = (0, import_config.getConfig)()).interceptorsRequestError) == null ? void 0 : _b.call(_a, err);
63
+ };
64
+ var interceptorsResponse = (response) => {
65
+ const _interceptorsResponse = (0, import_config.getConfig)().interceptorsResponse;
66
+ const Authorization = response.headers["Authorization"];
67
+ if (Authorization) {
68
+ const { setToken } = (0, import_config.getConfig)();
69
+ setToken == null ? void 0 : setToken(Authorization);
70
+ }
71
+ if (_interceptorsResponse) {
72
+ return _interceptorsResponse(response);
73
+ }
74
+ return response == null ? void 0 : response.data;
75
+ };
76
+ var interceptorsResponseError = (response) => {
77
+ var _a, _b;
78
+ return (_b = (_a = (0, import_config.getConfig)()).interceptorsResponseError) == null ? void 0 : _b.call(_a, response);
79
+ };
80
+ var requestCallback = (resData) => {
81
+ var _a;
82
+ const { res, props, resolve, reject, err } = resData;
83
+ try {
84
+ const { config } = props;
85
+ const { requestCallbacks } = (0, import_config.getConfig)();
86
+ const codeFn = requestCallbacks == null ? void 0 : requestCallbacks[res == null ? void 0 : res.code];
87
+ if (codeFn) {
88
+ if ((res == null ? void 0 : res.code) === 200) {
89
+ if ((config == null ? void 0 : config.useCache) || (config == null ? void 0 : config.cache)) {
90
+ (0, import_cache.setCacheData)(props.url, props.data, res, config == null ? void 0 : config.cache);
91
+ (_a = config == null ? void 0 : config.cacheUpdateChange) == null ? void 0 : _a.call(config, res);
92
+ }
93
+ }
94
+ return codeFn(resData);
95
+ }
96
+ const otherFn = requestCallbacks == null ? void 0 : requestCallbacks["other"];
97
+ if (otherFn) {
98
+ return otherFn(resData);
99
+ }
100
+ } catch (err2) {
101
+ console.log("requestCallback err", err2);
102
+ }
103
+ reject();
104
+ };
105
+ // Annotate the CommonJS export names for ESM import in node:
106
+ 0 && (module.exports = {
107
+ getRequestHeaders,
108
+ interceptorsRequest,
109
+ interceptorsRequestError,
110
+ interceptorsResponse,
111
+ interceptorsResponseError,
112
+ requestCallback
113
+ });
@@ -0,0 +1,7 @@
1
+ export interface RouteItem {
2
+ path: string;
3
+ component: any;
4
+ exact?: boolean;
5
+ routes?: RouteItem[];
6
+ }
7
+ export declare const routes: RouteItem[];
@@ -0,0 +1,50 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/routes/config.ts
20
+ var config_exports = {};
21
+ __export(config_exports, {
22
+ routes: () => routes
23
+ });
24
+ module.exports = __toCommonJS(config_exports);
25
+ var routes = [
26
+ {
27
+ path: "/",
28
+ component: "../pages/Theme",
29
+ exact: true
30
+ },
31
+ {
32
+ path: "/test",
33
+ component: "../pages/Test",
34
+ exact: true
35
+ },
36
+ {
37
+ path: "/pay",
38
+ component: "../pages/Pay",
39
+ exact: true
40
+ },
41
+ {
42
+ path: "/lc/:id",
43
+ component: "../pages/LowCodePage",
44
+ exact: true
45
+ }
46
+ ];
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ routes
50
+ });
@@ -0,0 +1,28 @@
1
+ import App from '../app';
2
+ import React from 'react';
3
+ import type { ApplicationInterface } from '../applicationManager/application';
4
+ export interface RouterOptions {
5
+ routes?: Record<string, RouteType>;
6
+ basename?: string;
7
+ }
8
+ export interface RouteType extends ApplicationInterface {
9
+ }
10
+ export declare class RouterManager {
11
+ routes: Record<string, RouteType>;
12
+ options: RouterOptions;
13
+ app: App;
14
+ constructor(options: RouterOptions | undefined, app: App);
15
+ init(): void;
16
+ getRoutes(): Record<string, RouteType>;
17
+ getBasename(): string | undefined;
18
+ setBasename(basename: string): void;
19
+ add(name: string, route: any): void;
20
+ get(name: string): RouteType;
21
+ has(name: string): boolean;
22
+ remove(name: string): void;
23
+ renderComponent(item: RouteType, children?: React.ReactNode): string | number | boolean | React.ReactFragment | JSX.Element | null | undefined;
24
+ getPageByRoute(route: string): ApplicationInterface | undefined;
25
+ getRouterComponent({ fallback }: {
26
+ fallback?: React.ReactNode;
27
+ }): JSX.Element[];
28
+ }
@@ -0,0 +1,121 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/routes/index.tsx
30
+ var routes_exports = {};
31
+ __export(routes_exports, {
32
+ RouterManager: () => RouterManager
33
+ });
34
+ module.exports = __toCommonJS(routes_exports);
35
+ var import_react = __toESM(require("react"));
36
+ var import_react_router_dom = require("react-router-dom");
37
+ var RouterManager = class {
38
+ routes = {};
39
+ options;
40
+ app;
41
+ constructor(options = {}, app) {
42
+ this.options = options;
43
+ this.app = app;
44
+ this.routes = options.routes || {};
45
+ }
46
+ init() {
47
+ }
48
+ getRoutes() {
49
+ return this.routes;
50
+ }
51
+ getBasename() {
52
+ return this.options.basename;
53
+ }
54
+ setBasename(basename) {
55
+ this.options.basename = basename;
56
+ }
57
+ add(name, route) {
58
+ this.routes[name] = route;
59
+ }
60
+ get(name) {
61
+ return this.routes[name];
62
+ }
63
+ has(name) {
64
+ return !!this.get(name);
65
+ }
66
+ remove(name) {
67
+ delete this.routes[name];
68
+ }
69
+ renderComponent(item, children) {
70
+ const { Component } = item;
71
+ if (!Component) {
72
+ return children;
73
+ }
74
+ return /* @__PURE__ */ import_react.default.createElement(Component, { ...item }, children);
75
+ }
76
+ getPageByRoute(route) {
77
+ if (this.routes[route]) {
78
+ return this.routes[route];
79
+ }
80
+ const routeParts = route.split("/");
81
+ for (const [path, item] of Object.entries(this.routes)) {
82
+ const pathParts = path.split("/");
83
+ if (routeParts.length !== pathParts.length) {
84
+ continue;
85
+ }
86
+ let isMatch = true;
87
+ for (let i = 0; i < pathParts.length; i++) {
88
+ if (pathParts[i].startsWith(":")) {
89
+ continue;
90
+ }
91
+ if (pathParts[i] !== routeParts[i]) {
92
+ isMatch = false;
93
+ break;
94
+ }
95
+ }
96
+ if (isMatch) {
97
+ return item;
98
+ }
99
+ }
100
+ return void 0;
101
+ }
102
+ getRouterComponent({ fallback }) {
103
+ let routes = [];
104
+ let firstRoute = "";
105
+ for (const [path, item] of Object.entries(this.routes)) {
106
+ if (!firstRoute && path) {
107
+ firstRoute = path;
108
+ }
109
+ const component = this.renderComponent(item);
110
+ routes.push(
111
+ //@ts-ignore
112
+ /* @__PURE__ */ import_react.default.createElement(import_react_router_dom.Route, { path, key: path, exact: true }, /* @__PURE__ */ import_react.default.createElement(import_react.Suspense, { fallback: fallback || /* @__PURE__ */ import_react.default.createElement("div", null) }, component))
113
+ );
114
+ }
115
+ return routes;
116
+ }
117
+ };
118
+ // Annotate the CommonJS export names for ESM import in node:
119
+ 0 && (module.exports = {
120
+ RouterManager
121
+ });
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ /**
3
+ * Socket监控页面组件
4
+ */
5
+ declare const SocketMonitorPage: React.FC;
6
+ export default SocketMonitorPage;