@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,469 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
6
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
7
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
8
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
10
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
+ import React, { useRef } from 'react';
15
+ /**
16
+ * 应用接口类型定义
17
+ * @description 描述应用中单个页面、组件或功能的接口结构
18
+ */
19
+
20
+ /**
21
+ * 应用数据类型定义
22
+ * @description 描述完整应用的数据结构,包含应用的基本信息、接口、功能等
23
+ */
24
+
25
+ /**
26
+ * 应用管理类
27
+ * @description 负责管理单个应用的生命周期,包括接口、组件、功能的初始化和管理
28
+ * @class Application
29
+ * @author zhiwei.Wang
30
+ */
31
+ export var Application = /*#__PURE__*/function () {
32
+ /**
33
+ * 构造函数
34
+ * @description 初始化应用实例,设置基本属性并初始化接口和功能
35
+ * @param {ApplicationData} options - 应用配置数据
36
+ * @param {App} app - 应用实例引用
37
+ */
38
+ function Application(options, app) {
39
+ _classCallCheck(this, Application);
40
+ /** 应用配置数据 */
41
+ _defineProperty(this, "options", void 0);
42
+ /** 应用名称 */
43
+ _defineProperty(this, "name", void 0);
44
+ /** 应用内的页面接口映射表,以页面名称为键 */
45
+ _defineProperty(this, "interfaces", new Map());
46
+ /** 应用内的组件映射表,以组件编码为键 */
47
+ _defineProperty(this, "components", new Map());
48
+ /** 应用内的功能函数映射表,比如跳转登录页面的方法等 */
49
+ _defineProperty(this, "functions", new Map());
50
+ /** 应用实例引用 */
51
+ _defineProperty(this, "app", void 0);
52
+ this.options = options;
53
+ this.name = options.app_name;
54
+ this.app = app;
55
+ this.initInterfaces(options.interfaces);
56
+ this.initFunctions(options.functions);
57
+ }
58
+
59
+ /**
60
+ * 应用添加后的内部处理方法
61
+ * @description 在应用被添加到应用管理器后执行的内部逻辑,包括加载多语言配置和执行用户自定义的afterAdd方法
62
+ * @param {Application} application - 被添加的应用实例
63
+ * @returns {Promise<void>}
64
+ * @private
65
+ */
66
+ _createClass(Application, [{
67
+ key: "_afterAdd",
68
+ value: (function () {
69
+ var _afterAdd2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(application) {
70
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
71
+ while (1) switch (_context.prev = _context.next) {
72
+ case 0:
73
+ if (application.options.locales) {
74
+ this.app.locales.loadLibraryByUrl(application.options.locales);
75
+ }
76
+ _context.prev = 1;
77
+ _context.next = 4;
78
+ return this.afterAdd(this);
79
+ case 4:
80
+ _context.next = 9;
81
+ break;
82
+ case 6:
83
+ _context.prev = 6;
84
+ _context.t0 = _context["catch"](1);
85
+ console.log(_context.t0);
86
+ case 9:
87
+ case "end":
88
+ return _context.stop();
89
+ }
90
+ }, _callee, this, [[1, 6]]);
91
+ }));
92
+ function _afterAdd(_x) {
93
+ return _afterAdd2.apply(this, arguments);
94
+ }
95
+ return _afterAdd;
96
+ }()
97
+ /**
98
+ * 应用加载前的内部处理方法
99
+ * @description 在应用开始加载前执行的内部逻辑,调用用户自定义的beforeLoad方法
100
+ * @returns {Promise<void>}
101
+ * @private
102
+ */
103
+ )
104
+ }, {
105
+ key: "_beforeLoad",
106
+ value: (function () {
107
+ var _beforeLoad2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
108
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
109
+ while (1) switch (_context2.prev = _context2.next) {
110
+ case 0:
111
+ _context2.prev = 0;
112
+ _context2.next = 3;
113
+ return this.beforeLoad(this);
114
+ case 3:
115
+ _context2.next = 8;
116
+ break;
117
+ case 5:
118
+ _context2.prev = 5;
119
+ _context2.t0 = _context2["catch"](0);
120
+ console.log(_context2.t0);
121
+ case 8:
122
+ case "end":
123
+ return _context2.stop();
124
+ }
125
+ }, _callee2, this, [[0, 5]]);
126
+ }));
127
+ function _beforeLoad() {
128
+ return _beforeLoad2.apply(this, arguments);
129
+ }
130
+ return _beforeLoad;
131
+ }()
132
+ /**
133
+ * 应用加载的内部处理方法
134
+ * @description 执行应用的实际加载逻辑,将应用中的所有接口注册为路由
135
+ * @returns {Promise<void>}
136
+ * @private
137
+ */
138
+ )
139
+ }, {
140
+ key: "_load",
141
+ value: (function () {
142
+ var _load2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
143
+ var _this = this;
144
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
145
+ while (1) switch (_context3.prev = _context3.next) {
146
+ case 0:
147
+ _context3.prev = 0;
148
+ // 将interface 生成路由
149
+ this.interfaces.forEach(function (item, key) {
150
+ // 如果路由不是以 /native/ 开头,则添加到路由管理器, native路由是原生页面
151
+ if (((item === null || item === void 0 ? void 0 : item.router) || '').indexOf('/native/') === -1) {
152
+ _this.app.router.add((item === null || item === void 0 ? void 0 : item.router) || '', item);
153
+ }
154
+ });
155
+ _context3.next = 4;
156
+ return this.load(this);
157
+ case 4:
158
+ _context3.next = 9;
159
+ break;
160
+ case 6:
161
+ _context3.prev = 6;
162
+ _context3.t0 = _context3["catch"](0);
163
+ console.log(_context3.t0);
164
+ case 9:
165
+ case "end":
166
+ return _context3.stop();
167
+ }
168
+ }, _callee3, this, [[0, 6]]);
169
+ }));
170
+ function _load() {
171
+ return _load2.apply(this, arguments);
172
+ }
173
+ return _load;
174
+ }()
175
+ /**
176
+ * 初始化应用接口
177
+ * @description 遍历应用配置中的接口列表,根据类别将它们分别设置到对应的映射表中
178
+ * @param {ApplicationData['interfaces']} interfaces - 接口配置数组
179
+ * @returns {void}
180
+ */
181
+ )
182
+ }, {
183
+ key: "initInterfaces",
184
+ value: function initInterfaces(interfaces) {
185
+ var _this2 = this;
186
+ interfaces.forEach( /*#__PURE__*/function () {
187
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(interfaceItem) {
188
+ var _interface;
189
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
190
+ while (1) switch (_context4.prev = _context4.next) {
191
+ case 0:
192
+ _context4.next = 2;
193
+ return _this2.loadInterface(interfaceItem);
194
+ case 2:
195
+ _interface = _context4.sent;
196
+ if (interfaceItem.category === 'page') {
197
+ _this2.setInterface(interfaceItem.page_code, _interface);
198
+ }
199
+ if (interfaceItem.category === 'component') {
200
+ _this2.setComponent(interfaceItem.page_code, _interface);
201
+ }
202
+ if (interfaceItem.category === 'function') {
203
+ _this2.setFunction(interfaceItem.page_code, _interface);
204
+ }
205
+ case 6:
206
+ case "end":
207
+ return _context4.stop();
208
+ }
209
+ }, _callee4);
210
+ }));
211
+ return function (_x2) {
212
+ return _ref2.apply(this, arguments);
213
+ };
214
+ }());
215
+ }
216
+
217
+ /**
218
+ * 初始化应用功能函数
219
+ * @description 遍历应用配置中的功能列表,将它们设置到功能映射表中
220
+ * @param {ApplicationData['functions']} functions - 功能配置数组,可选
221
+ * @returns {void}
222
+ */
223
+ }, {
224
+ key: "initFunctions",
225
+ value: function initFunctions(functions) {
226
+ var _this3 = this;
227
+ (functions || []).forEach( /*#__PURE__*/function () {
228
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(functionItem) {
229
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
230
+ while (1) switch (_context5.prev = _context5.next) {
231
+ case 0:
232
+ _this3.setFunction(functionItem.function_code, functionItem);
233
+ case 1:
234
+ case "end":
235
+ return _context5.stop();
236
+ }
237
+ }, _callee5);
238
+ }));
239
+ return function (_x3) {
240
+ return _ref3.apply(this, arguments);
241
+ };
242
+ }());
243
+ }
244
+
245
+ /**
246
+ * 加载接口组件
247
+ * @description 根据接口类型加载对应的组件,支持低代码和普通代码两种类型
248
+ * @param {ApplicationInterface} interfaceItem - 接口配置项
249
+ * @returns {Promise<ApplicationInterface>} 加载后的接口配置
250
+ */
251
+ }, {
252
+ key: "loadInterface",
253
+ value: (function () {
254
+ var _loadInterface = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(interfaceItem) {
255
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
256
+ while (1) switch (_context6.prev = _context6.next) {
257
+ case 0:
258
+ if (!interfaceItem.Component) {
259
+ _context6.next = 2;
260
+ break;
261
+ }
262
+ return _context6.abrupt("return", interfaceItem);
263
+ case 2:
264
+ if (interfaceItem.page_type === 'low_code') {
265
+ // TODO: load low code interface
266
+ }
267
+ if (interfaceItem.page_type === 'code') {
268
+ // TODO: load code interface
269
+ }
270
+ return _context6.abrupt("return", interfaceItem);
271
+ case 5:
272
+ case "end":
273
+ return _context6.stop();
274
+ }
275
+ }, _callee6);
276
+ }));
277
+ function loadInterface(_x4) {
278
+ return _loadInterface.apply(this, arguments);
279
+ }
280
+ return loadInterface;
281
+ }()
282
+ /**
283
+ * 设置页面
284
+ * @description 将页面接口添加到接口映射表中
285
+ * @param {string} code - 页面编码
286
+ * @param {ApplicationInterface} interfaceItem - 接口配置项
287
+ * @returns {void}
288
+ */
289
+ )
290
+ }, {
291
+ key: "setInterface",
292
+ value: function setInterface(code, interfaceItem) {
293
+ this.interfaces.set(code, interfaceItem);
294
+ }
295
+
296
+ /**
297
+ * 设置组件
298
+ * @description 将组件添加到组件映射表中
299
+ * @param {string} code - 组件编码
300
+ * @param {ApplicationInterface} component - 组件配置项
301
+ * @returns {void}
302
+ */
303
+ }, {
304
+ key: "setComponent",
305
+ value: function setComponent(code, component) {
306
+ var _this4 = this;
307
+ var Component = function Component(props) {
308
+ var _ref4 = useRef();
309
+ var Com = component === null || component === void 0 ? void 0 : component.Component;
310
+ return /*#__PURE__*/React.createElement(Com, _extends({}, props, {
311
+ ref: function ref(_ref) {
312
+ _ref4.current = _ref;
313
+ console.log('组件ref执行了');
314
+ _this4.components.set(code, _objectSpread(_objectSpread({}, _this4.getComponent(code)), {}, {
315
+ ref: _ref4.current
316
+ }));
317
+ }
318
+ }));
319
+ };
320
+ this.components.set(code, _objectSpread(_objectSpread({}, component), {}, {
321
+ Component: component.autoRender ? Component : component.Component
322
+ }));
323
+ }
324
+
325
+ /**
326
+ * 设置功能函数
327
+ * @description 将功能函数添加到功能映射表中
328
+ * @param {string} code - 功能编码
329
+ * @param {ApplicationInterface} functionItem - 功能配置项
330
+ * @returns {void}
331
+ */
332
+ }, {
333
+ key: "setFunction",
334
+ value: function setFunction(code, functionItem) {
335
+ this.functions.set(code, functionItem);
336
+ }
337
+
338
+ /**
339
+ * 获取页面
340
+ * @description 根据编码从接口映射表中获取页面接口
341
+ * @param {string} code - 页面编码
342
+ * @returns {ApplicationInterface | undefined} 接口配置项或undefined
343
+ */
344
+ }, {
345
+ key: "getInterface",
346
+ value: function getInterface(code) {
347
+ return this.interfaces.get(code);
348
+ }
349
+
350
+ /**
351
+ * 获取组件
352
+ * @description 根据编码从组件映射表中获取组件
353
+ * @param {string} code - 组件编码
354
+ * @returns {any | undefined} 组件或undefined
355
+ */
356
+ }, {
357
+ key: "getComponent",
358
+ value: function getComponent(code) {
359
+ return this.components.get(code);
360
+ }
361
+
362
+ /**
363
+ * 获取功能函数
364
+ * @description 根据编码从功能映射表中获取功能函数
365
+ * @param {string} code - 功能编码
366
+ * @returns {any | undefined} 功能函数或undefined
367
+ */
368
+ }, {
369
+ key: "getFunction",
370
+ value: function getFunction(code) {
371
+ return this.functions.get(code);
372
+ }
373
+ /**
374
+ * 执行功能函数
375
+ * @description 根据编码执行对应的功能函数,自动注入应用实例并合并参数
376
+ * @param {string} code - 功能编码
377
+ * @param {any} params - 传递给功能函数的参数对象,可选
378
+ * @param {...any} args - 传递给功能函数的其他参数
379
+ * @returns {any} 功能函数的执行结果
380
+ */
381
+ }, {
382
+ key: "runFunction",
383
+ value: function runFunction(code, params) {
384
+ var _this$getFunction;
385
+ // 合并参数
386
+ var _params = _objectSpread({
387
+ app: this.app
388
+ }, params);
389
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
390
+ args[_key - 2] = arguments[_key];
391
+ }
392
+ return (_this$getFunction = this.getFunction(code)) === null || _this$getFunction === void 0 ? void 0 : _this$getFunction.code.apply(_this$getFunction, [_params].concat(args));
393
+ }
394
+
395
+ /**
396
+ * 应用添加后触发的钩子函数
397
+ * @description 在应用被添加到应用管理器后触发,可被子类覆盖以实现自定义逻辑
398
+ * @param {Application} application - 被添加的应用实例
399
+ * @returns {Promise<void>}
400
+ * @author zhiwei.Wang
401
+ */
402
+ }, {
403
+ key: "afterAdd",
404
+ value: (function () {
405
+ var _afterAdd3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(application) {
406
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
407
+ while (1) switch (_context7.prev = _context7.next) {
408
+ case 0:
409
+ case "end":
410
+ return _context7.stop();
411
+ }
412
+ }, _callee7);
413
+ }));
414
+ function afterAdd(_x5) {
415
+ return _afterAdd3.apply(this, arguments);
416
+ }
417
+ return afterAdd;
418
+ }()
419
+ /**
420
+ * 应用加载前触发的钩子函数
421
+ * @description 在应用开始加载前触发,可被子类覆盖以实现自定义预处理逻辑
422
+ * @returns {Promise<void>}
423
+ * @author zhiwei.Wang
424
+ */
425
+ )
426
+ }, {
427
+ key: "beforeLoad",
428
+ value: (function () {
429
+ var _beforeLoad3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(application) {
430
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
431
+ while (1) switch (_context8.prev = _context8.next) {
432
+ case 0:
433
+ case "end":
434
+ return _context8.stop();
435
+ }
436
+ }, _callee8);
437
+ }));
438
+ function beforeLoad(_x6) {
439
+ return _beforeLoad3.apply(this, arguments);
440
+ }
441
+ return beforeLoad;
442
+ }()
443
+ /**
444
+ * 应用加载完成后触发的钩子函数
445
+ * @description 在应用完成加载后触发,可被子类覆盖以实现自定义后处理逻辑
446
+ * @returns {Promise<void>}
447
+ * @author zhiwei.Wang
448
+ */
449
+ )
450
+ }, {
451
+ key: "load",
452
+ value: (function () {
453
+ var _load3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(application) {
454
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
455
+ while (1) switch (_context9.prev = _context9.next) {
456
+ case 0:
457
+ case "end":
458
+ return _context9.stop();
459
+ }
460
+ }, _callee9);
461
+ }));
462
+ function load(_x7) {
463
+ return _load3.apply(this, arguments);
464
+ }
465
+ return load;
466
+ }())
467
+ }]);
468
+ return Application;
469
+ }();
@@ -0,0 +1,19 @@
1
+ import APP from '../app';
2
+ import { Application, ApplicationData } from './application';
3
+ export * from "./application";
4
+ export declare class ApplicationManager {
5
+ applicationList: Application[];
6
+ protected app: APP;
7
+ applications: Map<string, Application>;
8
+ constructor(applicationList: Application[], app: APP);
9
+ init(applicationList: Application[] | ApplicationData[]): Promise<unknown>;
10
+ add(application: Application): Promise<void>;
11
+ get(appName: Application['name']): Application | undefined;
12
+ remove(appName: Application['name']): void;
13
+ load(): Promise<void>;
14
+ /**
15
+ * 循环所有的应用, 找出所有的components进行渲染
16
+ * @returns
17
+ */
18
+ getAllComponents(): any[];
19
+ }