@pisell/pisellos 2.1.41 → 2.2.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 (121) hide show
  1. package/dist/core/index.d.ts +8 -1
  2. package/dist/core/index.js +116 -42
  3. package/dist/modules/Customer/index.js +1 -1
  4. package/dist/modules/Order/index.js +4 -4
  5. package/dist/modules/Order/types.d.ts +0 -1
  6. package/dist/modules/Product/types.d.ts +19 -0
  7. package/dist/modules/ProductList/index.js +3 -11
  8. package/dist/modules/Schedule/types.d.ts +2 -0
  9. package/dist/plugins/request.d.ts +19 -1
  10. package/dist/plugins/request.js +11 -0
  11. package/dist/server/index.d.ts +152 -0
  12. package/dist/server/index.js +946 -0
  13. package/dist/server/modules/index.d.ts +16 -0
  14. package/dist/server/modules/index.js +21 -0
  15. package/dist/server/modules/menu/index.d.ts +63 -0
  16. package/dist/server/modules/menu/index.js +476 -0
  17. package/dist/server/modules/menu/types.d.ts +68 -0
  18. package/dist/server/modules/menu/types.js +16 -0
  19. package/dist/server/modules/products/index.d.ts +141 -0
  20. package/dist/server/modules/products/index.js +774 -0
  21. package/dist/server/modules/products/types.d.ts +94 -0
  22. package/dist/server/modules/products/types.js +43 -0
  23. package/dist/server/modules/quotation/index.d.ts +47 -0
  24. package/dist/server/modules/quotation/index.js +367 -0
  25. package/dist/server/modules/quotation/types.d.ts +50 -0
  26. package/dist/server/modules/quotation/types.js +20 -0
  27. package/dist/server/modules/schedule/index.d.ts +62 -0
  28. package/dist/server/modules/schedule/index.js +431 -0
  29. package/dist/server/modules/schedule/types.d.ts +1 -0
  30. package/dist/server/modules/schedule/types.js +2 -0
  31. package/dist/server/modules/schedule/utils.d.ts +32 -0
  32. package/dist/server/modules/schedule/utils.js +747 -0
  33. package/dist/server/types.d.ts +64 -0
  34. package/dist/server/types.js +1 -0
  35. package/dist/server/utils/index.d.ts +5 -0
  36. package/dist/server/utils/index.js +6 -0
  37. package/dist/server/utils/product.d.ts +18 -0
  38. package/dist/server/utils/product.js +339 -0
  39. package/dist/server/utils/schedule.d.ts +14 -0
  40. package/dist/server/utils/schedule.js +108 -0
  41. package/dist/server/utils/time.d.ts +18 -0
  42. package/dist/server/utils/time.js +53 -0
  43. package/dist/solution/BookingByStep/index.d.ts +2 -22
  44. package/dist/solution/BookingByStep/index.js +29 -502
  45. package/dist/solution/BookingByStep/utils/capacity.d.ts +2 -7
  46. package/dist/solution/BookingByStep/utils/capacity.js +8 -24
  47. package/dist/solution/BookingTicket/index.d.ts +8 -0
  48. package/dist/solution/BookingTicket/index.js +105 -71
  49. package/dist/solution/ShopDiscount/index.js +9 -27
  50. package/dist/solution/index.d.ts +0 -1
  51. package/dist/solution/index.js +0 -1
  52. package/dist/types/index.d.ts +26 -0
  53. package/lib/core/index.d.ts +8 -1
  54. package/lib/core/index.js +48 -1
  55. package/lib/modules/Customer/index.js +1 -1
  56. package/lib/modules/Order/index.js +2 -5
  57. package/lib/modules/Order/types.d.ts +0 -1
  58. package/lib/modules/Product/types.d.ts +19 -0
  59. package/lib/modules/ProductList/index.js +2 -10
  60. package/lib/modules/Schedule/types.d.ts +2 -0
  61. package/lib/plugins/request.d.ts +19 -1
  62. package/lib/plugins/request.js +11 -1
  63. package/lib/server/index.d.ts +152 -0
  64. package/lib/server/index.js +555 -0
  65. package/lib/server/modules/index.d.ts +16 -0
  66. package/lib/server/modules/index.js +47 -0
  67. package/lib/server/modules/menu/index.d.ts +63 -0
  68. package/lib/server/modules/menu/index.js +234 -0
  69. package/lib/server/modules/menu/types.d.ts +68 -0
  70. package/lib/server/modules/menu/types.js +33 -0
  71. package/lib/server/modules/products/index.d.ts +141 -0
  72. package/lib/server/modules/products/index.js +442 -0
  73. package/lib/server/modules/products/types.d.ts +94 -0
  74. package/lib/server/modules/products/types.js +35 -0
  75. package/lib/server/modules/quotation/index.d.ts +47 -0
  76. package/lib/server/modules/quotation/index.js +177 -0
  77. package/lib/server/modules/quotation/types.d.ts +50 -0
  78. package/lib/server/modules/quotation/types.js +33 -0
  79. package/lib/server/modules/schedule/index.d.ts +62 -0
  80. package/lib/server/modules/schedule/index.js +231 -0
  81. package/lib/server/modules/schedule/types.d.ts +1 -0
  82. package/lib/server/modules/schedule/types.js +23 -0
  83. package/lib/server/modules/schedule/utils.d.ts +32 -0
  84. package/lib/server/modules/schedule/utils.js +451 -0
  85. package/lib/server/types.d.ts +64 -0
  86. package/lib/server/types.js +17 -0
  87. package/lib/server/utils/index.d.ts +5 -0
  88. package/lib/server/utils/index.js +25 -0
  89. package/lib/server/utils/product.d.ts +18 -0
  90. package/lib/server/utils/product.js +262 -0
  91. package/lib/server/utils/schedule.d.ts +14 -0
  92. package/lib/server/utils/schedule.js +88 -0
  93. package/lib/server/utils/time.d.ts +18 -0
  94. package/lib/server/utils/time.js +70 -0
  95. package/lib/solution/BookingByStep/index.d.ts +2 -22
  96. package/lib/solution/BookingByStep/index.js +42 -321
  97. package/lib/solution/BookingByStep/utils/capacity.d.ts +2 -7
  98. package/lib/solution/BookingByStep/utils/capacity.js +8 -21
  99. package/lib/solution/BookingTicket/index.d.ts +8 -0
  100. package/lib/solution/BookingTicket/index.js +13 -0
  101. package/lib/solution/ShopDiscount/index.js +0 -9
  102. package/lib/solution/index.d.ts +0 -1
  103. package/lib/solution/index.js +0 -2
  104. package/lib/types/index.d.ts +26 -0
  105. package/package.json +2 -2
  106. package/dist/solution/RegisterAndLogin/config.d.ts +0 -87
  107. package/dist/solution/RegisterAndLogin/config.js +0 -792
  108. package/dist/solution/RegisterAndLogin/index.d.ts +0 -189
  109. package/dist/solution/RegisterAndLogin/index.js +0 -2667
  110. package/dist/solution/RegisterAndLogin/types.d.ts +0 -444
  111. package/dist/solution/RegisterAndLogin/types.js +0 -231
  112. package/dist/solution/RegisterAndLogin/utils.d.ts +0 -95
  113. package/dist/solution/RegisterAndLogin/utils.js +0 -322
  114. package/lib/solution/RegisterAndLogin/config.d.ts +0 -87
  115. package/lib/solution/RegisterAndLogin/config.js +0 -594
  116. package/lib/solution/RegisterAndLogin/index.d.ts +0 -189
  117. package/lib/solution/RegisterAndLogin/index.js +0 -1593
  118. package/lib/solution/RegisterAndLogin/types.d.ts +0 -444
  119. package/lib/solution/RegisterAndLogin/types.js +0 -78
  120. package/lib/solution/RegisterAndLogin/utils.d.ts +0 -95
  121. package/lib/solution/RegisterAndLogin/utils.js +0 -279
