wappsto-redux
Advanced tools
Comparing version 4.2.3 to 4.2.4
@@ -13,3 +13,2 @@ "use strict"; | ||
exports.REMOVE_ENTITIES = REMOVE_ENTITIES; | ||
function addEntities(service, data) { | ||
@@ -24,3 +23,2 @@ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
} | ||
function removeEntities(service, ids) { | ||
@@ -27,0 +25,0 @@ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; |
@@ -6,5 +6,3 @@ "use strict"; | ||
}); | ||
var _entities = require("./entities"); | ||
Object.keys(_entities).forEach(function (key) { | ||
@@ -20,5 +18,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _items = require("./items"); | ||
Object.keys(_items).forEach(function (key) { | ||
@@ -34,5 +30,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _pagination = require("./pagination"); | ||
Object.keys(_pagination).forEach(function (key) { | ||
@@ -48,5 +42,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _request = require("./request"); | ||
Object.keys(_request).forEach(function (key) { | ||
@@ -62,5 +54,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _session = require("./session"); | ||
Object.keys(_session).forEach(function (key) { | ||
@@ -76,5 +66,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _stream = require("./stream"); | ||
Object.keys(_stream).forEach(function (key) { | ||
@@ -81,0 +69,0 @@ if (key === "default" || key === "__esModule") return; |
@@ -13,3 +13,2 @@ "use strict"; | ||
exports.REMOVE_ITEM = REMOVE_ITEM; | ||
function setItem(name, data) { | ||
@@ -22,3 +21,2 @@ return { | ||
} | ||
function removeItem(name) { | ||
@@ -25,0 +23,0 @@ return { |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -15,39 +14,20 @@ value: true | ||
exports.startRequest = startRequest; | ||
var _queryString = _interopRequireDefault(require("query-string")); | ||
var _deepEqual = _interopRequireDefault(require("deep-equal")); | ||
var _config = _interopRequireDefault(require("../config")); | ||
var _helpers = require("../util/helpers"); | ||
var _entities = require("./entities"); | ||
var _session = require("./session"); | ||
require("regenerator-runtime/runtime"); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } | ||
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } | ||
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); } } | ||
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); }); }; } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
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."); } | ||
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); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
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; } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var REQUEST_PENDING = 'REQUEST_PENDING'; | ||
@@ -69,3 +49,2 @@ exports.REQUEST_PENDING = REQUEST_PENDING; | ||
var nextPendingId = 0; | ||
function getQueryObj(query) { | ||
@@ -75,13 +54,9 @@ var urlParams = {}; | ||
var search = /([^&=]+)=?([^&]*)/g; | ||
var decode = function decode(s) { | ||
return decodeURIComponent(s.replace(pl, ' ')); | ||
}; | ||
var match = search.exec(query); | ||
while (match) { | ||
var left = decode(match[1]); | ||
var right = decode(match[2]); | ||
if (Object.prototype.hasOwnProperty.call(urlParams, left)) { | ||
@@ -91,3 +66,2 @@ if (urlParams[left].constructor !== Array) { | ||
} | ||
urlParams[left].push(right); | ||
@@ -97,17 +71,11 @@ } else { | ||
} | ||
match = search.exec(query); | ||
} | ||
return urlParams; | ||
} | ||
function splitUrlAndOptions(url, options) { | ||
var newOptions = _extends({}, options); | ||
var split = url.split('?'); | ||
if (split[1]) { | ||
var query = split.slice(1).join('?'); | ||
if (!newOptions.query) { | ||
@@ -119,3 +87,2 @@ newOptions.query = getQueryObj(query); | ||
} | ||
return { | ||
@@ -126,10 +93,7 @@ url: split[0], | ||
} | ||
function getUrlWithQuery(url, options) { | ||
var _getUrlInfo = (0, _helpers.getUrlInfo)(url), | ||
service = _getUrlInfo.service; | ||
service = _getUrlInfo.service; | ||
var version = options.version || (0, _helpers.getServiceVersion)(service); | ||
var result = _config["default"].baseUrl + (version ? "/".concat(version) : '') + url; | ||
if (options.query && Object.keys(options.query).length > 0) { | ||
@@ -139,6 +103,4 @@ result += result.indexOf('?') === -1 ? '?' : '&'; | ||
} | ||
return result; | ||
} | ||
function getOptions(method, url, data, options, sessionJSON) { | ||
@@ -150,15 +112,11 @@ var requestOptions = { | ||
}; | ||
if (sessionJSON && sessionJSON.meta && !requestOptions.headers['x-session']) { | ||
requestOptions.headers['x-session'] = sessionJSON.meta.id; | ||
} | ||
if (['GET', 'DELETE'].indexOf(method) === -1) { | ||
requestOptions.body = JSON.stringify(data); | ||
} | ||
requestOptions.url = getUrlWithQuery(url, options); | ||
return requestOptions; | ||
} | ||
function requestPending(id, method, url, body, options, promise) { | ||
@@ -175,3 +133,2 @@ return { | ||
} | ||
function requestSuccess(id, method, url, body, responseStatus, json, text, options, promise) { | ||
@@ -191,3 +148,2 @@ return { | ||
} | ||
function requestError(id, method, url, body, responseStatus, json, text, options, promise) { | ||
@@ -207,6 +163,4 @@ return { | ||
} | ||
function dispatchEntitiesAction(dispatch, method, url, json, options, service, parent) { | ||
var deleted; | ||
switch (method) { | ||
@@ -220,3 +174,2 @@ case 'GET': | ||
break; | ||
case 'POST': | ||
@@ -230,6 +183,4 @@ case 'PATCH': | ||
break; | ||
case 'DELETE': | ||
deleted = [].concat(_toConsumableArray(json.deleted || []), _toConsumableArray(json.shared_deleted || []), _toConsumableArray(json.owned_deleted || [])); | ||
if (deleted.length > 0) { | ||
@@ -241,5 +192,3 @@ dispatch((0, _entities.removeEntities)(service, deleted, _extends(_extends({}, options), {}, { | ||
} | ||
break; | ||
default: | ||
@@ -250,8 +199,6 @@ /* istanbul ignore next */ | ||
} | ||
function dispatchMethodAction(dispatch, method, url, json, options) { | ||
var _getUrlInfo2 = (0, _helpers.getUrlInfo)(url), | ||
service = _getUrlInfo2.service, | ||
parent = _getUrlInfo2.parent; | ||
service = _getUrlInfo2.service, | ||
parent = _getUrlInfo2.parent; | ||
if (service === 'document' && url.startsWith('/file/')) { | ||
@@ -263,3 +210,2 @@ dispatchEntitiesAction(dispatch, method, url, json, options, 'file'); | ||
} | ||
var localRequest = /*#__PURE__*/function () { | ||
@@ -278,13 +224,10 @@ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) { | ||
}, options.headers); | ||
if (!options.controller || !options.controller.signal) { | ||
// eslint-disable-next-line no-param-reassign | ||
options.controller = new AbortController(); | ||
} // eslint-disable-next-line no-param-reassign | ||
} | ||
// eslint-disable-next-line no-param-reassign | ||
options.signal = options.controller.signal; | ||
_context.next = 6; | ||
return fetch(options.url, options); | ||
case 6: | ||
@@ -295,3 +238,2 @@ response = _context.sent; | ||
return response.clone().json(); | ||
case 10: | ||
@@ -306,3 +248,2 @@ json = _context.sent; | ||
}); | ||
case 14: | ||
@@ -313,3 +254,2 @@ _context.prev = 14; | ||
return response.clone().text(); | ||
case 18: | ||
@@ -324,7 +264,5 @@ text = _context.sent; | ||
}); | ||
case 20: | ||
_context.next = 25; | ||
break; | ||
case 22: | ||
@@ -338,3 +276,2 @@ _context.prev = 22; | ||
}); | ||
case 25: | ||
@@ -347,3 +284,2 @@ case "end": | ||
})); | ||
return function localRequest(_x) { | ||
@@ -353,3 +289,2 @@ return _ref.apply(this, arguments); | ||
}(); | ||
var request = /*#__PURE__*/function () { | ||
@@ -362,3 +297,2 @@ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) { | ||
return _context2.abrupt("return", localRequest(options)); | ||
case 1: | ||
@@ -371,3 +305,2 @@ case "end": | ||
})); | ||
return function request(_x2) { | ||
@@ -377,20 +310,12 @@ return _ref2.apply(this, arguments); | ||
}(); | ||
exports.request = request; | ||
function findRequest(url, method, data) { | ||
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; | ||
for (var i = 0; i < Object.keys(pendingRequestsCache).length; i += 1) { | ||
var id = Object.keys(pendingRequestsCache)[i]; | ||
var pendingRequest = pendingRequestsCache[id]; | ||
var rUrl = _queryString["default"].parseUrl(pendingRequest.url); | ||
var parsedUrl = _queryString["default"].parseUrl(url); | ||
var rQuery = _extends(_extends(_extends({}, pendingRequest.query), rUrl.query), pendingRequest.options.query || {}); | ||
var query = options.query ? _extends(_extends({}, options.query), parsedUrl.query) : parsedUrl.query; | ||
if (pendingRequest.method === method && (0, _deepEqual["default"])(rUrl.url, parsedUrl.url) && (0, _deepEqual["default"])(rQuery, query) && (0, _deepEqual["default"])(pendingRequest.body, data)) { | ||
@@ -400,6 +325,4 @@ return pendingRequest.promise; | ||
} | ||
return undefined; | ||
} | ||
function startRequest(dispatch, options, session) { | ||
@@ -409,3 +332,3 @@ var promise; | ||
var url = options.url, | ||
id = options.id; | ||
id = options.id; | ||
var data = options.data || options.body; | ||
@@ -415,3 +338,2 @@ var method = options.method ? options.method.toUpperCase() : 'GET'; | ||
var requestOptions = getOptions(method, url, data, options, session); | ||
if (id) { | ||
@@ -423,6 +345,4 @@ pendingId = id; | ||
} | ||
var checkResponse = function checkResponse(response) { | ||
delete pendingRequestsCache[pendingId]; | ||
if (response.ok) { | ||
@@ -432,3 +352,2 @@ if (options.dispatchEntities !== false) { | ||
} | ||
if (id) { | ||
@@ -445,3 +364,2 @@ dispatch(requestSuccess(id, requestOptions.method, result.url, data, response.status, response.json, response.text, result.options, promise)); | ||
} | ||
if (id) { | ||
@@ -451,12 +369,8 @@ dispatch(requestError(id, requestOptions.method, result.url, data, response.status, response.json, response.text, result.options, promise)); | ||
} | ||
return response; | ||
}; | ||
promise = findRequest(url, method, data, options); | ||
if (!promise) { | ||
promise = localRequest(requestOptions); | ||
} | ||
promise.then(checkResponse)["catch"](checkResponse); | ||
@@ -466,10 +380,7 @@ result.options.controller = requestOptions.controller; | ||
pendingRequestsCache[pendingId] = requestPendingObj; | ||
if (id) { | ||
dispatch(requestPendingObj); | ||
} | ||
return promise; | ||
} | ||
function makeRequest() { | ||
@@ -483,3 +394,2 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
} | ||
function removeRequest(id) { | ||
@@ -491,3 +401,2 @@ return { | ||
} | ||
function overrideRequest(func) { | ||
@@ -498,3 +407,2 @@ if (func) { | ||
} | ||
function cancelAllRequests() { | ||
@@ -501,0 +409,0 @@ Object.keys(pendingRequestsCache).forEach(function (key) { |
@@ -19,3 +19,2 @@ "use strict"; | ||
exports.LIMIT_REACHED = LIMIT_REACHED; | ||
function addSession(data) { | ||
@@ -27,3 +26,2 @@ return { | ||
} | ||
function removeSession() { | ||
@@ -34,3 +32,2 @@ return { | ||
} | ||
function invalidSession() { | ||
@@ -41,3 +38,2 @@ return { | ||
} | ||
function limitReached() { | ||
@@ -44,0 +40,0 @@ return { |
"use strict"; | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
Object.defineProperty(exports, "__esModule", { | ||
@@ -15,23 +14,12 @@ value: true | ||
exports.updateStream = updateStream; | ||
var _queryString = _interopRequireDefault(require("query-string")); | ||
var _config = _interopRequireDefault(require("../config")); | ||
var _helpers = require("../util/helpers"); | ||
var _entities = require("./entities"); | ||
var _schemas = _interopRequireDefault(require("../util/schemas")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } | ||
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; } | ||
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); } } | ||
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); }); }; } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var UPDATE_STREAM = 'UPDATE_STREAM'; | ||
@@ -43,14 +31,12 @@ exports.UPDATE_STREAM = UPDATE_STREAM; | ||
var retryTimer = 1000 * 5; | ||
function setStreamLostTime(timeout) { | ||
lostTimer = timeout; | ||
} | ||
function setStreamRetryTime(timeout) { | ||
retryTimer = timeout; | ||
} | ||
var timeouts = {}; | ||
var websockets = {}; // add also connection lost and timer of 5 minutes of waiting in general | ||
var websockets = {}; | ||
// add also connection lost and timer of 5 minutes of waiting in general | ||
var streamStatus = { | ||
@@ -75,3 +61,2 @@ CONNECTING: 1, | ||
exports.steps = steps; | ||
function updateStream(name, status, step, ws, json, increment) { | ||
@@ -81,3 +66,2 @@ var obj = { | ||
}; | ||
if (ws !== undefined) { | ||
@@ -87,26 +71,19 @@ websockets[name] = ws; | ||
} | ||
if (name !== undefined) { | ||
obj.name = name; | ||
} | ||
if (status !== undefined) { | ||
obj.status = status; | ||
} | ||
if (step !== undefined) { | ||
obj.step = step; | ||
} | ||
if (json !== undefined) { | ||
obj.json = json; | ||
} | ||
if (increment !== undefined) { | ||
obj.increment = increment; | ||
} | ||
return obj; | ||
} | ||
function clearStreamTimeouts(stream) { | ||
@@ -119,3 +96,2 @@ if (stream && stream.name && timeouts[stream.name]) { | ||
} | ||
function removeStream(name) { | ||
@@ -127,3 +103,2 @@ return { | ||
} | ||
function closeStream(name) { | ||
@@ -135,3 +110,2 @@ var silent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; | ||
}); | ||
if (websockets[name]) { | ||
@@ -142,6 +116,6 @@ websockets[name].silent = silent; | ||
} | ||
dispatch(removeStream(name)); | ||
}; | ||
} | ||
/* | ||
@@ -174,3 +148,2 @@ function _mergeStreams(oldJSON, newJSON) { | ||
function getUrl() { | ||
@@ -183,2 +156,3 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
} | ||
/* | ||
@@ -208,9 +182,6 @@ async function _createStream(streamJSON, session, dispatch, options) { | ||
function addChildren(message, state) { | ||
var dataType = message.meta_object.type; | ||
var data = message[dataType] || message.data; | ||
var st = _schemas["default"].getSchemaTree(dataType); | ||
if (data && st.dependencies) { | ||
@@ -220,4 +191,3 @@ var cachedData = state.entities[st.name] && state.entities[st.name][data.meta.id]; | ||
var key = _ref.key, | ||
type = _ref.type; | ||
type = _ref.type; | ||
if (!Object.prototype.hasOwnProperty.call(data, key)) { | ||
@@ -235,6 +205,4 @@ if (cachedData) { | ||
} | ||
function startStream(stream, session, getState, dispatch, options, reconnecting) { | ||
var url = getUrl(options, true); | ||
if (stream.meta && stream.meta.id) { | ||
@@ -244,11 +212,8 @@ url += "/".concat(stream.meta.id, "?x-session=").concat(session); | ||
var streamClone = _extends({}, stream); | ||
delete streamClone.name; | ||
url += "/open?x-session=".concat(session, "&").concat(_queryString["default"].stringify(streamClone)); | ||
} | ||
if (window && window.location && window.location.origin && !url.startsWith('http')) { | ||
url = window.location.origin + url; | ||
} | ||
url = url.replace('http', 'ws'); | ||
@@ -258,3 +223,2 @@ var ws = new WebSocket(url); | ||
dispatch(updateStream(stream.name, reconnecting ? streamStatus.RECONNECTING : streamStatus.CONNECTING, steps.CONNECTING.OPENING_SOCKET, ws, stream)); | ||
ws.onopen = function () { | ||
@@ -264,3 +228,2 @@ clearStreamTimeouts(stream); | ||
}; | ||
ws.onmessage = function (e) { | ||
@@ -270,7 +233,5 @@ // a message was received | ||
var data = JSON.parse(e.data); | ||
if (data.constructor !== Array) { | ||
data = [data]; | ||
} | ||
data.forEach(function (message) { | ||
@@ -280,6 +241,4 @@ if (!message || !message.meta_object) { | ||
} | ||
var state = getState(); | ||
var parent; | ||
switch (message.event) { | ||
@@ -289,6 +248,4 @@ case 'create': | ||
addChildren(message, state); | ||
if (message.meta_object.type === 'state') { | ||
var st = _schemas["default"].getSchemaTree('state'); | ||
if (state.entities[st.name] && Object.prototype.hasOwnProperty.call(state.entities[st.name], message.meta_object.id)) { | ||
@@ -312,5 +269,3 @@ dispatch((0, _entities.addEntities)(message.meta_object.type, message[message.meta_object.type] || message.data, { | ||
} | ||
break; | ||
case 'update': | ||
@@ -323,3 +278,2 @@ // since stream does not have child list, I'm going to add it from cached store state | ||
break; | ||
case 'delete': | ||
@@ -331,3 +285,2 @@ parent = (0, _helpers.getUrlInfo)(message.path, 1).parent; | ||
break; | ||
default: | ||
@@ -337,6 +290,6 @@ break; | ||
}); | ||
} catch (error) {// console.log('stream catch', error); | ||
} catch (error) { | ||
// console.log('stream catch', error); | ||
} | ||
}; | ||
ws.onclose = function (e) { | ||
@@ -351,7 +304,5 @@ if (!ws.stop && e.code !== 4001) { | ||
clearStreamTimeouts(stream); | ||
if (!ws.silent) { | ||
dispatch(updateStream(stream.name, streamStatus.LOST, null, null, stream)); | ||
} | ||
if (websockets[stream.name]) { | ||
@@ -364,3 +315,2 @@ websockets[stream.name].stop = true; | ||
timeouts[stream.name].lostTimeout = lostTimeout; | ||
if (!ws.silent) { | ||
@@ -373,6 +323,4 @@ dispatch(updateStream(stream.name, streamStatus.RECONNECTING, steps.CONNECTING.WAITING, ws, stream, true)); | ||
}; | ||
return ws; | ||
} | ||
function openStream() { | ||
@@ -393,14 +341,9 @@ var streamJSON = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
} | ||
throw new TypeError('openStream requires a name to work'); | ||
case 2: | ||
newSession = session; | ||
if (!newSession) { | ||
newSession = getState().session && getState().session.meta.id; | ||
} | ||
return _context.abrupt("return", startStream(streamJSON, newSession, getState, dispatch, options)); | ||
case 5: | ||
@@ -413,3 +356,2 @@ case "end": | ||
})); | ||
return function (_x, _x2) { | ||
@@ -420,2 +362,3 @@ return _ref2.apply(this, arguments); | ||
} | ||
/* | ||
@@ -422,0 +365,0 @@ export function initializeStream(streamJSON = {}, session = undefined, options = undefined) { |
@@ -7,41 +7,23 @@ "use strict"; | ||
exports["default"] = void 0; | ||
require("./reducers"); | ||
var _redux = require("redux"); | ||
var _reduxThunk = _interopRequireDefault(require("redux-thunk")); | ||
var _session = require("./actions/session"); | ||
var _request = require("./actions/request"); | ||
var _events = require("./events"); | ||
var _reducerRegistry = _interopRequireDefault(require("./util/reducerRegistry")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
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."); } | ||
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); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
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; } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function configureStore() { | ||
var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; | ||
var enhancers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; | ||
// Preserve initial state for not-yet-loaded reducers | ||
var combine = function combine(reducers) { | ||
var newReducers = _extends({}, reducers); | ||
var reducerNames = Object.keys(newReducers); | ||
@@ -59,3 +41,2 @@ Object.keys(initialState).forEach(function (item) { | ||
var newState = _extends({}, state); | ||
if (action.type === _session.REMOVE_SESSION) { | ||
@@ -66,7 +47,5 @@ newState = undefined; | ||
} | ||
return appReducer(newState, action); | ||
}; | ||
}; | ||
var createEnhancer = function createEnhancer() { | ||
@@ -76,13 +55,11 @@ enhancers.push((0, _redux.applyMiddleware)(_reduxThunk["default"])); | ||
}; | ||
var store = (0, _redux.createStore)(combine(_reducerRegistry["default"].getReducers()), initialState, createEnhancer()); | ||
var store = (0, _redux.createStore)(combine(_reducerRegistry["default"].getReducers()), initialState, createEnhancer()); // Replace the store's reducer whenever a new reducer is registered. | ||
// Replace the store's reducer whenever a new reducer is registered. | ||
_reducerRegistry["default"].setChangeListener(function (reducers) { | ||
store.replaceReducer(combine(reducers)); | ||
}); | ||
return store; | ||
} | ||
var _default = configureStore; | ||
exports["default"] = _default; |
@@ -11,7 +11,5 @@ "use strict"; | ||
}; | ||
function onLogout(cb) { | ||
events.logout.push(cb); | ||
} | ||
function trigger(e, data) { | ||
@@ -18,0 +16,0 @@ if (events[e]) { |
@@ -24,9 +24,5 @@ "use strict"; | ||
exports.use = use; | ||
var _config = _interopRequireDefault(require("./config")); | ||
require("./reducers"); | ||
var _events = require("./events"); | ||
Object.keys(_events).forEach(function (key) { | ||
@@ -43,5 +39,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _util = require("./util"); | ||
Object.keys(_util).forEach(function (key) { | ||
@@ -58,5 +52,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _selectors = require("./selectors"); | ||
Object.keys(_selectors).forEach(function (key) { | ||
@@ -73,5 +65,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _actions = require("./actions"); | ||
Object.keys(_actions).forEach(function (key) { | ||
@@ -88,9 +78,6 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _configureStore = _interopRequireDefault(require("./configureStore")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function use(newConfig) { | ||
Object.assign(_config["default"], newConfig); | ||
} |
@@ -7,31 +7,16 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _normalizr = require("normalizr"); | ||
var _deepEqual = _interopRequireDefault(require("deep-equal")); | ||
var _entities = require("../actions/entities"); | ||
var _schemas = _interopRequireDefault(require("../util/schemas")); | ||
var _parser = _interopRequireDefault(require("../util/parser")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
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."); } | ||
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); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
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; } | ||
var initialState = {}; | ||
function mergeUnique(arr1, arr2) { | ||
@@ -46,6 +31,4 @@ var arr = arr1 ? _toConsumableArray(arr1) : []; | ||
} | ||
function addEntity(state, type, data) { | ||
var newState = _extends({}, state); | ||
var newData = (0, _normalizr.normalize)(data, _schemas["default"].getSchema(type)); | ||
@@ -60,6 +43,4 @@ Object.keys(newData.entities).forEach(function (key) { | ||
} | ||
function addEntities(state, type, data) { | ||
var newState = _extends({}, state); | ||
var newData = (0, _normalizr.normalize)(data, [_schemas["default"].getSchema(type)]); | ||
@@ -74,13 +55,9 @@ Object.keys(newData.entities).forEach(function (key) { | ||
} | ||
function removeEntities(state, type) { | ||
var ids = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; | ||
var newIds = ids; | ||
if (typeof ids === 'string') { | ||
newIds = [ids]; | ||
} | ||
var newState = _extends({}, state); | ||
newIds.forEach(function (id) { | ||
@@ -91,5 +68,3 @@ // eslint-disable-next-line no-use-before-define | ||
}); | ||
var def = _schemas["default"].getSchemaTree(type); | ||
newState[def.name] = _extends({}, newState[def.name]); | ||
@@ -101,10 +76,6 @@ return { | ||
} | ||
function removeAllEntities(state, type) { | ||
var newState = _extends({}, state); | ||
var def = _schemas["default"].getSchemaTree(type); | ||
var entities = newState[def.name]; | ||
if (entities) { | ||
@@ -114,3 +85,2 @@ var newData = removeEntities(newState, type, Object.keys(entities)); | ||
} | ||
return { | ||
@@ -121,3 +91,2 @@ state: newState, | ||
} | ||
function addChildEntities(state, type, id, child, data) { | ||
@@ -127,7 +96,4 @@ var reset = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; | ||
var result; | ||
var newState = _extends({}, state); | ||
var def = _schemas["default"].getSchemaTree(type); | ||
var element = newState[def.name] && newState[def.name][id]; | ||
@@ -137,3 +103,2 @@ var childDef = def.dependencies.find(function (d) { | ||
}); | ||
if (!childDef) { | ||
@@ -145,7 +110,5 @@ childDef = { | ||
} | ||
if (childDef.type === 'many') { | ||
newData = addEntities(newState, child, data); | ||
result = newData.result; | ||
if (element && !(0, _deepEqual["default"])(element[child], data.map(function (i) { | ||
@@ -155,3 +118,2 @@ return i.meta.id; | ||
var newElement = _extends({}, element); | ||
newElement[child] = reset ? result : mergeUnique(element[child], result); | ||
@@ -163,6 +125,4 @@ newState[def.name][id] = newElement; | ||
result = newData.result; | ||
if (element && !(0, _deepEqual["default"])(element[child], data.meta.id)) { | ||
var _newElement = _extends({}, element); | ||
_newElement[child] = result; | ||
@@ -172,3 +132,2 @@ newState[def.name][id] = _newElement; | ||
} | ||
newState = newData.state; | ||
@@ -180,10 +139,6 @@ return { | ||
} | ||
function removeEntity(state, type, id) { | ||
var newState = _extends({}, state); | ||
var def = _schemas["default"].getSchemaTree(type); | ||
var element = newState[def.name] && newState[def.name][id]; | ||
if (element) { | ||
@@ -197,3 +152,2 @@ def.dependencies.forEach(function (dep) { | ||
} | ||
return { | ||
@@ -203,8 +157,5 @@ state: newState | ||
} | ||
function removeChildEntities(state, type, id, child, ids) { | ||
var result; | ||
var def = _schemas["default"].getSchemaTree(type); | ||
var element = state[def.name] && state[def.name][id]; | ||
@@ -216,3 +167,2 @@ var childDef = def.dependencies.find(function (d) { | ||
var newState = newData.state; | ||
if (childDef && childDef.type === 'many' || element && element[child] && element[child].constructor === Array) { | ||
@@ -229,10 +179,7 @@ if (ids && element) { | ||
} | ||
if (element) { | ||
var newElement = _extends({}, element); | ||
newElement[child] = result; | ||
newState[def.name][id] = newElement; | ||
} | ||
return { | ||
@@ -243,3 +190,2 @@ state: newState, | ||
} | ||
function reducer() { | ||
@@ -250,15 +196,10 @@ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; | ||
var data; | ||
var newState = _extends({}, state); | ||
var newAction; | ||
switch (action.type) { | ||
case _entities.ADD_ENTITIES: | ||
data = (0, _parser["default"])(action.data); | ||
if (data.constructor === Object) { | ||
data = [data]; | ||
} | ||
if (action.options.parent) { | ||
@@ -269,3 +210,2 @@ if (action.options.reset !== false) { | ||
} | ||
newData = addChildEntities(newState, action.options.parent.type, action.options.parent.id, action.service, data, action.options.reset); | ||
@@ -278,12 +218,8 @@ newState = newData.state; | ||
} | ||
newData = addEntities(newState, action.service, data); | ||
newState = newData.state; | ||
} | ||
return newState; | ||
case _entities.REMOVE_ENTITIES: | ||
newAction = _extends({}, action); | ||
if (newAction.options.parent) { | ||
@@ -295,12 +231,8 @@ newData = removeChildEntities(newState, newAction.options.parent.type, newAction.options.parent.id, newAction.service, newAction.ids); | ||
var def = _schemas["default"].getSchemaTree(newAction.service); | ||
newAction.ids = Object.keys(newState[def.name] || {}); | ||
} | ||
newData = removeEntities(newState, newAction.service, newAction.ids); | ||
newState = newData.state; | ||
} | ||
return newState; | ||
default: | ||
@@ -310,4 +242,3 @@ return state; | ||
} | ||
var _default = reducer; | ||
exports["default"] = _default; |
"use strict"; | ||
var _reducerRegistry = _interopRequireDefault(require("../util/reducerRegistry")); | ||
var _entities = _interopRequireDefault(require("./entities")); | ||
var _items = _interopRequireDefault(require("./items")); | ||
var _request = _interopRequireDefault(require("./request")); | ||
var _session = _interopRequireDefault(require("./session")); | ||
var _stream = _interopRequireDefault(require("./stream")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
_reducerRegistry["default"].register('entities', _entities["default"]); | ||
_reducerRegistry["default"].register('items', _items["default"]); | ||
_reducerRegistry["default"].register('request', _request["default"]); | ||
_reducerRegistry["default"].register('stream', _stream["default"]); | ||
_reducerRegistry["default"].register('session', _session["default"]); |
@@ -7,11 +7,6 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _items = require("../actions/items"); | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var initialState = {}; | ||
function reducer() { | ||
@@ -22,3 +17,2 @@ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; | ||
var newState; | ||
switch (action.type) { | ||
@@ -31,5 +25,3 @@ case _items.ADD_ITEM: | ||
} | ||
return _extends(_extends({}, state), {}, _defineProperty({}, action.name, data)); | ||
case _items.REMOVE_ITEM: | ||
@@ -39,3 +31,2 @@ newState = _extends({}, state); | ||
return newState; | ||
default: | ||
@@ -45,4 +36,3 @@ return state; | ||
} | ||
var _default = reducer; | ||
exports["default"] = _default; |
@@ -7,21 +7,16 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _request = require("../actions/request"); | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var initialState = {}; | ||
function getActionState(action, state, status) { | ||
var method = action.method, | ||
url = action.url, | ||
json = action.json, | ||
text = action.text, | ||
options = action.options, | ||
id = action.id, | ||
responseStatus = action.responseStatus, | ||
body = action.body, | ||
promise = action.promise; | ||
url = action.url, | ||
json = action.json, | ||
text = action.text, | ||
options = action.options, | ||
id = action.id, | ||
responseStatus = action.responseStatus, | ||
body = action.body, | ||
promise = action.promise; | ||
return _extends(_extends({}, state), {}, _defineProperty({}, id, { | ||
@@ -40,3 +35,2 @@ id: id, | ||
} | ||
function reducer() { | ||
@@ -46,7 +40,5 @@ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; | ||
var newState; | ||
switch (action.type) { | ||
case _request.REQUEST_PENDING: | ||
return getActionState(action, state, _request.STATUS.pending); | ||
case _request.REQUEST_SUCCESS: | ||
@@ -56,5 +48,3 @@ if (state[action.id]) { | ||
} | ||
return state; | ||
case _request.REQUEST_ERROR: | ||
@@ -64,5 +54,3 @@ if (state[action.id]) { | ||
} | ||
return state; | ||
case _request.REMOVE_REQUEST: | ||
@@ -72,3 +60,2 @@ newState = _extends({}, state); | ||
return newState; | ||
default: | ||
@@ -78,4 +65,3 @@ return state; | ||
} | ||
var _default = reducer; | ||
exports["default"] = _default; |
@@ -7,13 +7,8 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _session = require("../actions/session"); | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var initialState = null; | ||
function reducer() { | ||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; | ||
var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
switch (action.type) { | ||
@@ -24,6 +19,4 @@ case _session.ADD_SESSION: | ||
}); | ||
case _session.REMOVE_SESSION: | ||
return initialState; | ||
case _session.INVALID_SESSION: | ||
@@ -35,5 +28,3 @@ if (state && state.meta && state.meta.id) { | ||
} | ||
return state; | ||
case _session.LIMIT_REACHED: | ||
@@ -45,5 +36,3 @@ if (state && state.meta && state.meta.id) { | ||
} | ||
return state; | ||
default: | ||
@@ -53,4 +42,3 @@ return state; | ||
} | ||
var _default = reducer; | ||
exports["default"] = _default; |
@@ -7,18 +7,11 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _stream = require("../actions/stream"); | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
var initialState = {}; | ||
function reconnect(state, action) { | ||
var newState = _extends({}, state); | ||
var count = newState[action.name] && newState[action.name].count || 0; | ||
if (action.increment) { | ||
count += 1; | ||
} | ||
newState[action.name] = _extends(_extends(_extends({}, newState[action.name] || {}), action), {}, { | ||
@@ -30,3 +23,2 @@ count: count | ||
} | ||
function reducer() { | ||
@@ -36,3 +28,2 @@ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState; | ||
var newState; | ||
switch (action.type) { | ||
@@ -44,3 +35,2 @@ case _stream.UPDATE_STREAM: | ||
break; | ||
default: | ||
@@ -52,5 +42,3 @@ newState = _extends({}, state); | ||
} | ||
return newState; | ||
case _stream.REMOVE_STREAM: | ||
@@ -60,3 +48,2 @@ newState = _extends({}, state); | ||
return newState; | ||
default: | ||
@@ -66,4 +53,3 @@ return state; | ||
} | ||
var _default = reducer; | ||
exports["default"] = _default; |
@@ -7,39 +7,24 @@ "use strict"; | ||
exports.makeEntitySelector = exports.makeEntitiesSelector = exports.getUserData = void 0; | ||
var _reselect = require("reselect"); | ||
var _schemaTree = _interopRequireDefault(require("../util/schemaTree")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
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."); } | ||
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); } | ||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } | ||
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; } | ||
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } | ||
function getTreeName(key) { | ||
return _schemaTree["default"][key] && _schemaTree["default"][key].name || key; | ||
} | ||
function matchObject(obj1, obj2) { | ||
for (var i = 0; i < Object.keys(obj2).length; i += 1) { | ||
var key = Object.keys(obj2)[i]; | ||
if (Object.prototype.hasOwnProperty.call(obj1, key)) { | ||
var left = obj1[key]; | ||
var right = obj2[key]; | ||
if (left && right && left.constructor !== right.constructor) { | ||
return false; | ||
} | ||
if (_typeof(left) === 'object') { | ||
@@ -56,12 +41,8 @@ if (!matchObject(left, right)) { | ||
} | ||
return true; | ||
} | ||
var defaultArr = []; | ||
var stateSelector = function stateSelector(state) { | ||
return state.entities; | ||
}; | ||
var makeStateTypeSelector = function makeStateTypeSelector() { | ||
@@ -74,3 +55,2 @@ return (0, _reselect.createSelector)(stateSelector, function (_, type) { | ||
}; | ||
var makeParentStateTypeSelector = function makeParentStateTypeSelector() { | ||
@@ -83,3 +63,2 @@ return (0, _reselect.createSelector)(stateSelector, function (_, _1, options) { | ||
}; | ||
var makeParentSelector = function makeParentSelector() { | ||
@@ -93,7 +72,5 @@ var parentStateTypeSelector = makeParentStateTypeSelector(); | ||
} | ||
return null; | ||
}); | ||
}; | ||
var makeEntitySelector = function makeEntitySelector() { | ||
@@ -112,3 +89,2 @@ var stateTypeSelector = makeStateTypeSelector(); | ||
} | ||
if (options.constructor === Object) { | ||
@@ -121,3 +97,2 @@ if (options.parent) { | ||
var found = entities[id]; | ||
if (found && matchObject(found, options.filter || {})) { | ||
@@ -131,3 +106,2 @@ return found; | ||
} | ||
return undefined; | ||
@@ -139,5 +113,3 @@ } | ||
var key = Object.keys(entities)[_i]; | ||
var val = entities[key]; | ||
if (matchObject(val, options.filter || {})) { | ||
@@ -150,9 +122,6 @@ return val; | ||
} | ||
return undefined; | ||
}); | ||
}; | ||
exports.makeEntitySelector = makeEntitySelector; | ||
function shallowEqualArrays(arrA, arrB) { | ||
@@ -162,13 +131,9 @@ if (arrA === arrB) { | ||
} | ||
if (!arrA || !arrB) { | ||
return false; | ||
} | ||
var len = arrA.length; | ||
if (arrB.length !== len) { | ||
return false; | ||
} | ||
for (var i = 0; i < len; i += 1) { | ||
@@ -179,6 +144,4 @@ if (arrA[i] !== arrB[i]) { | ||
} | ||
return true; | ||
} | ||
var makeEntitiesSelector = function makeEntitiesSelector() { | ||
@@ -195,3 +158,2 @@ var stateTypeSelector = makeStateTypeSelector(); | ||
var result; | ||
if (entities) { | ||
@@ -201,3 +163,2 @@ var filters; | ||
var lookIn; | ||
if (options.constructor === String) { | ||
@@ -209,3 +170,2 @@ ids = [options]; | ||
ids = options.ids; | ||
if (options.filter) { | ||
@@ -225,3 +185,2 @@ if (options.filter.constructor === Object) { | ||
} | ||
if (ids) { | ||
@@ -231,3 +190,2 @@ lookIn = {}; | ||
var found = entities[id]; | ||
if (found) { | ||
@@ -240,6 +198,4 @@ lookIn[id] = found; | ||
} | ||
if (options.parent) { | ||
result = []; | ||
if (parent && Object.prototype.hasOwnProperty.call(parent, type)) { | ||
@@ -250,3 +206,2 @@ if (filters) { | ||
var found = lookIn[id]; | ||
if (found && matchObject(found, filter) && !result.includes(found)) { | ||
@@ -260,3 +215,2 @@ result.push(found); | ||
var found = lookIn[id]; | ||
if (found) { | ||
@@ -273,3 +227,2 @@ result.push(found); | ||
var val = lookIn[key]; | ||
if (matchObject(val, filter) && !result.includes(val)) { | ||
@@ -286,9 +239,6 @@ result.push(val); | ||
} | ||
result = result.slice(0, options.limit); | ||
if (shallowEqualArrays(result, old)) { | ||
return old; | ||
} | ||
old = result; | ||
@@ -298,3 +248,2 @@ return result; | ||
}; | ||
exports.makeEntitiesSelector = makeEntitiesSelector; | ||
@@ -308,5 +257,4 @@ var userStateSelector = makeStateTypeSelector(); | ||
} | ||
return undefined; | ||
}); | ||
exports.getUserData = getUserData; |
@@ -29,5 +29,3 @@ "use strict"; | ||
}); | ||
var _entities = require("./entities"); | ||
Object.keys(_entities).forEach(function (key) { | ||
@@ -44,5 +42,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _items = require("./items"); | ||
Object.keys(_items).forEach(function (key) { | ||
@@ -59,9 +55,5 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _request = _interopRequireDefault(require("./request")); | ||
var _session = _interopRequireDefault(require("./session")); | ||
var _stream = _interopRequireDefault(require("./stream")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
@@ -7,15 +7,10 @@ "use strict"; | ||
exports.makeItemSelector = exports.getItem = void 0; | ||
var _reselect = require("reselect"); | ||
var stateSelector = function stateSelector(state) { | ||
return state.items; | ||
}; | ||
var getItem = function getItem(state, name) { | ||
return state.items[name]; | ||
}; | ||
exports.getItem = getItem; | ||
var makeItemSelector = function makeItemSelector() { | ||
@@ -28,3 +23,2 @@ return (0, _reselect.createSelector)(stateSelector, function (_, name) { | ||
}; | ||
exports.makeItemSelector = makeItemSelector; |
@@ -7,9 +7,6 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _reselect = require("reselect"); | ||
var stateSelector = function stateSelector(state) { | ||
return state.request; | ||
}; | ||
var makeRequestSelector = function makeRequestSelector() { | ||
@@ -22,4 +19,3 @@ return (0, _reselect.createSelector)(stateSelector, function (_, id) { | ||
}; | ||
var _default = makeRequestSelector; | ||
exports["default"] = _default; |
@@ -7,8 +7,6 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var getSession = function getSession(state) { | ||
return state.session; | ||
}; | ||
var _default = getSession; | ||
exports["default"] = _default; |
@@ -7,9 +7,6 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _reselect = require("reselect"); | ||
var stateSelector = function stateSelector(state) { | ||
return state.stream; | ||
}; | ||
var makeStreamSelector = function makeStreamSelector() { | ||
@@ -22,4 +19,3 @@ return (0, _reselect.createSelector)(stateSelector, function (_, name) { | ||
}; | ||
var _default = makeStreamSelector; | ||
exports["default"] = _default; |
@@ -8,7 +8,4 @@ "use strict"; | ||
exports.getUrlInfo = getUrlInfo; | ||
var _config = _interopRequireDefault(require("../config")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
function getUrlInfo(url) { | ||
@@ -19,7 +16,5 @@ var skip = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
var id = ''; | ||
if (url) { | ||
var split = url.split('?')[0]; | ||
split = split.replace(/(.?services)?(.?\d+\.\d+)?/, '').split('/'); | ||
if ((split.length - skip) % 2 !== 0) { | ||
@@ -30,3 +25,2 @@ id = split[split.length - 1 - skip]; | ||
service = split[split.length - 1 - skip]; | ||
if (split.length > 3 + skip) { | ||
@@ -40,3 +34,2 @@ parent = { | ||
} | ||
return { | ||
@@ -48,3 +41,2 @@ service: service, | ||
} | ||
function getServiceVersion(service) { | ||
@@ -55,7 +47,5 @@ if (service && _config["default"].serviceVersion) { | ||
} | ||
return _config["default"].serviceVersion["default"]; | ||
} | ||
return undefined; | ||
} |
@@ -29,5 +29,3 @@ "use strict"; | ||
}); | ||
var _helpers = require("./helpers"); | ||
Object.keys(_helpers).forEach(function (key) { | ||
@@ -44,7 +42,4 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _parser = _interopRequireDefault(require("./parser")); | ||
var _reducerRegistry = require("./reducerRegistry"); | ||
Object.keys(_reducerRegistry).forEach(function (key) { | ||
@@ -61,7 +56,4 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _schemas = _interopRequireDefault(require("./schemas")); | ||
var _schemaTree = _interopRequireDefault(require("./schemaTree")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports["default"] = void 0; | ||
function parse(json) { | ||
@@ -13,3 +12,2 @@ if (!json) { | ||
} | ||
if (json.constructor === Object) { | ||
@@ -19,3 +17,2 @@ if (json.meta.type === 'idlist') { | ||
} | ||
if (json.meta.type === 'attributelist') { | ||
@@ -27,7 +24,5 @@ var result = json; | ||
} | ||
return json; | ||
} | ||
var _default = parse; | ||
exports["default"] = _default; |
@@ -7,21 +7,13 @@ "use strict"; | ||
exports["default"] = exports.ReducerRegistry = void 0; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
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, descriptor.key, descriptor); } } | ||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } | ||
var ReducerRegistry = /*#__PURE__*/function () { | ||
function ReducerRegistry() { | ||
_classCallCheck(this, ReducerRegistry); | ||
this.emitChange = null; | ||
this.reducers = {}; | ||
} | ||
_createClass(ReducerRegistry, [{ | ||
@@ -36,3 +28,2 @@ key: "getReducers", | ||
this.reducers = _extends(_extends({}, this.reducers), {}, _defineProperty({}, name, reducer)); | ||
if (this.emitChange) { | ||
@@ -48,6 +39,4 @@ this.emitChange(this.getReducers()); | ||
}]); | ||
return ReducerRegistry; | ||
}(); | ||
exports.ReducerRegistry = ReducerRegistry; | ||
@@ -54,0 +43,0 @@ var reducerRegistry = new ReducerRegistry(); |
@@ -7,9 +7,5 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _normalizr = require("normalizr"); | ||
var _schemaTree = _interopRequireDefault(require("./schemaTree")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } | ||
var options = { | ||
@@ -23,14 +19,10 @@ idAttribute: function idAttribute(value) { | ||
var definition = {}; | ||
if (!_schemaTree["default"][key].name) { | ||
_schemaTree["default"][key].name = key; | ||
} | ||
_schemaTree["default"][key].dependencies.forEach(function (dep) { | ||
definition[dep.key] = dep.type === 'many' ? [schemas[dep.key]] : schemas[dep.key]; | ||
}); | ||
schemas[key] = new _normalizr.schema.Entity(_schemaTree["default"][key].name, definition, options); | ||
}); | ||
schemas.generateGenericSchema = function (name) { | ||
@@ -43,3 +35,2 @@ _schemaTree["default"][name] = { | ||
}; | ||
schemas.getSchema = function (type) { | ||
@@ -49,6 +40,4 @@ if (!Object.prototype.hasOwnProperty.call(schemas, type)) { | ||
} | ||
return schemas[type]; | ||
}; | ||
schemas.getSchemaTree = function (type) { | ||
@@ -58,7 +47,5 @@ if (!Object.prototype.hasOwnProperty.call(schemas, type)) { | ||
} | ||
return _schemaTree["default"][type]; | ||
}; | ||
var _default = schemas; | ||
exports["default"] = _default; |
154
package.json
{ | ||
"name": "wappsto-redux", | ||
"version": "4.2.3", | ||
"description": "", | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "babel src -d dist", | ||
"lint": "eslint src __tests__", | ||
"lint:fix": "yarn lint --fix", | ||
"prettify": "prettier src __tests__ --write", | ||
"test": "jest --coverage", | ||
"prepublish": "yarn build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Wappsto/wappsto-redux.git" | ||
}, | ||
"author": { | ||
"name": "Seluxit A/S", | ||
"email": "developer@wappsto.com", | ||
"url": "https://wappsto.com" | ||
}, | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/Wappsto/wappsto-redux/issues" | ||
}, | ||
"homepage": "https://github.com/Wappsto/wappsto-redux#readme", | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "yarn lint && yarn test" | ||
} | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"dependencies": { | ||
"deep-equal": "^2.0.5", | ||
"normalizr": "^3.6.2", | ||
"query-string": "^7.1.1", | ||
"react": "^18.2.0", | ||
"redux": "^4.2.0", | ||
"redux-thunk": "^2.4.1", | ||
"regenerator-runtime": "^0.13.9", | ||
"reselect": "^4.1.6" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.18.10", | ||
"@babel/core": "^7.18.10", | ||
"@babel/eslint-parser": "^7.18.9", | ||
"@babel/preset-env": "^7.18.10", | ||
"@babel/preset-react": "^7.18.6", | ||
"babel-jest": "^28.1.3", | ||
"eslint": "^8.21.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jest": "^26.7.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-react": "^7.30.1", | ||
"eslint-plugin-react-redux": "^4.0.0", | ||
"husky": "^8.0.1", | ||
"jest": "^28.1.3", | ||
"jest-environment-jsdom": "^28.1.3", | ||
"jest-fetch-mock": "^3.0.3", | ||
"jest-websocket-mock": "^2.3.0", | ||
"lint-staged": "^13.0.3", | ||
"prettier": "^2.7.1", | ||
"pretty-quick": "^3.1.3", | ||
"react-scripts": "^5.0.1", | ||
"react-test-renderer": "^18.2.0" | ||
}, | ||
"lint-staged": { | ||
"*.js": "npm run lint:fix" | ||
"name": "wappsto-redux", | ||
"version": "4.2.4", | ||
"description": "", | ||
"files": [ | ||
"dist" | ||
], | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"build": "babel src -d dist", | ||
"lint": "eslint src __tests__", | ||
"lint:fix": "yarn lint --fix", | ||
"prettify": "prettier src __tests__ --write", | ||
"test": "jest --coverage", | ||
"prepublish": "yarn build" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Wappsto/wappsto-redux.git" | ||
}, | ||
"author": { | ||
"name": "Seluxit A/S", | ||
"email": "developer@wappsto.com", | ||
"url": "https://wappsto.com" | ||
}, | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/Wappsto/wappsto-redux/issues" | ||
}, | ||
"homepage": "https://github.com/Wappsto/wappsto-redux#readme", | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "yarn lint && yarn test" | ||
} | ||
}, | ||
"engines": { | ||
"node": ">=16" | ||
}, | ||
"dependencies": { | ||
"deep-equal": "^2.1.0", | ||
"normalizr": "^3.6.2", | ||
"query-string": "^7.1.1", | ||
"react": "^18.1.0", | ||
"redux": "^4.2.0", | ||
"redux-thunk": "^2.4.1", | ||
"regenerator-runtime": "^0.13.10", | ||
"reselect": "^4.1.6" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.19.3", | ||
"@babel/core": "^7.19.6", | ||
"@babel/eslint-parser": "^7.19.1", | ||
"@babel/plugin-syntax-flow": "^7.14.5", | ||
"@babel/plugin-transform-react-jsx": "^7.14.9", | ||
"@babel/preset-env": "^7.19.4", | ||
"@babel/preset-react": "^7.18.6", | ||
"babel-jest": "^29.2.2", | ||
"eslint": "^8.26.0", | ||
"eslint-config-airbnb": "^19.0.4", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jest": "^27.1.3", | ||
"eslint-plugin-jsx-a11y": "^6.5.1", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"eslint-plugin-react": "^7.31.10", | ||
"eslint-plugin-react-hooks": "^4.3.0", | ||
"eslint-plugin-react-redux": "^4.0.0", | ||
"husky": "^8.0.1", | ||
"jest": "^29.2.2", | ||
"jest-environment-jsdom": "^29.2.2", | ||
"jest-fetch-mock": "^3.0.3", | ||
"jest-websocket-mock": "^2.4.0", | ||
"lint-staged": "^13.0.3", | ||
"prettier": "^2.7.1", | ||
"pretty-quick": "^3.1.3", | ||
"react-scripts": "^5.0.1", | ||
"react-test-renderer": "^18.1.0" | ||
}, | ||
"lint-staged": { | ||
"*.js": "npm run lint:fix" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115058
2186
28
Updateddeep-equal@^2.1.0
Updatedreact@^18.1.0
Updatedregenerator-runtime@^0.13.10