@pisell/pisellos 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +180 -0
- package/dist/core/index.d.ts +30 -0
- package/dist/core/index.js +360 -0
- package/dist/effects/index.d.ts +17 -0
- package/dist/effects/index.js +162 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +17 -0
- package/dist/modules/Account/index.d.ts +21 -0
- package/dist/modules/Account/index.js +212 -0
- package/dist/modules/Account/types.d.ts +41 -0
- package/dist/modules/Account/types.js +19 -0
- package/dist/modules/BaseModule.d.ts +11 -0
- package/dist/modules/BaseModule.js +27 -0
- package/dist/modules/Cart/index.d.ts +33 -0
- package/dist/modules/Cart/index.js +242 -0
- package/dist/modules/Cart/types.d.ts +35 -0
- package/dist/modules/Cart/types.js +19 -0
- package/dist/modules/Date/index.d.ts +17 -0
- package/dist/modules/Date/index.js +133 -0
- package/dist/modules/Date/types.d.ts +32 -0
- package/dist/modules/Date/types.js +17 -0
- package/dist/modules/Guests/index.d.ts +17 -0
- package/dist/modules/Guests/index.js +259 -0
- package/dist/modules/Guests/types.d.ts +43 -0
- package/dist/modules/Guests/types.js +23 -0
- package/dist/modules/Order/index.d.ts +17 -0
- package/dist/modules/Order/index.js +228 -0
- package/dist/modules/Order/types.d.ts +57 -0
- package/dist/modules/Order/types.js +29 -0
- package/dist/modules/Payment/index.d.ts +18 -0
- package/dist/modules/Payment/index.js +243 -0
- package/dist/modules/Payment/types.d.ts +49 -0
- package/dist/modules/Payment/types.js +31 -0
- package/dist/modules/Product/index.d.ts +39 -0
- package/dist/modules/Product/index.js +118 -0
- package/dist/modules/Product/types.d.ts +387 -0
- package/dist/modules/Product/types.js +1 -0
- package/dist/modules/ProductList/index.d.ts +16 -0
- package/dist/modules/ProductList/index.js +158 -0
- package/dist/modules/ProductList/types.d.ts +9 -0
- package/dist/modules/ProductList/types.js +5 -0
- package/dist/modules/Resource/index.d.ts +15 -0
- package/dist/modules/Resource/index.js +219 -0
- package/dist/modules/Resource/types.d.ts +44 -0
- package/dist/modules/Resource/types.js +22 -0
- package/dist/modules/index.d.ts +3 -0
- package/dist/modules/index.js +3 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.js +2 -0
- package/dist/plugins/request.d.ts +127 -0
- package/dist/plugins/request.js +592 -0
- package/dist/plugins/window.d.ts +115 -0
- package/dist/plugins/window.js +328 -0
- package/dist/solution/BookingByStep/index.d.ts +12 -0
- package/dist/solution/BookingByStep/index.js +77 -0
- package/dist/solution/BookingByStep/types.d.ts +27 -0
- package/dist/solution/BookingByStep/types.js +10 -0
- package/dist/solution/BuyTickets/index.d.ts +26 -0
- package/dist/solution/BuyTickets/index.js +339 -0
- package/dist/solution/BuyTickets/types.d.ts +24 -0
- package/dist/solution/BuyTickets/types.js +19 -0
- package/dist/solution/PlaceOrder/index.d.ts +0 -0
- package/dist/solution/PlaceOrder/index.js +54 -0
- package/dist/solution/index.d.ts +1 -0
- package/dist/solution/index.js +1 -0
- package/dist/store/createStore.d.ts +3 -0
- package/dist/store/createStore.js +43 -0
- package/dist/types/index.d.ts +85 -0
- package/dist/types/index.js +1 -0
- package/lib/core/index.d.ts +30 -0
- package/lib/core/index.js +212 -0
- package/lib/effects/index.d.ts +17 -0
- package/lib/effects/index.js +78 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +51 -0
- package/lib/modules/Account/index.d.ts +21 -0
- package/lib/modules/Account/index.js +93 -0
- package/lib/modules/Account/types.d.ts +41 -0
- package/lib/modules/Account/types.js +35 -0
- package/lib/modules/BaseModule.d.ts +11 -0
- package/lib/modules/BaseModule.js +40 -0
- package/lib/modules/Cart/index.d.ts +33 -0
- package/lib/modules/Cart/index.js +104 -0
- package/lib/modules/Cart/types.d.ts +35 -0
- package/lib/modules/Cart/types.js +35 -0
- package/lib/modules/Date/index.d.ts +17 -0
- package/lib/modules/Date/index.js +75 -0
- package/lib/modules/Date/types.d.ts +32 -0
- package/lib/modules/Date/types.js +33 -0
- package/lib/modules/Guests/index.d.ts +17 -0
- package/lib/modules/Guests/index.js +95 -0
- package/lib/modules/Guests/types.d.ts +43 -0
- package/lib/modules/Guests/types.js +35 -0
- package/lib/modules/Order/index.d.ts +17 -0
- package/lib/modules/Order/index.js +95 -0
- package/lib/modules/Order/types.d.ts +57 -0
- package/lib/modules/Order/types.js +35 -0
- package/lib/modules/Payment/index.d.ts +18 -0
- package/lib/modules/Payment/index.js +103 -0
- package/lib/modules/Payment/types.d.ts +49 -0
- package/lib/modules/Payment/types.js +35 -0
- package/lib/modules/Product/index.d.ts +39 -0
- package/lib/modules/Product/index.js +87 -0
- package/lib/modules/Product/types.d.ts +387 -0
- package/lib/modules/Product/types.js +17 -0
- package/lib/modules/ProductList/index.d.ts +16 -0
- package/lib/modules/ProductList/index.js +71 -0
- package/lib/modules/ProductList/types.d.ts +9 -0
- package/lib/modules/ProductList/types.js +33 -0
- package/lib/modules/Resource/index.d.ts +15 -0
- package/lib/modules/Resource/index.js +91 -0
- package/lib/modules/Resource/types.d.ts +44 -0
- package/lib/modules/Resource/types.js +34 -0
- package/lib/modules/index.d.ts +3 -0
- package/lib/modules/index.js +27 -0
- package/lib/plugins/index.d.ts +2 -0
- package/lib/plugins/index.js +25 -0
- package/lib/plugins/request.d.ts +127 -0
- package/lib/plugins/request.js +297 -0
- package/lib/plugins/window.d.ts +115 -0
- package/lib/plugins/window.js +252 -0
- package/lib/solution/BookingByStep/index.d.ts +12 -0
- package/lib/solution/BookingByStep/index.js +53 -0
- package/lib/solution/BookingByStep/types.d.ts +27 -0
- package/lib/solution/BookingByStep/types.js +38 -0
- package/lib/solution/BuyTickets/index.d.ts +26 -0
- package/lib/solution/BuyTickets/index.js +122 -0
- package/lib/solution/BuyTickets/types.d.ts +24 -0
- package/lib/solution/BuyTickets/types.js +40 -0
- package/lib/solution/PlaceOrder/index.d.ts +0 -0
- package/lib/solution/PlaceOrder/index.js +0 -0
- package/lib/solution/index.d.ts +1 -0
- package/lib/solution/index.js +23 -0
- package/lib/store/createStore.d.ts +3 -0
- package/lib/store/createStore.js +46 -0
- package/lib/types/index.d.ts +85 -0
- package/lib/types/index.js +17 -0
- package/package.json +65 -0
|
@@ -0,0 +1,219 @@
|
|
|
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
|
+
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 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); } }
|
|
6
|
+
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); }); }; }
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
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); } }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
11
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
13
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
14
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
15
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
17
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
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); }
|
|
20
|
+
import { BaseModule } from "../BaseModule";
|
|
21
|
+
import { ResourceHooks } from "./types";
|
|
22
|
+
export var ResourceListModule = /*#__PURE__*/function (_BaseModule) {
|
|
23
|
+
_inherits(ResourceListModule, _BaseModule);
|
|
24
|
+
var _super = _createSuper(ResourceListModule);
|
|
25
|
+
function ResourceListModule() {
|
|
26
|
+
var _this;
|
|
27
|
+
_classCallCheck(this, ResourceListModule);
|
|
28
|
+
_this = _super.call(this, 'resource', '1.0.0');
|
|
29
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
30
|
+
list: [],
|
|
31
|
+
selectedResource: null
|
|
32
|
+
});
|
|
33
|
+
return _this;
|
|
34
|
+
}
|
|
35
|
+
_createClass(ResourceListModule, [{
|
|
36
|
+
key: "initialize",
|
|
37
|
+
value: function () {
|
|
38
|
+
var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
|
|
39
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
40
|
+
while (1) switch (_context.prev = _context.next) {
|
|
41
|
+
case 0:
|
|
42
|
+
this.core = core;
|
|
43
|
+
if (options !== null && options !== void 0 && options.initialState) {
|
|
44
|
+
this.state = _objectSpread(_objectSpread({}, this.state), options.initialState);
|
|
45
|
+
}
|
|
46
|
+
case 2:
|
|
47
|
+
case "end":
|
|
48
|
+
return _context.stop();
|
|
49
|
+
}
|
|
50
|
+
}, _callee, this);
|
|
51
|
+
}));
|
|
52
|
+
function initialize(_x, _x2) {
|
|
53
|
+
return _initialize.apply(this, arguments);
|
|
54
|
+
}
|
|
55
|
+
return initialize;
|
|
56
|
+
}()
|
|
57
|
+
}, {
|
|
58
|
+
key: "getResources",
|
|
59
|
+
value: function () {
|
|
60
|
+
var _getResources = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
61
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
62
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
63
|
+
case 0:
|
|
64
|
+
return _context2.abrupt("return", this.state.list);
|
|
65
|
+
case 1:
|
|
66
|
+
case "end":
|
|
67
|
+
return _context2.stop();
|
|
68
|
+
}
|
|
69
|
+
}, _callee2, this);
|
|
70
|
+
}));
|
|
71
|
+
function getResources() {
|
|
72
|
+
return _getResources.apply(this, arguments);
|
|
73
|
+
}
|
|
74
|
+
return getResources;
|
|
75
|
+
}()
|
|
76
|
+
}, {
|
|
77
|
+
key: "selectResource",
|
|
78
|
+
value: function () {
|
|
79
|
+
var _selectResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resourceId) {
|
|
80
|
+
var resource;
|
|
81
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
82
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
83
|
+
case 0:
|
|
84
|
+
resource = this.state.list.find(function (r) {
|
|
85
|
+
return r.id === resourceId;
|
|
86
|
+
});
|
|
87
|
+
if (resource) {
|
|
88
|
+
_context3.next = 3;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
return _context3.abrupt("return");
|
|
92
|
+
case 3:
|
|
93
|
+
this.state.selectedResource = resource;
|
|
94
|
+
_context3.next = 6;
|
|
95
|
+
return this.core.effects.emit(ResourceHooks.OnResourceSelect, resource);
|
|
96
|
+
case 6:
|
|
97
|
+
case "end":
|
|
98
|
+
return _context3.stop();
|
|
99
|
+
}
|
|
100
|
+
}, _callee3, this);
|
|
101
|
+
}));
|
|
102
|
+
function selectResource(_x3) {
|
|
103
|
+
return _selectResource.apply(this, arguments);
|
|
104
|
+
}
|
|
105
|
+
return selectResource;
|
|
106
|
+
}()
|
|
107
|
+
}, {
|
|
108
|
+
key: "getSelectedResource",
|
|
109
|
+
value: function getSelectedResource() {
|
|
110
|
+
return this.state.selectedResource;
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
key: "checkAvailability",
|
|
114
|
+
value: function () {
|
|
115
|
+
var _checkAvailability = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(resourceId, start, end) {
|
|
116
|
+
var resource;
|
|
117
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
118
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
119
|
+
case 0:
|
|
120
|
+
resource = this.state.list.find(function (r) {
|
|
121
|
+
return r.id === resourceId;
|
|
122
|
+
});
|
|
123
|
+
if (resource) {
|
|
124
|
+
_context4.next = 3;
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
return _context4.abrupt("return", false);
|
|
128
|
+
case 3:
|
|
129
|
+
return _context4.abrupt("return", resource.timeSlots.some(function (slot) {
|
|
130
|
+
return slot.start.getTime() <= start.getTime() && slot.end.getTime() >= end.getTime() && slot.availableCapacity > 0;
|
|
131
|
+
}));
|
|
132
|
+
case 4:
|
|
133
|
+
case "end":
|
|
134
|
+
return _context4.stop();
|
|
135
|
+
}
|
|
136
|
+
}, _callee4, this);
|
|
137
|
+
}));
|
|
138
|
+
function checkAvailability(_x4, _x5, _x6) {
|
|
139
|
+
return _checkAvailability.apply(this, arguments);
|
|
140
|
+
}
|
|
141
|
+
return checkAvailability;
|
|
142
|
+
}()
|
|
143
|
+
}, {
|
|
144
|
+
key: "getAvailableTimeSlots",
|
|
145
|
+
value: function () {
|
|
146
|
+
var _getAvailableTimeSlots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(resourceId) {
|
|
147
|
+
var resource;
|
|
148
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
149
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
resource = this.state.list.find(function (r) {
|
|
152
|
+
return r.id === resourceId;
|
|
153
|
+
});
|
|
154
|
+
if (resource) {
|
|
155
|
+
_context5.next = 3;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
return _context5.abrupt("return", []);
|
|
159
|
+
case 3:
|
|
160
|
+
return _context5.abrupt("return", resource.timeSlots.filter(function (slot) {
|
|
161
|
+
return slot.availableCapacity > 0;
|
|
162
|
+
}));
|
|
163
|
+
case 4:
|
|
164
|
+
case "end":
|
|
165
|
+
return _context5.stop();
|
|
166
|
+
}
|
|
167
|
+
}, _callee5, this);
|
|
168
|
+
}));
|
|
169
|
+
function getAvailableTimeSlots(_x7) {
|
|
170
|
+
return _getAvailableTimeSlots.apply(this, arguments);
|
|
171
|
+
}
|
|
172
|
+
return getAvailableTimeSlots;
|
|
173
|
+
}()
|
|
174
|
+
}, {
|
|
175
|
+
key: "getAvailableCapacity",
|
|
176
|
+
value: function getAvailableCapacity(resourceId, timeSlot) {
|
|
177
|
+
var resource = this.state.list.find(function (r) {
|
|
178
|
+
return r.id === resourceId;
|
|
179
|
+
});
|
|
180
|
+
if (!resource) return 0;
|
|
181
|
+
var slot = resource.timeSlots.find(function (s) {
|
|
182
|
+
return s.start.getTime() === timeSlot.start.getTime() && s.end.getTime() === timeSlot.end.getTime();
|
|
183
|
+
});
|
|
184
|
+
return (slot === null || slot === void 0 ? void 0 : slot.availableCapacity) || 0;
|
|
185
|
+
}
|
|
186
|
+
}, {
|
|
187
|
+
key: "updateResource",
|
|
188
|
+
value: function () {
|
|
189
|
+
var _updateResource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(resourceId, updates) {
|
|
190
|
+
var index;
|
|
191
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
192
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
193
|
+
case 0:
|
|
194
|
+
index = this.state.list.findIndex(function (r) {
|
|
195
|
+
return r.id === resourceId;
|
|
196
|
+
});
|
|
197
|
+
if (!(index === -1)) {
|
|
198
|
+
_context6.next = 3;
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
return _context6.abrupt("return");
|
|
202
|
+
case 3:
|
|
203
|
+
this.state.list[index] = _objectSpread(_objectSpread({}, this.state.list[index]), updates);
|
|
204
|
+
_context6.next = 6;
|
|
205
|
+
return this.core.effects.emit(ResourceHooks.OnResourceChange, this.state.list[index]);
|
|
206
|
+
case 6:
|
|
207
|
+
case "end":
|
|
208
|
+
return _context6.stop();
|
|
209
|
+
}
|
|
210
|
+
}, _callee6, this);
|
|
211
|
+
}));
|
|
212
|
+
function updateResource(_x8, _x9) {
|
|
213
|
+
return _updateResource.apply(this, arguments);
|
|
214
|
+
}
|
|
215
|
+
return updateResource;
|
|
216
|
+
}()
|
|
217
|
+
}]);
|
|
218
|
+
return ResourceListModule;
|
|
219
|
+
}(BaseModule);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare enum ResourceHooks {
|
|
2
|
+
OnResourceSelect = "resource:onResourceSelect",
|
|
3
|
+
OnResourceChange = "resource:onResourceChange",
|
|
4
|
+
OnAvailabilityCheck = "resource:onAvailabilityCheck"
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* 资源可用时间段
|
|
8
|
+
*/
|
|
9
|
+
export interface ResourceTimeSlot {
|
|
10
|
+
start: Date;
|
|
11
|
+
end: Date;
|
|
12
|
+
capacity: number;
|
|
13
|
+
availableCapacity: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 资源信息
|
|
17
|
+
*/
|
|
18
|
+
export interface Resource {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
type: string;
|
|
22
|
+
capacity: number;
|
|
23
|
+
timeSlots: ResourceTimeSlot[];
|
|
24
|
+
metadata?: Record<string, any>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* 资源列表状态
|
|
28
|
+
*/
|
|
29
|
+
export interface ResourceState {
|
|
30
|
+
list: Resource[];
|
|
31
|
+
selectedResource: Resource | null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 资源列表模块 API
|
|
35
|
+
*/
|
|
36
|
+
export interface ResourceListModuleAPI {
|
|
37
|
+
getResources: () => Promise<Resource[]>;
|
|
38
|
+
selectResource: (resourceId: string) => Promise<void>;
|
|
39
|
+
getSelectedResource: () => Resource | null;
|
|
40
|
+
checkAvailability: (resourceId: string, start: Date, end: Date) => Promise<boolean>;
|
|
41
|
+
getAvailableTimeSlots: (resourceId: string) => Promise<ResourceTimeSlot[]>;
|
|
42
|
+
getAvailableCapacity: (resourceId: string, timeSlot: ResourceTimeSlot) => number;
|
|
43
|
+
updateResource: (resourceId: string, updates: Partial<Resource>) => Promise<void>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export var ResourceHooks = /*#__PURE__*/function (ResourceHooks) {
|
|
2
|
+
ResourceHooks["OnResourceSelect"] = "resource:onResourceSelect";
|
|
3
|
+
ResourceHooks["OnResourceChange"] = "resource:onResourceChange";
|
|
4
|
+
ResourceHooks["OnAvailabilityCheck"] = "resource:onAvailabilityCheck";
|
|
5
|
+
return ResourceHooks;
|
|
6
|
+
}({});
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* 资源可用时间段
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 资源信息
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 资源列表状态
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 资源列表模块 API
|
|
22
|
+
*/
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Plugin } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* RequestPlugin 接口定义
|
|
4
|
+
*/
|
|
5
|
+
export interface RequestPlugin extends Plugin {
|
|
6
|
+
/**
|
|
7
|
+
* 发起 GET 请求
|
|
8
|
+
* @param url 请求地址
|
|
9
|
+
* @param options 请求选项
|
|
10
|
+
*/
|
|
11
|
+
get: <T = any>(url: string, options?: RequestOptions) => Promise<T>;
|
|
12
|
+
/**
|
|
13
|
+
* 发起 POST 请求
|
|
14
|
+
* @param url 请求地址
|
|
15
|
+
* @param data 请求数据
|
|
16
|
+
* @param options 请求选项
|
|
17
|
+
*/
|
|
18
|
+
post: <T = any>(url: string, data?: any, options?: RequestOptions) => Promise<T>;
|
|
19
|
+
/**
|
|
20
|
+
* 发起 PUT 请求
|
|
21
|
+
* @param url 请求地址
|
|
22
|
+
* @param data 请求数据
|
|
23
|
+
* @param options 请求选项
|
|
24
|
+
*/
|
|
25
|
+
put: <T = any>(url: string, data?: any, options?: RequestOptions) => Promise<T>;
|
|
26
|
+
/**
|
|
27
|
+
* 发起 DELETE 请求
|
|
28
|
+
* @param url 请求地址
|
|
29
|
+
* @param options 请求选项
|
|
30
|
+
*/
|
|
31
|
+
delete: <T = any>(url: string, options?: RequestOptions) => Promise<T>;
|
|
32
|
+
/**
|
|
33
|
+
* 通用请求方法
|
|
34
|
+
* @param options 完整的请求选项
|
|
35
|
+
*/
|
|
36
|
+
request: <T = any>(options: RequestOptions) => Promise<T>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 请求配置
|
|
40
|
+
*/
|
|
41
|
+
export interface RequestOptions {
|
|
42
|
+
url?: string;
|
|
43
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
44
|
+
headers?: Record<string, string>;
|
|
45
|
+
data?: any;
|
|
46
|
+
body?: any;
|
|
47
|
+
params?: Record<string, string | number | boolean>;
|
|
48
|
+
timeout?: number;
|
|
49
|
+
responseType?: 'json' | 'text' | 'arraybuffer' | 'blob';
|
|
50
|
+
withCredentials?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 响应接口
|
|
54
|
+
*/
|
|
55
|
+
export interface Response<T = any> {
|
|
56
|
+
data: T;
|
|
57
|
+
status: number;
|
|
58
|
+
statusText: string;
|
|
59
|
+
headers: Record<string, string>;
|
|
60
|
+
config: RequestOptions;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 请求错误
|
|
64
|
+
*/
|
|
65
|
+
export declare class RequestError extends Error {
|
|
66
|
+
response?: Response;
|
|
67
|
+
request?: any;
|
|
68
|
+
config?: RequestOptions;
|
|
69
|
+
constructor(message: string, config?: RequestOptions, request?: any, response?: Response);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* RequestPlugin 实现
|
|
73
|
+
*/
|
|
74
|
+
declare class RequestPluginImpl implements RequestPlugin {
|
|
75
|
+
name: string;
|
|
76
|
+
version: string;
|
|
77
|
+
private core;
|
|
78
|
+
/**
|
|
79
|
+
* 默认请求选项
|
|
80
|
+
*/
|
|
81
|
+
private defaultOptions;
|
|
82
|
+
/**
|
|
83
|
+
* 全局拦截器
|
|
84
|
+
*/
|
|
85
|
+
private interceptors;
|
|
86
|
+
initialize(): void;
|
|
87
|
+
destroy(): void;
|
|
88
|
+
/**
|
|
89
|
+
* 添加请求拦截器
|
|
90
|
+
*/
|
|
91
|
+
addRequestInterceptor(interceptor: (config: RequestOptions) => RequestOptions | Promise<RequestOptions>): void;
|
|
92
|
+
/**
|
|
93
|
+
* 添加响应拦截器
|
|
94
|
+
*/
|
|
95
|
+
addResponseInterceptor(interceptor: (response: Response) => Response | Promise<Response>): void;
|
|
96
|
+
/**
|
|
97
|
+
* 添加错误拦截器
|
|
98
|
+
*/
|
|
99
|
+
addErrorInterceptor(interceptor: (error: RequestError) => RequestError | Promise<RequestError>): void;
|
|
100
|
+
/**
|
|
101
|
+
* GET 请求
|
|
102
|
+
*/
|
|
103
|
+
get<T = any>(url: string, options?: RequestOptions): Promise<T>;
|
|
104
|
+
/**
|
|
105
|
+
* POST 请求
|
|
106
|
+
*/
|
|
107
|
+
post<T = any>(url: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
108
|
+
/**
|
|
109
|
+
* PUT 请求
|
|
110
|
+
*/
|
|
111
|
+
put<T = any>(url: string, data?: any, options?: RequestOptions): Promise<T>;
|
|
112
|
+
/**
|
|
113
|
+
* DELETE 请求
|
|
114
|
+
*/
|
|
115
|
+
delete<T = any>(url: string, options?: RequestOptions): Promise<T>;
|
|
116
|
+
/**
|
|
117
|
+
* 通用请求方法
|
|
118
|
+
*/
|
|
119
|
+
request<T = any>(options: RequestOptions): Promise<T>;
|
|
120
|
+
/**
|
|
121
|
+
* 执行实际的请求
|
|
122
|
+
* 这里实现了一个基于 fetch API 的请求
|
|
123
|
+
*/
|
|
124
|
+
private performRequest;
|
|
125
|
+
}
|
|
126
|
+
declare const _default: RequestPluginImpl;
|
|
127
|
+
export default _default;
|