@@ -1,4 +1,4 @@
1
- import { Plugin, PluginOptions, Module, ModuleOptions, PisellCore, PisellOSOptions, BusinessContext, ModuleContextConfig } from '../types';
1
+ import { Plugin, PluginOptions, Module, ModuleOptions, PisellCore, PisellOSOptions, BusinessContext, ModuleContextConfig, InitializeServerOptions } from '../types';
2
2
  import { EffectsManager } from '../effects';
3
3
  /**
4
4
  * pisell OS 核心实现
@@ -10,8 +10,15 @@ declare class PisellOSCore implements PisellCore {
10
10
  effects: EffectsManager;
11
11
  private debug;
12
12
  context: BusinessContext;
13
+ server: any;
14
+ private serverOptions?;
13
15
  constructor(options?: PisellOSOptions);
14
16
  private initialize;
17
+ /**
18
+ * 初始化 Server(公开方法,需要外部显式调用并等待)
19
+ * Server 配置从构造函数传入的 options.server 中获取
20
+ */
21
+ initializeServer(options?: InitializeServerOptions): Promise<void>;
15
22
  private log;
16
23
  registerPlugin(plugin: Plugin, options?: PluginOptions): void;
17
24
  getPlugin<T extends Plugin>(name: string): T | null;
@@ -1,16 +1,16 @@
1
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 _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; }
3
2
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
3
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5
4
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
5
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- 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); } }
8
- 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); }); }; }
9
6
  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; }
10
7
  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; }
11
8
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
12
9
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
10
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ 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; }
12
+ 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); } }
13
+ 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); }); }; }
14
14
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
15
  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); } }
16
16
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -24,6 +24,8 @@ import { EffectsManager } from "../effects";
24
24
  * pisell OS 核心实现
25
25
  */
26
26
  var PisellOSCore = /*#__PURE__*/function () {
27
+ // 保存 Server 配置
28
+
27
29
  function PisellOSCore(options) {
28
30
  _classCallCheck(this, PisellOSCore);
29
31
  _defineProperty(this, "plugins", new Map());
@@ -32,8 +34,16 @@ var PisellOSCore = /*#__PURE__*/function () {
32
34
  _defineProperty(this, "effects", new EffectsManager());
33
35
  _defineProperty(this, "debug", false);
34
36
  _defineProperty(this, "context", {});
37
+ _defineProperty(this, "server", void 0);
38
+ // Server 实例
39
+ _defineProperty(this, "serverOptions", void 0);
35
40
  this.debug = (options === null || options === void 0 ? void 0 : options.debug) || false;
36
41
  this.context = (options === null || options === void 0 ? void 0 : options.context) || {};
42
+
43
+ // 保存 Server 配置但不初始化
44
+ if (options !== null && options !== void 0 && options.server) {
45
+ this.serverOptions = options.server;
46
+ }
37
47
  this.initialize(options);
38
48
  }
39
49
  _createClass(PisellOSCore, [{
@@ -50,10 +60,74 @@ var PisellOSCore = /*#__PURE__*/function () {
50
60
  _this.registerModule(item.module, item.options);
51
61
  });
52
62
  }
53
- this.log('PisellOS 核心初始化完成');
63
+ this.log('[PisellOS] 核心初始化完成');
54
64
  }
55
65
 
56
- // 日志方法
66
+ /**
67
+ * 初始化 Server(公开方法,需要外部显式调用并等待)
68
+ * Server 配置从构造函数传入的 options.server 中获取
69
+ */
70
+ }, {
71
+ key: "initializeServer",
72
+ value: (function () {
73
+ var _initializeServer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
74
+ var ServerModule, Server;
75
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
76
+ while (1) switch (_context.prev = _context.next) {
77
+ case 0:
78
+ if (!this.server) {
79
+ _context.next = 3;
80
+ break;
81
+ }
82
+ this.log('Server 已经初始化,跳过重复初始化', 'warn');
83
+ return _context.abrupt("return");
84
+ case 3:
85
+ if (this.serverOptions) {
86
+ _context.next = 6;
87
+ break;
88
+ }
89
+ this.log('未提供 Server 配置,无法初始化', 'warn');
90
+ return _context.abrupt("return");
91
+ case 6:
92
+ _context.prev = 6;
93
+ _context.next = 9;
94
+ return import("../server");
95
+ case 9:
96
+ ServerModule = _context.sent;
97
+ Server = ServerModule.default; // 创建 Server 实例
98
+ this.server = new Server(this);
99
+ this.log('Server 实例已创建');
100
+
101
+ // 初始化模块并预加载数据
102
+ if (!this.serverOptions.modules) {
103
+ _context.next = 16;
104
+ break;
105
+ }
106
+ _context.next = 16;
107
+ return this.server.initialize(this.serverOptions.modules, this.serverOptions.autoInitData !== false, options);
108
+ case 16:
109
+ console.log('[PisellOS] ✅ Server 初始化完成,所有数据已预加载');
110
+ this.log('[PisellOS] Server 初始化完成');
111
+ _context.next = 25;
112
+ break;
113
+ case 20:
114
+ _context.prev = 20;
115
+ _context.t0 = _context["catch"](6);
116
+ console.error('[PisellOS] ❌ Server 初始化失败:', _context.t0);
117
+ this.log("Server \u521D\u59CB\u5316\u5931\u8D25: ".concat(_context.t0), 'error');
118
+ throw _context.t0;
119
+ case 25:
120
+ case "end":
121
+ return _context.stop();
122
+ }
123
+ }, _callee, this, [[6, 20]]);
124
+ }));
125
+ function initializeServer(_x) {
126
+ return _initializeServer.apply(this, arguments);
127
+ }
128
+ return initializeServer;
129
+ }() // 日志方法
130
+ )
57
131
  }, {
58
132
  key: "log",
59
133
  value: function log(message) {
@@ -229,100 +303,100 @@ var PisellOSCore = /*#__PURE__*/function () {
229
303
  }, {
230
304
  key: "destroy",
231
305
  value: function () {
232
- var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
306
+ var _destroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
233
307
  var _iterator4, _step4, _step4$value, name, module, _iterator5, _step5, _step5$value, _name, plugin;
234
- return _regeneratorRuntime().wrap(function _callee$(_context) {
235
- while (1) switch (_context.prev = _context.next) {
308
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
309
+ while (1) switch (_context2.prev = _context2.next) {
236
310
  case 0:
237
311
  // 先销毁模块
238
312
  _iterator4 = _createForOfIteratorHelper(this.modules.entries());
239
- _context.prev = 1;
313
+ _context2.prev = 1;
240
314
  _iterator4.s();
241
315
  case 3:
242
316
  if ((_step4 = _iterator4.n()).done) {
243
- _context.next = 17;
317
+ _context2.next = 17;
244
318
  break;
245
319
  }
246
320
  _step4$value = _slicedToArray(_step4.value, 2), name = _step4$value[0], module = _step4$value[1];
247
321
  if (!module.destroy) {
248
- _context.next = 15;
322
+ _context2.next = 15;
249
323
  break;
250
324
  }
251
- _context.prev = 6;
252
- _context.next = 9;
325
+ _context2.prev = 6;
326
+ _context2.next = 9;
253
327
  return Promise.resolve(module.destroy());
254
328
  case 9:
255
329
  this.log("\u6A21\u5757 ".concat(name, " \u5DF2\u9500\u6BC1"));
256
- _context.next = 15;
330
+ _context2.next = 15;
257
331
  break;
258
332
  case 12:
259
- _context.prev = 12;
260
- _context.t0 = _context["catch"](6);
261
- this.log("\u9500\u6BC1\u6A21\u5757 ".concat(name, " \u65F6\u51FA\u9519: ").concat(_context.t0), 'error');
333
+ _context2.prev = 12;
334
+ _context2.t0 = _context2["catch"](6);
335
+ this.log("\u9500\u6BC1\u6A21\u5757 ".concat(name, " \u65F6\u51FA\u9519: ").concat(_context2.t0), 'error');
262
336
  case 15:
263
- _context.next = 3;
337
+ _context2.next = 3;
264
338
  break;
265
339
  case 17:
266
- _context.next = 22;
340
+ _context2.next = 22;
267
341
  break;
268
342
  case 19:
269
- _context.prev = 19;
270
- _context.t1 = _context["catch"](1);
271
- _iterator4.e(_context.t1);
343
+ _context2.prev = 19;
344
+ _context2.t1 = _context2["catch"](1);
345
+ _iterator4.e(_context2.t1);
272
346
  case 22:
273
- _context.prev = 22;
347
+ _context2.prev = 22;
274
348
  _iterator4.f();
275
- return _context.finish(22);
349
+ return _context2.finish(22);
276
350
  case 25:
277
351
  this.modules.clear();
278
352
 
279
353
  // 再销毁插件
280
354
  _iterator5 = _createForOfIteratorHelper(this.plugins.entries());
281
- _context.prev = 27;
355
+ _context2.prev = 27;
282
356
  _iterator5.s();
283
357
  case 29:
284
358
  if ((_step5 = _iterator5.n()).done) {
285
- _context.next = 43;
359
+ _context2.next = 43;
286
360
  break;
287
361
  }
288
362
  _step5$value = _slicedToArray(_step5.value, 2), _name = _step5$value[0], plugin = _step5$value[1];
289
363
  if (!plugin.destroy) {
290
- _context.next = 41;
364
+ _context2.next = 41;
291
365
  break;
292
366
  }
293
- _context.prev = 32;
294
- _context.next = 35;
367
+ _context2.prev = 32;
368
+ _context2.next = 35;
295
369
  return Promise.resolve(plugin.destroy());
296
370
  case 35:
297
371
  this.log("\u63D2\u4EF6 ".concat(_name, " \u5DF2\u9500\u6BC1"));
298
- _context.next = 41;
372
+ _context2.next = 41;
299
373
  break;
300
374
  case 38:
301
- _context.prev = 38;
302
- _context.t2 = _context["catch"](32);
303
- this.log("\u9500\u6BC1\u63D2\u4EF6 ".concat(_name, " \u65F6\u51FA\u9519: ").concat(_context.t2), 'error');
375
+ _context2.prev = 38;
376
+ _context2.t2 = _context2["catch"](32);
377
+ this.log("\u9500\u6BC1\u63D2\u4EF6 ".concat(_name, " \u65F6\u51FA\u9519: ").concat(_context2.t2), 'error');
304
378
  case 41:
305
- _context.next = 29;
379
+ _context2.next = 29;
306
380
  break;
307
381
  case 43:
308
- _context.next = 48;
382
+ _context2.next = 48;
309
383
  break;
310
384
  case 45:
311
- _context.prev = 45;
312
- _context.t3 = _context["catch"](27);
313
- _iterator5.e(_context.t3);
385
+ _context2.prev = 45;
386
+ _context2.t3 = _context2["catch"](27);
387
+ _iterator5.e(_context2.t3);
314
388
  case 48:
315
- _context.prev = 48;
389
+ _context2.prev = 48;
316
390
  _iterator5.f();
317
- return _context.finish(48);
391
+ return _context2.finish(48);
318
392
  case 51:
319
393
  this.plugins.clear();
320
394
  this.log('PisellOS 核心已销毁');
321
395
  case 53:
322
396
  case "end":
323
- return _context.stop();
397
+ return _context2.stop();
324
398
  }
325
- }, _callee, this, [[1, 19, 22, 25], [6, 12], [27, 45, 48, 51], [32, 38]]);
399
+ }, _callee2, this, [[1, 19, 22, 25], [6, 12], [27, 45, 48, 51], [32, 38]]);
326
400
  }));
327
401
  function destroy() {
328
402
  return _destroy.apply(this, arguments);
@@ -153,7 +153,7 @@ export var CustomerModule = /*#__PURE__*/function (_BaseModule) {
153
153
  skip: skip,
154
154
  num: num,
155
155
  sort_by: SORT_BY,
156
- with: ['latestWalletDetail.wallet', 'contactsInfo'],
156
+ with: ['latestWalletDetail.wallet'],
157
157
  search_wallet_flag: 1,
158
158
  search_wallet_pass_flag: 1
159
159
  }, search && {
@@ -1,12 +1,12 @@
1
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 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; }
3
+ 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; }
2
4
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
5
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
6
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5
7
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
6
8
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
7
9
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
- 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; }
9
- 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; }
10
10
  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; }
11
11
  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); } }
12
12
  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); }); }; }
@@ -122,7 +122,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
122
122
  }, {
123
123
  key: "createOrder",
124
124
  value: function createOrder(params) {
125
- var order = _objectSpread({
125
+ var order = {
126
126
  type: (params === null || params === void 0 ? void 0 : params.type) || 'appointment_booking',
127
127
  // 要从外面拿,virtual
128
128
  platform: (params === null || params === void 0 ? void 0 : params.platform) === 'pc' ? 'PC' : 'H5',
@@ -134,7 +134,7 @@ export var OrderModule = /*#__PURE__*/function (_BaseModule) {
134
134
  is_deposit: 0,
135
135
  relation_products: [],
136
136
  relation_forms: []
137
- }, (params === null || params === void 0 ? void 0 : params.extraData) || {});
137
+ };
138
138
  var is_deposit = 0; // 是否存在定金,0 不存在,1 存在
139
139
  if (params.cartItems.length > 0) {
140
140
  params.cartItems.forEach(function (item) {
@@ -16,7 +16,6 @@ export interface CommitOrderParams {
16
16
  cartItems: CartItem[];
17
17
  type: 'virtual' | 'appointment_booking';
18
18
  platform?: 'pc' | 'h5';
19
- extraData?: Record<string, any>;
20
19
  };
21
20
  }
22
21
  /**
@@ -1,3 +1,14 @@
1
+ /**
2
+ * 商品集合接口
3
+ */
4
+ export interface ProductCollection {
5
+ /** 商品集合id */
6
+ id: number;
7
+ /** 商品集合名称 */
8
+ title: string;
9
+ /** 商品集合封面 */
10
+ cover: string;
11
+ }
1
12
  /**
2
13
  * 商品基本信息接口
3
14
  */
@@ -8,6 +19,8 @@ export interface ProductData {
8
19
  id: number;
9
20
  /** 商品所属账户id */
10
21
  account_id: number | string;
22
+ /** 商品集合 */
23
+ collection?: ProductCollection[];
11
24
  /** 扩展类型id */
12
25
  extension_id: number;
13
26
  /** 扩展类型 */
@@ -189,6 +202,12 @@ export interface ProductData {
189
202
  };
190
203
  /** 购物车行键,用于唯一标识购物车中的商品,用于相同 SKU商品合并 */
191
204
  rowKey?: string;
205
+ /** 套餐组数量 */
206
+ bundle_group_count: number;
207
+ /** 选项组数量 */
208
+ option_group_count: number;
209
+ /** 服务时长 */
210
+ service_times?: any;
192
211
  }
193
212
  /**
194
213
  * 商品媒体信息接口
@@ -129,28 +129,20 @@ export var ProductList = /*#__PURE__*/function (_BaseModule) {
129
129
  with_count: with_count,
130
130
  // client_schedule_ids: schedule_ids,
131
131
  schedule_date: schedule_date,
132
- application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel,
133
132
  with_schedule: with_schedule,
134
133
  schedule_datetime: schedule_datetime,
135
- is_eject: 1
134
+ application_code: (_this$otherParams = this.otherParams) === null || _this$otherParams === void 0 ? void 0 : _this$otherParams.channel
136
135
  }, {
137
- useCache: true
136
+ osServer: true
138
137
  });
139
138
  case 6:
140
139
  productsData = _context3.sent;
141
140
  sortedList = (productsData.data.list || []).slice().sort(function (a, b) {
142
141
  return Number(b.sort) - Number(a.sort);
143
142
  });
144
- if (sortedList.length) {
145
- sortedList.forEach(function (n) {
146
- if (n.is_eject !== 1 && n['schedule.ids'] && n['schedule.ids'].length) {
147
- n.is_eject = 1;
148
- }
149
- });
150
- }
151
143
  this.addProduct(sortedList);
152
144
  return _context3.abrupt("return", sortedList);
153
- case 11:
145
+ case 10:
154
146
  case "end":
155
147
  return _context3.stop();
156
148
  }
@@ -1,6 +1,8 @@
1
1
  import dayjs from 'dayjs';
2
2
  export interface ScheduleState {
3
3
  scheduleList: ScheduleItem[];
4
+ /** 日程 Map 缓存(以 id 为 key,加速查询) */
5
+ map: Map<number, ScheduleItem>;
4
6
  availabilityDateList: ScheduleAvailabilityDateItem[];
5
7
  otherProductsIds: number[];
6
8
  }
@@ -35,6 +35,23 @@ export interface RequestPlugin extends Plugin {
35
35
  */
36
36
  request: <T = any>(options: RequestOptions) => Promise<T>;
37
37
  }
38
+ export declare enum RequestModeENUM {
39
+ LOCAL = "local",
40
+ REMOTE = "remote",
41
+ LOCAL_REMOTE = "local_remote",
42
+ REMOTE_LOCAL = "remote_local",
43
+ OS_SERVER = "os_server"
44
+ }
45
+ export type RequestModeType = RequestModeENUM.LOCAL | RequestModeENUM.REMOTE | RequestModeENUM.LOCAL_REMOTE | RequestModeENUM.REMOTE_LOCAL | RequestModeENUM.OS_SERVER;
46
+ export type CacheType = 'memory' | 'storage' | 'indexDB';
47
+ export interface CacheProps {
48
+ key?: string;
49
+ type?: CacheType;
50
+ updateCache?: boolean;
51
+ cacheUpdateChange?: (data: any) => void;
52
+ mode?: RequestModeType;
53
+ cacheKeyData?: any;
54
+ }
38
55
  /**
39
56
  * 请求配置
40
57
  */
@@ -49,7 +66,8 @@ export interface RequestOptions {
49
66
  responseType?: 'json' | 'text' | 'arraybuffer' | 'blob';
50
67
  withCredentials?: boolean;
51
68
  useCache?: boolean;
52
- customToast?: () => void;
69
+ cache?: CacheProps;
70
+ osServer?: boolean;
53
71
  }
54
72
  /**
55
73
  * 响应接口
@@ -31,6 +31,17 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
31
31
  * RequestPlugin 接口定义
32
32
  */
33
33
 
34
+ export var RequestModeENUM = /*#__PURE__*/function (RequestModeENUM) {
35
+ RequestModeENUM["LOCAL"] = "local";
36
+ RequestModeENUM["REMOTE"] = "remote";
37
+ RequestModeENUM["LOCAL_REMOTE"] = "local_remote";
38
+ RequestModeENUM["REMOTE_LOCAL"] = "remote_local";
39
+ RequestModeENUM["OS_SERVER"] = "os_server";
40
+ return RequestModeENUM;
41
+ }({});
42
+
43
+ // 请求模式
44
+
34
45
  /**
35
46
  * 请求配置
36
47
  */