backendless 6.4.0 → 6.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backendless.d.ts +336 -0
- package/dist/backendless.js +1903 -3
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/hive/constants.js +14 -0
- package/es/hive/index.js +81 -0
- package/es/hive/stores/base-store.js +249 -0
- package/es/hive/stores/index.js +70 -0
- package/es/hive/stores/key-value.js +159 -0
- package/es/hive/stores/list.js +234 -0
- package/es/hive/stores/map.js +224 -0
- package/es/hive/stores/set.js +224 -0
- package/es/hive/stores/sorted-set.js +491 -0
- package/es/hive/utils.js +19 -0
- package/es/index.js +8 -0
- package/es/urls.js +16 -2
- package/es/utils.js +3 -0
- package/lib/hive/constants.js +14 -0
- package/lib/hive/index.js +81 -0
- package/lib/hive/stores/base-store.js +249 -0
- package/lib/hive/stores/index.js +70 -0
- package/lib/hive/stores/key-value.js +159 -0
- package/lib/hive/stores/list.js +234 -0
- package/lib/hive/stores/map.js +224 -0
- package/lib/hive/stores/set.js +224 -0
- package/lib/hive/stores/sorted-set.js +491 -0
- package/lib/hive/utils.js +19 -0
- package/lib/index.js +8 -0
- package/lib/urls.js +16 -2
- package/lib/utils.js +3 -0
- package/package.json +1 -1
- package/src/hive/constants.js +7 -0
- package/src/hive/index.js +60 -0
- package/src/hive/stores/base-store.js +173 -0
- package/src/hive/stores/index.js +5 -0
- package/src/hive/stores/key-value.js +113 -0
- package/src/hive/stores/list.js +189 -0
- package/src/hive/stores/map.js +181 -0
- package/src/hive/stores/set.js +180 -0
- package/src/hive/stores/sorted-set.js +419 -0
- package/src/hive/utils.js +13 -0
- package/src/index.js +5 -0
- package/src/urls.js +11 -1
- package/src/utils.js +4 -0
package/dist/backendless.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ********************************************************************************************************************
|
|
3
|
-
* Backendless SDK for JavaScript. Version: 6.
|
|
3
|
+
* Backendless SDK for JavaScript. Version: 6.5.1
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2012-2022 BACKENDLESS.COM. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -18538,6 +18538,1881 @@ exports["default"] = _default;
|
|
|
18538
18538
|
|
|
18539
18539
|
/***/ }),
|
|
18540
18540
|
|
|
18541
|
+
/***/ "./src/hive/constants.js":
|
|
18542
|
+
/*!*******************************!*\
|
|
18543
|
+
!*** ./src/hive/constants.js ***!
|
|
18544
|
+
\*******************************/
|
|
18545
|
+
/*! no static exports found */
|
|
18546
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
18547
|
+
|
|
18548
|
+
"use strict";
|
|
18549
|
+
|
|
18550
|
+
|
|
18551
|
+
Object.defineProperty(exports, "__esModule", {
|
|
18552
|
+
value: true
|
|
18553
|
+
});
|
|
18554
|
+
exports.HiveTypes = void 0;
|
|
18555
|
+
var HiveTypes = {
|
|
18556
|
+
KEY_VALUE: 'key-value',
|
|
18557
|
+
LIST: 'list',
|
|
18558
|
+
MAP: 'map',
|
|
18559
|
+
SET: 'set',
|
|
18560
|
+
SORTED_SET: 'sorted-set'
|
|
18561
|
+
};
|
|
18562
|
+
exports.HiveTypes = HiveTypes;
|
|
18563
|
+
|
|
18564
|
+
/***/ }),
|
|
18565
|
+
|
|
18566
|
+
/***/ "./src/hive/index.js":
|
|
18567
|
+
/*!***************************!*\
|
|
18568
|
+
!*** ./src/hive/index.js ***!
|
|
18569
|
+
\***************************/
|
|
18570
|
+
/*! no static exports found */
|
|
18571
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
18572
|
+
|
|
18573
|
+
"use strict";
|
|
18574
|
+
|
|
18575
|
+
|
|
18576
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
18577
|
+
|
|
18578
|
+
Object.defineProperty(exports, "__esModule", {
|
|
18579
|
+
value: true
|
|
18580
|
+
});
|
|
18581
|
+
exports["default"] = HiveService;
|
|
18582
|
+
exports.DataHive = void 0;
|
|
18583
|
+
|
|
18584
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
18585
|
+
|
|
18586
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
18587
|
+
|
|
18588
|
+
var _stores = __webpack_require__(/*! ./stores */ "./src/hive/stores/index.js");
|
|
18589
|
+
|
|
18590
|
+
function HiveService(app) {
|
|
18591
|
+
function getHive(name) {
|
|
18592
|
+
if (!name || typeof name !== 'string') {
|
|
18593
|
+
throw new Error('Hive name must be provided and must be a string.');
|
|
18594
|
+
}
|
|
18595
|
+
|
|
18596
|
+
return new DataHive(name, {
|
|
18597
|
+
app: app
|
|
18598
|
+
});
|
|
18599
|
+
}
|
|
18600
|
+
|
|
18601
|
+
getHive.getNames = function () {
|
|
18602
|
+
return app.request.get({
|
|
18603
|
+
url: app.urls.dataHives()
|
|
18604
|
+
});
|
|
18605
|
+
};
|
|
18606
|
+
|
|
18607
|
+
return getHive;
|
|
18608
|
+
}
|
|
18609
|
+
|
|
18610
|
+
var DataHive = /*#__PURE__*/function () {
|
|
18611
|
+
function DataHive(name, context) {
|
|
18612
|
+
(0, _classCallCheck2["default"])(this, DataHive);
|
|
18613
|
+
this.hiveName = name;
|
|
18614
|
+
this.app = context.app;
|
|
18615
|
+
this.KeyValueStore = _stores.KeyValueStore.registerType(this);
|
|
18616
|
+
this.ListStore = _stores.ListStore.registerType(this);
|
|
18617
|
+
this.MapStore = _stores.MapStore.registerType(this);
|
|
18618
|
+
this.SetStore = _stores.SetStore.registerType(this);
|
|
18619
|
+
this.SortedSetStore = _stores.SortedSetStore.registerType(this);
|
|
18620
|
+
}
|
|
18621
|
+
|
|
18622
|
+
(0, _createClass2["default"])(DataHive, [{
|
|
18623
|
+
key: "create",
|
|
18624
|
+
value: function create() {
|
|
18625
|
+
return this.app.request.post({
|
|
18626
|
+
url: this.app.urls.dataHive(this.hiveName)
|
|
18627
|
+
});
|
|
18628
|
+
}
|
|
18629
|
+
}, {
|
|
18630
|
+
key: "delete",
|
|
18631
|
+
value: function _delete() {
|
|
18632
|
+
return this.app.request["delete"]({
|
|
18633
|
+
url: this.app.urls.dataHive(this.hiveName)
|
|
18634
|
+
});
|
|
18635
|
+
}
|
|
18636
|
+
}, {
|
|
18637
|
+
key: "rename",
|
|
18638
|
+
value: function rename(newName) {
|
|
18639
|
+
if (!newName || typeof newName !== 'string') {
|
|
18640
|
+
throw new Error('New Hive name must be provided and must be a string.');
|
|
18641
|
+
}
|
|
18642
|
+
|
|
18643
|
+
return this.app.request.put({
|
|
18644
|
+
url: this.app.urls.dataHive(this.hiveName),
|
|
18645
|
+
query: {
|
|
18646
|
+
newName: newName
|
|
18647
|
+
}
|
|
18648
|
+
});
|
|
18649
|
+
}
|
|
18650
|
+
}]);
|
|
18651
|
+
return DataHive;
|
|
18652
|
+
}();
|
|
18653
|
+
|
|
18654
|
+
exports.DataHive = DataHive;
|
|
18655
|
+
|
|
18656
|
+
/***/ }),
|
|
18657
|
+
|
|
18658
|
+
/***/ "./src/hive/stores/base-store.js":
|
|
18659
|
+
/*!***************************************!*\
|
|
18660
|
+
!*** ./src/hive/stores/base-store.js ***!
|
|
18661
|
+
\***************************************/
|
|
18662
|
+
/*! no static exports found */
|
|
18663
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
18664
|
+
|
|
18665
|
+
"use strict";
|
|
18666
|
+
|
|
18667
|
+
|
|
18668
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
18669
|
+
|
|
18670
|
+
Object.defineProperty(exports, "__esModule", {
|
|
18671
|
+
value: true
|
|
18672
|
+
});
|
|
18673
|
+
exports.HiveStore = void 0;
|
|
18674
|
+
|
|
18675
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
18676
|
+
|
|
18677
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
18678
|
+
|
|
18679
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
18680
|
+
|
|
18681
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
18682
|
+
|
|
18683
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
18684
|
+
|
|
18685
|
+
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
18686
|
+
|
|
18687
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
18688
|
+
|
|
18689
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
18690
|
+
|
|
18691
|
+
var HiveStore = /*#__PURE__*/function () {
|
|
18692
|
+
function HiveStore(context, storeKey) {
|
|
18693
|
+
(0, _classCallCheck2["default"])(this, HiveStore);
|
|
18694
|
+
this.TYPE = this.constructor.TYPE;
|
|
18695
|
+
|
|
18696
|
+
if (!storeKey || typeof storeKey !== 'string') {
|
|
18697
|
+
throw new Error('Store key must be a string.');
|
|
18698
|
+
}
|
|
18699
|
+
|
|
18700
|
+
this.app = context.app;
|
|
18701
|
+
this.hiveName = context.hiveName;
|
|
18702
|
+
this.storeKey = storeKey;
|
|
18703
|
+
}
|
|
18704
|
+
|
|
18705
|
+
(0, _createClass2["default"])(HiveStore, [{
|
|
18706
|
+
key: "getBaseURL",
|
|
18707
|
+
value: function getBaseURL() {
|
|
18708
|
+
return "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/").concat(this.storeKey);
|
|
18709
|
+
}
|
|
18710
|
+
}, {
|
|
18711
|
+
key: "delete",
|
|
18712
|
+
value: function _delete() {
|
|
18713
|
+
return this.constructor["delete"].call(_objectSpread(_objectSpread({}, this), this.constructor), [this.storeKey]);
|
|
18714
|
+
}
|
|
18715
|
+
}, {
|
|
18716
|
+
key: "exists",
|
|
18717
|
+
value: function () {
|
|
18718
|
+
var _exists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
18719
|
+
var result;
|
|
18720
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
18721
|
+
while (1) {
|
|
18722
|
+
switch (_context.prev = _context.next) {
|
|
18723
|
+
case 0:
|
|
18724
|
+
_context.next = 2;
|
|
18725
|
+
return this.constructor.exists.call(_objectSpread(_objectSpread({}, this), this.constructor), [this.storeKey]);
|
|
18726
|
+
|
|
18727
|
+
case 2:
|
|
18728
|
+
result = _context.sent;
|
|
18729
|
+
return _context.abrupt("return", !!result);
|
|
18730
|
+
|
|
18731
|
+
case 4:
|
|
18732
|
+
case "end":
|
|
18733
|
+
return _context.stop();
|
|
18734
|
+
}
|
|
18735
|
+
}
|
|
18736
|
+
}, _callee, this);
|
|
18737
|
+
}));
|
|
18738
|
+
|
|
18739
|
+
function exists() {
|
|
18740
|
+
return _exists.apply(this, arguments);
|
|
18741
|
+
}
|
|
18742
|
+
|
|
18743
|
+
return exists;
|
|
18744
|
+
}()
|
|
18745
|
+
}, {
|
|
18746
|
+
key: "rename",
|
|
18747
|
+
value: function rename(newKey, overwrite) {
|
|
18748
|
+
if (!newKey || typeof newKey !== 'string') {
|
|
18749
|
+
throw new Error('New key name must be provided and must be a string.');
|
|
18750
|
+
}
|
|
18751
|
+
|
|
18752
|
+
if (overwrite !== undefined && typeof overwrite !== 'boolean') {
|
|
18753
|
+
throw new Error('Overwrite must be a boolean.');
|
|
18754
|
+
}
|
|
18755
|
+
|
|
18756
|
+
return this.app.request.put({
|
|
18757
|
+
url: "".concat(this.getBaseURL(), "/rename"),
|
|
18758
|
+
query: {
|
|
18759
|
+
newKey: newKey,
|
|
18760
|
+
overwrite: overwrite
|
|
18761
|
+
}
|
|
18762
|
+
});
|
|
18763
|
+
}
|
|
18764
|
+
}, {
|
|
18765
|
+
key: "getExpiration",
|
|
18766
|
+
value: function getExpiration() {
|
|
18767
|
+
return this.app.request.get({
|
|
18768
|
+
url: "".concat(this.getBaseURL(), "/get-expiration-ttl")
|
|
18769
|
+
});
|
|
18770
|
+
}
|
|
18771
|
+
}, {
|
|
18772
|
+
key: "clearExpiration",
|
|
18773
|
+
value: function clearExpiration() {
|
|
18774
|
+
return this.app.request.put({
|
|
18775
|
+
url: "".concat(this.getBaseURL(), "/clear-expiration")
|
|
18776
|
+
});
|
|
18777
|
+
}
|
|
18778
|
+
}, {
|
|
18779
|
+
key: "expireAfter",
|
|
18780
|
+
value: function expireAfter(ttl) {
|
|
18781
|
+
if (isNaN(ttl) || typeof ttl !== 'number') {
|
|
18782
|
+
throw new Error('TTL must be a number.');
|
|
18783
|
+
}
|
|
18784
|
+
|
|
18785
|
+
return this.app.request.put({
|
|
18786
|
+
url: "".concat(this.getBaseURL(), "/expire"),
|
|
18787
|
+
query: {
|
|
18788
|
+
ttl: ttl
|
|
18789
|
+
}
|
|
18790
|
+
});
|
|
18791
|
+
}
|
|
18792
|
+
}, {
|
|
18793
|
+
key: "expireAt",
|
|
18794
|
+
value: function expireAt(unixTime) {
|
|
18795
|
+
if (isNaN(unixTime) || typeof unixTime !== 'number') {
|
|
18796
|
+
throw new Error('Expiration time must be a number.');
|
|
18797
|
+
}
|
|
18798
|
+
|
|
18799
|
+
return this.app.request.put({
|
|
18800
|
+
url: "".concat(this.getBaseURL(), "/expire-at"),
|
|
18801
|
+
query: {
|
|
18802
|
+
unixTime: unixTime
|
|
18803
|
+
}
|
|
18804
|
+
});
|
|
18805
|
+
}
|
|
18806
|
+
}, {
|
|
18807
|
+
key: "touch",
|
|
18808
|
+
value: function touch() {
|
|
18809
|
+
return this.constructor.touch.call(_objectSpread(_objectSpread({}, this), this.constructor), [this.storeKey]);
|
|
18810
|
+
}
|
|
18811
|
+
}, {
|
|
18812
|
+
key: "secondsSinceLastOperation",
|
|
18813
|
+
value: function secondsSinceLastOperation() {
|
|
18814
|
+
return this.app.request.get({
|
|
18815
|
+
url: "".concat(this.getBaseURL(), "/seconds-since-last-operation")
|
|
18816
|
+
});
|
|
18817
|
+
}
|
|
18818
|
+
}], [{
|
|
18819
|
+
key: "registerType",
|
|
18820
|
+
value: function registerType(hive) {
|
|
18821
|
+
var _this = this;
|
|
18822
|
+
|
|
18823
|
+
var context = _objectSpread(_objectSpread({}, this), {}, {
|
|
18824
|
+
app: hive.app,
|
|
18825
|
+
hiveName: hive.hiveName
|
|
18826
|
+
});
|
|
18827
|
+
|
|
18828
|
+
var factory = function factory(storeKey) {
|
|
18829
|
+
return new _this(context, storeKey);
|
|
18830
|
+
};
|
|
18831
|
+
|
|
18832
|
+
this.STATIC_METHODS.forEach(function (methodName) {
|
|
18833
|
+
factory[methodName] = function () {
|
|
18834
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18835
|
+
args[_key] = arguments[_key];
|
|
18836
|
+
}
|
|
18837
|
+
|
|
18838
|
+
return _this[methodName].apply(context, args);
|
|
18839
|
+
};
|
|
18840
|
+
});
|
|
18841
|
+
return factory;
|
|
18842
|
+
}
|
|
18843
|
+
}, {
|
|
18844
|
+
key: "keys",
|
|
18845
|
+
value: function keys(options) {
|
|
18846
|
+
if (options !== undefined) {
|
|
18847
|
+
if (!_utils["default"].isObject(options)) {
|
|
18848
|
+
throw new Error('Options must be an object.');
|
|
18849
|
+
}
|
|
18850
|
+
|
|
18851
|
+
var cursor = options.cursor,
|
|
18852
|
+
pageSize = options.pageSize,
|
|
18853
|
+
filterPattern = options.filterPattern;
|
|
18854
|
+
|
|
18855
|
+
if (cursor !== undefined && (typeof cursor !== 'number' || isNaN(cursor))) {
|
|
18856
|
+
throw new Error('Cursor must be a number.');
|
|
18857
|
+
}
|
|
18858
|
+
|
|
18859
|
+
if (pageSize !== undefined && (typeof pageSize !== 'number' || isNaN(pageSize))) {
|
|
18860
|
+
throw new Error('Page size must be a number.');
|
|
18861
|
+
}
|
|
18862
|
+
|
|
18863
|
+
if (filterPattern !== undefined && (typeof filterPattern !== 'string' || !filterPattern)) {
|
|
18864
|
+
throw new Error('Filter pattern must be a string.');
|
|
18865
|
+
}
|
|
18866
|
+
}
|
|
18867
|
+
|
|
18868
|
+
return this.app.request.get({
|
|
18869
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/keys"),
|
|
18870
|
+
query: options
|
|
18871
|
+
});
|
|
18872
|
+
}
|
|
18873
|
+
}, {
|
|
18874
|
+
key: "delete",
|
|
18875
|
+
value: function _delete(keys) {
|
|
18876
|
+
if (!Array.isArray(keys)) {
|
|
18877
|
+
throw new Error('Keys must be provided and must be a list of strings.');
|
|
18878
|
+
}
|
|
18879
|
+
|
|
18880
|
+
return this.app.request["delete"]({
|
|
18881
|
+
url: this.app.urls.hiveStore(this.hiveName, this.TYPE),
|
|
18882
|
+
data: keys
|
|
18883
|
+
});
|
|
18884
|
+
}
|
|
18885
|
+
}, {
|
|
18886
|
+
key: "exists",
|
|
18887
|
+
value: function exists(keys) {
|
|
18888
|
+
if (!Array.isArray(keys)) {
|
|
18889
|
+
throw new Error('Keys must be provided and must be a list of strings.');
|
|
18890
|
+
}
|
|
18891
|
+
|
|
18892
|
+
return this.app.request.post({
|
|
18893
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/exists"),
|
|
18894
|
+
data: keys
|
|
18895
|
+
});
|
|
18896
|
+
}
|
|
18897
|
+
}, {
|
|
18898
|
+
key: "touch",
|
|
18899
|
+
value: function touch(keys) {
|
|
18900
|
+
if (!Array.isArray(keys)) {
|
|
18901
|
+
throw new Error('Keys must be provided and must be a list of strings.');
|
|
18902
|
+
}
|
|
18903
|
+
|
|
18904
|
+
return this.app.request.put({
|
|
18905
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/touch"),
|
|
18906
|
+
data: keys
|
|
18907
|
+
});
|
|
18908
|
+
}
|
|
18909
|
+
}]);
|
|
18910
|
+
return HiveStore;
|
|
18911
|
+
}();
|
|
18912
|
+
|
|
18913
|
+
exports.HiveStore = HiveStore;
|
|
18914
|
+
(0, _defineProperty2["default"])(HiveStore, "STATIC_METHODS", ['keys', 'delete', 'exists', 'touch']);
|
|
18915
|
+
|
|
18916
|
+
/***/ }),
|
|
18917
|
+
|
|
18918
|
+
/***/ "./src/hive/stores/index.js":
|
|
18919
|
+
/*!**********************************!*\
|
|
18920
|
+
!*** ./src/hive/stores/index.js ***!
|
|
18921
|
+
\**********************************/
|
|
18922
|
+
/*! no static exports found */
|
|
18923
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
18924
|
+
|
|
18925
|
+
"use strict";
|
|
18926
|
+
|
|
18927
|
+
|
|
18928
|
+
Object.defineProperty(exports, "__esModule", {
|
|
18929
|
+
value: true
|
|
18930
|
+
});
|
|
18931
|
+
|
|
18932
|
+
var _keyValue = __webpack_require__(/*! ./key-value */ "./src/hive/stores/key-value.js");
|
|
18933
|
+
|
|
18934
|
+
Object.keys(_keyValue).forEach(function (key) {
|
|
18935
|
+
if (key === "default" || key === "__esModule") return;
|
|
18936
|
+
if (key in exports && exports[key] === _keyValue[key]) return;
|
|
18937
|
+
Object.defineProperty(exports, key, {
|
|
18938
|
+
enumerable: true,
|
|
18939
|
+
get: function get() {
|
|
18940
|
+
return _keyValue[key];
|
|
18941
|
+
}
|
|
18942
|
+
});
|
|
18943
|
+
});
|
|
18944
|
+
|
|
18945
|
+
var _list = __webpack_require__(/*! ./list */ "./src/hive/stores/list.js");
|
|
18946
|
+
|
|
18947
|
+
Object.keys(_list).forEach(function (key) {
|
|
18948
|
+
if (key === "default" || key === "__esModule") return;
|
|
18949
|
+
if (key in exports && exports[key] === _list[key]) return;
|
|
18950
|
+
Object.defineProperty(exports, key, {
|
|
18951
|
+
enumerable: true,
|
|
18952
|
+
get: function get() {
|
|
18953
|
+
return _list[key];
|
|
18954
|
+
}
|
|
18955
|
+
});
|
|
18956
|
+
});
|
|
18957
|
+
|
|
18958
|
+
var _map = __webpack_require__(/*! ./map */ "./src/hive/stores/map.js");
|
|
18959
|
+
|
|
18960
|
+
Object.keys(_map).forEach(function (key) {
|
|
18961
|
+
if (key === "default" || key === "__esModule") return;
|
|
18962
|
+
if (key in exports && exports[key] === _map[key]) return;
|
|
18963
|
+
Object.defineProperty(exports, key, {
|
|
18964
|
+
enumerable: true,
|
|
18965
|
+
get: function get() {
|
|
18966
|
+
return _map[key];
|
|
18967
|
+
}
|
|
18968
|
+
});
|
|
18969
|
+
});
|
|
18970
|
+
|
|
18971
|
+
var _set = __webpack_require__(/*! ./set */ "./src/hive/stores/set.js");
|
|
18972
|
+
|
|
18973
|
+
Object.keys(_set).forEach(function (key) {
|
|
18974
|
+
if (key === "default" || key === "__esModule") return;
|
|
18975
|
+
if (key in exports && exports[key] === _set[key]) return;
|
|
18976
|
+
Object.defineProperty(exports, key, {
|
|
18977
|
+
enumerable: true,
|
|
18978
|
+
get: function get() {
|
|
18979
|
+
return _set[key];
|
|
18980
|
+
}
|
|
18981
|
+
});
|
|
18982
|
+
});
|
|
18983
|
+
|
|
18984
|
+
var _sortedSet = __webpack_require__(/*! ./sorted-set */ "./src/hive/stores/sorted-set.js");
|
|
18985
|
+
|
|
18986
|
+
Object.keys(_sortedSet).forEach(function (key) {
|
|
18987
|
+
if (key === "default" || key === "__esModule") return;
|
|
18988
|
+
if (key in exports && exports[key] === _sortedSet[key]) return;
|
|
18989
|
+
Object.defineProperty(exports, key, {
|
|
18990
|
+
enumerable: true,
|
|
18991
|
+
get: function get() {
|
|
18992
|
+
return _sortedSet[key];
|
|
18993
|
+
}
|
|
18994
|
+
});
|
|
18995
|
+
});
|
|
18996
|
+
|
|
18997
|
+
/***/ }),
|
|
18998
|
+
|
|
18999
|
+
/***/ "./src/hive/stores/key-value.js":
|
|
19000
|
+
/*!**************************************!*\
|
|
19001
|
+
!*** ./src/hive/stores/key-value.js ***!
|
|
19002
|
+
\**************************************/
|
|
19003
|
+
/*! no static exports found */
|
|
19004
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
19005
|
+
|
|
19006
|
+
"use strict";
|
|
19007
|
+
|
|
19008
|
+
|
|
19009
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19010
|
+
|
|
19011
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19012
|
+
value: true
|
|
19013
|
+
});
|
|
19014
|
+
exports.KeyValueStore = void 0;
|
|
19015
|
+
|
|
19016
|
+
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
|
|
19017
|
+
|
|
19018
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
19019
|
+
|
|
19020
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
19021
|
+
|
|
19022
|
+
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"));
|
|
19023
|
+
|
|
19024
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
|
|
19025
|
+
|
|
19026
|
+
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
|
|
19027
|
+
|
|
19028
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
19029
|
+
|
|
19030
|
+
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19031
|
+
|
|
19032
|
+
var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base-store.js");
|
|
19033
|
+
|
|
19034
|
+
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
19035
|
+
|
|
19036
|
+
var _utils2 = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19037
|
+
|
|
19038
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19039
|
+
|
|
19040
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19041
|
+
|
|
19042
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
19043
|
+
|
|
19044
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19045
|
+
|
|
19046
|
+
var KeyValueStore = /*#__PURE__*/function (_HiveStore) {
|
|
19047
|
+
(0, _inherits2["default"])(KeyValueStore, _HiveStore);
|
|
19048
|
+
|
|
19049
|
+
var _super = _createSuper(KeyValueStore);
|
|
19050
|
+
|
|
19051
|
+
function KeyValueStore() {
|
|
19052
|
+
(0, _classCallCheck2["default"])(this, KeyValueStore);
|
|
19053
|
+
return _super.apply(this, arguments);
|
|
19054
|
+
}
|
|
19055
|
+
|
|
19056
|
+
(0, _createClass2["default"])(KeyValueStore, [{
|
|
19057
|
+
key: "get",
|
|
19058
|
+
value: function get() {
|
|
19059
|
+
return this.app.request.get({
|
|
19060
|
+
url: this.getBaseURL()
|
|
19061
|
+
});
|
|
19062
|
+
}
|
|
19063
|
+
}, {
|
|
19064
|
+
key: "set",
|
|
19065
|
+
value: function set(value, options) {
|
|
19066
|
+
return this.constructor.set.apply(_objectSpread(_objectSpread({}, this), this.constructor), [this.storeKey, value, options]);
|
|
19067
|
+
}
|
|
19068
|
+
}, {
|
|
19069
|
+
key: "increment",
|
|
19070
|
+
value: function increment(value) {
|
|
19071
|
+
if (isNaN(value) || typeof value !== 'number') {
|
|
19072
|
+
throw new Error('Value must be provided and must be a number.');
|
|
19073
|
+
}
|
|
19074
|
+
|
|
19075
|
+
return this.app.request.put({
|
|
19076
|
+
url: "".concat(this.getBaseURL(), "/increment"),
|
|
19077
|
+
query: {
|
|
19078
|
+
value: value
|
|
19079
|
+
}
|
|
19080
|
+
});
|
|
19081
|
+
}
|
|
19082
|
+
}, {
|
|
19083
|
+
key: "decrement",
|
|
19084
|
+
value: function decrement(value) {
|
|
19085
|
+
if (isNaN(value) || typeof value !== 'number') {
|
|
19086
|
+
throw new Error('Value must be provided and must be a number.');
|
|
19087
|
+
}
|
|
19088
|
+
|
|
19089
|
+
return this.app.request.put({
|
|
19090
|
+
url: "".concat(this.getBaseURL(), "/decrement"),
|
|
19091
|
+
query: {
|
|
19092
|
+
value: value
|
|
19093
|
+
}
|
|
19094
|
+
});
|
|
19095
|
+
}
|
|
19096
|
+
}], [{
|
|
19097
|
+
key: "get",
|
|
19098
|
+
value: function get(keys) {
|
|
19099
|
+
if (!Array.isArray(keys)) {
|
|
19100
|
+
throw new Error('Keys must be provided and must be a list of strings.');
|
|
19101
|
+
}
|
|
19102
|
+
|
|
19103
|
+
return this.app.request.post({
|
|
19104
|
+
url: this.app.urls.hiveStore(this.hiveName, this.TYPE),
|
|
19105
|
+
data: keys
|
|
19106
|
+
});
|
|
19107
|
+
}
|
|
19108
|
+
}, {
|
|
19109
|
+
key: "set",
|
|
19110
|
+
value: function set(key, value, options) {
|
|
19111
|
+
if (_utils["default"].isObject(key)) {
|
|
19112
|
+
if (!Object.keys(key).length) {
|
|
19113
|
+
throw new Error('Provided object must have at least 1 key.');
|
|
19114
|
+
}
|
|
19115
|
+
|
|
19116
|
+
return this.app.request.put({
|
|
19117
|
+
url: this.app.urls.hiveStore(this.hiveName, this.TYPE),
|
|
19118
|
+
data: key
|
|
19119
|
+
});
|
|
19120
|
+
}
|
|
19121
|
+
|
|
19122
|
+
if (!key || typeof key !== 'string') {
|
|
19123
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19124
|
+
}
|
|
19125
|
+
|
|
19126
|
+
if (options !== undefined) {
|
|
19127
|
+
if (!_utils["default"].isObject(options)) {
|
|
19128
|
+
throw new Error('Options must be an object.');
|
|
19129
|
+
}
|
|
19130
|
+
|
|
19131
|
+
var ttl = options.ttl,
|
|
19132
|
+
expireAt = options.expireAt,
|
|
19133
|
+
condition = options.condition;
|
|
19134
|
+
|
|
19135
|
+
if (ttl !== undefined && (isNaN(ttl) || typeof ttl !== 'number')) {
|
|
19136
|
+
throw new Error('TTL in seconds must be a number.');
|
|
19137
|
+
}
|
|
19138
|
+
|
|
19139
|
+
if (expireAt !== undefined && (isNaN(expireAt) || typeof expireAt !== 'number')) {
|
|
19140
|
+
throw new Error('ExpireAt timestamp must be a number.');
|
|
19141
|
+
}
|
|
19142
|
+
|
|
19143
|
+
if (condition !== undefined && !['IfExists', 'IfNotExists', 'Always'].includes(condition)) {
|
|
19144
|
+
throw new Error('Condition must be one of this values: [IfExists, IfNotExists, Always].');
|
|
19145
|
+
}
|
|
19146
|
+
}
|
|
19147
|
+
|
|
19148
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
19149
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19150
|
+
}
|
|
19151
|
+
|
|
19152
|
+
return this.app.request.put({
|
|
19153
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/").concat(key),
|
|
19154
|
+
data: _objectSpread({
|
|
19155
|
+
value: value
|
|
19156
|
+
}, options)
|
|
19157
|
+
});
|
|
19158
|
+
}
|
|
19159
|
+
}]);
|
|
19160
|
+
return KeyValueStore;
|
|
19161
|
+
}(_baseStore.HiveStore);
|
|
19162
|
+
|
|
19163
|
+
exports.KeyValueStore = KeyValueStore;
|
|
19164
|
+
(0, _defineProperty2["default"])(KeyValueStore, "TYPE", _constants.HiveTypes.KEY_VALUE);
|
|
19165
|
+
(0, _defineProperty2["default"])(KeyValueStore, "STATIC_METHODS", [].concat((0, _toConsumableArray2["default"])(_baseStore.HiveStore.STATIC_METHODS), ['get', 'set']));
|
|
19166
|
+
|
|
19167
|
+
/***/ }),
|
|
19168
|
+
|
|
19169
|
+
/***/ "./src/hive/stores/list.js":
|
|
19170
|
+
/*!*********************************!*\
|
|
19171
|
+
!*** ./src/hive/stores/list.js ***!
|
|
19172
|
+
\*********************************/
|
|
19173
|
+
/*! no static exports found */
|
|
19174
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
19175
|
+
|
|
19176
|
+
"use strict";
|
|
19177
|
+
|
|
19178
|
+
|
|
19179
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19180
|
+
|
|
19181
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19182
|
+
value: true
|
|
19183
|
+
});
|
|
19184
|
+
exports.ListStore = void 0;
|
|
19185
|
+
|
|
19186
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
19187
|
+
|
|
19188
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
19189
|
+
|
|
19190
|
+
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"));
|
|
19191
|
+
|
|
19192
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
|
|
19193
|
+
|
|
19194
|
+
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
|
|
19195
|
+
|
|
19196
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
19197
|
+
|
|
19198
|
+
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19199
|
+
|
|
19200
|
+
var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base-store.js");
|
|
19201
|
+
|
|
19202
|
+
var _utils = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19203
|
+
|
|
19204
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
19205
|
+
|
|
19206
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19207
|
+
|
|
19208
|
+
var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
19209
|
+
(0, _inherits2["default"])(ListStore, _HiveStore);
|
|
19210
|
+
|
|
19211
|
+
var _super = _createSuper(ListStore);
|
|
19212
|
+
|
|
19213
|
+
function ListStore() {
|
|
19214
|
+
(0, _classCallCheck2["default"])(this, ListStore);
|
|
19215
|
+
return _super.apply(this, arguments);
|
|
19216
|
+
}
|
|
19217
|
+
|
|
19218
|
+
(0, _createClass2["default"])(ListStore, [{
|
|
19219
|
+
key: "get",
|
|
19220
|
+
value: function get(from, to) {
|
|
19221
|
+
if (to !== undefined) {
|
|
19222
|
+
if (isNaN(to) || typeof to !== 'number') {
|
|
19223
|
+
throw new Error('Index To must be a number.');
|
|
19224
|
+
}
|
|
19225
|
+
|
|
19226
|
+
if (isNaN(from) || typeof from !== 'number') {
|
|
19227
|
+
throw new Error('Index From must be a number.');
|
|
19228
|
+
}
|
|
19229
|
+
|
|
19230
|
+
return this.app.request.get({
|
|
19231
|
+
url: this.getBaseURL(),
|
|
19232
|
+
query: {
|
|
19233
|
+
from: from,
|
|
19234
|
+
to: to
|
|
19235
|
+
}
|
|
19236
|
+
});
|
|
19237
|
+
}
|
|
19238
|
+
|
|
19239
|
+
if (from !== undefined) {
|
|
19240
|
+
if (isNaN(from) || typeof from !== 'number') {
|
|
19241
|
+
throw new Error('Index must be a number.');
|
|
19242
|
+
}
|
|
19243
|
+
|
|
19244
|
+
return this.app.request.get({
|
|
19245
|
+
url: "".concat(this.getBaseURL(), "/").concat(from)
|
|
19246
|
+
});
|
|
19247
|
+
}
|
|
19248
|
+
|
|
19249
|
+
return this.app.request.get({
|
|
19250
|
+
url: this.getBaseURL()
|
|
19251
|
+
});
|
|
19252
|
+
}
|
|
19253
|
+
}, {
|
|
19254
|
+
key: "set",
|
|
19255
|
+
value: function set(value, index) {
|
|
19256
|
+
if (Array.isArray(value)) {
|
|
19257
|
+
return this.app.request.put({
|
|
19258
|
+
url: this.getBaseURL(),
|
|
19259
|
+
data: value
|
|
19260
|
+
});
|
|
19261
|
+
}
|
|
19262
|
+
|
|
19263
|
+
if (isNaN(index) || typeof index !== 'number') {
|
|
19264
|
+
throw new Error('Index must be a number.');
|
|
19265
|
+
}
|
|
19266
|
+
|
|
19267
|
+
return this.app.request.put({
|
|
19268
|
+
url: "".concat(this.getBaseURL(), "/").concat(index),
|
|
19269
|
+
data: {
|
|
19270
|
+
value: value
|
|
19271
|
+
}
|
|
19272
|
+
});
|
|
19273
|
+
}
|
|
19274
|
+
}, {
|
|
19275
|
+
key: "length",
|
|
19276
|
+
value: function length() {
|
|
19277
|
+
return this.app.request.get({
|
|
19278
|
+
url: "".concat(this.getBaseURL(), "/length")
|
|
19279
|
+
});
|
|
19280
|
+
}
|
|
19281
|
+
}, {
|
|
19282
|
+
key: "insertBefore",
|
|
19283
|
+
value: function insertBefore(valueToInsert, anchorValue) {
|
|
19284
|
+
return this.insert(valueToInsert, anchorValue, true);
|
|
19285
|
+
}
|
|
19286
|
+
}, {
|
|
19287
|
+
key: "insertAfter",
|
|
19288
|
+
value: function insertAfter(valueToInsert, anchorValue) {
|
|
19289
|
+
return this.insert(valueToInsert, anchorValue, false);
|
|
19290
|
+
}
|
|
19291
|
+
}, {
|
|
19292
|
+
key: "insert",
|
|
19293
|
+
value: function insert(valueToInsert, anchorValue, before) {
|
|
19294
|
+
if (!(0, _utils.isHiveValueValid)(valueToInsert)) {
|
|
19295
|
+
throw new Error('ValueToInsert must be provided and must be on of types: string, number, boolean, object, array.');
|
|
19296
|
+
}
|
|
19297
|
+
|
|
19298
|
+
if (!(0, _utils.isHiveValueValid)(anchorValue)) {
|
|
19299
|
+
throw new Error('AnchorValue must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19300
|
+
}
|
|
19301
|
+
|
|
19302
|
+
return this.app.request.put({
|
|
19303
|
+
url: "".concat(this.getBaseURL(), "/insert-").concat(before ? 'before' : 'after'),
|
|
19304
|
+
data: {
|
|
19305
|
+
valueToInsert: valueToInsert,
|
|
19306
|
+
anchorValue: anchorValue
|
|
19307
|
+
}
|
|
19308
|
+
});
|
|
19309
|
+
}
|
|
19310
|
+
}, {
|
|
19311
|
+
key: "deleteValue",
|
|
19312
|
+
value: function deleteValue(value, count) {
|
|
19313
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19314
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19315
|
+
}
|
|
19316
|
+
|
|
19317
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19318
|
+
throw new Error('Count must be a number.');
|
|
19319
|
+
}
|
|
19320
|
+
|
|
19321
|
+
return this.app.request.put({
|
|
19322
|
+
url: "".concat(this.getBaseURL(), "/delete-value"),
|
|
19323
|
+
data: {
|
|
19324
|
+
value: value,
|
|
19325
|
+
count: count
|
|
19326
|
+
}
|
|
19327
|
+
});
|
|
19328
|
+
}
|
|
19329
|
+
}, {
|
|
19330
|
+
key: "addFirstValue",
|
|
19331
|
+
value: function addFirstValue(value) {
|
|
19332
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19333
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19334
|
+
}
|
|
19335
|
+
|
|
19336
|
+
return this.app.request.put({
|
|
19337
|
+
url: "".concat(this.getBaseURL(), "/add-first"),
|
|
19338
|
+
data: [value]
|
|
19339
|
+
});
|
|
19340
|
+
}
|
|
19341
|
+
}, {
|
|
19342
|
+
key: "addFirstValues",
|
|
19343
|
+
value: function addFirstValues(values) {
|
|
19344
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19345
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19346
|
+
}
|
|
19347
|
+
|
|
19348
|
+
return this.app.request.put({
|
|
19349
|
+
url: "".concat(this.getBaseURL(), "/add-first"),
|
|
19350
|
+
data: values
|
|
19351
|
+
});
|
|
19352
|
+
}
|
|
19353
|
+
}, {
|
|
19354
|
+
key: "addLastValue",
|
|
19355
|
+
value: function addLastValue(value) {
|
|
19356
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19357
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19358
|
+
}
|
|
19359
|
+
|
|
19360
|
+
return this.app.request.put({
|
|
19361
|
+
url: "".concat(this.getBaseURL(), "/add-last"),
|
|
19362
|
+
data: [value]
|
|
19363
|
+
});
|
|
19364
|
+
}
|
|
19365
|
+
}, {
|
|
19366
|
+
key: "addLastValues",
|
|
19367
|
+
value: function addLastValues(values) {
|
|
19368
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19369
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19370
|
+
}
|
|
19371
|
+
|
|
19372
|
+
return this.app.request.put({
|
|
19373
|
+
url: "".concat(this.getBaseURL(), "/add-last"),
|
|
19374
|
+
data: values
|
|
19375
|
+
});
|
|
19376
|
+
}
|
|
19377
|
+
}, {
|
|
19378
|
+
key: "deleteFirst",
|
|
19379
|
+
value: function deleteFirst(count) {
|
|
19380
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19381
|
+
throw new Error('Count must be a number.');
|
|
19382
|
+
}
|
|
19383
|
+
|
|
19384
|
+
return this.app.request.put({
|
|
19385
|
+
url: "".concat(this.getBaseURL(), "/get-first-and-delete"),
|
|
19386
|
+
query: {
|
|
19387
|
+
count: count
|
|
19388
|
+
}
|
|
19389
|
+
});
|
|
19390
|
+
}
|
|
19391
|
+
}, {
|
|
19392
|
+
key: "deleteLast",
|
|
19393
|
+
value: function deleteLast(count) {
|
|
19394
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19395
|
+
throw new Error('Count must be a number.');
|
|
19396
|
+
}
|
|
19397
|
+
|
|
19398
|
+
return this.app.request.put({
|
|
19399
|
+
url: "".concat(this.getBaseURL(), "/get-last-and-delete"),
|
|
19400
|
+
query: {
|
|
19401
|
+
count: count
|
|
19402
|
+
}
|
|
19403
|
+
});
|
|
19404
|
+
}
|
|
19405
|
+
}]);
|
|
19406
|
+
return ListStore;
|
|
19407
|
+
}(_baseStore.HiveStore);
|
|
19408
|
+
|
|
19409
|
+
exports.ListStore = ListStore;
|
|
19410
|
+
(0, _defineProperty2["default"])(ListStore, "TYPE", _constants.HiveTypes.LIST);
|
|
19411
|
+
|
|
19412
|
+
/***/ }),
|
|
19413
|
+
|
|
19414
|
+
/***/ "./src/hive/stores/map.js":
|
|
19415
|
+
/*!********************************!*\
|
|
19416
|
+
!*** ./src/hive/stores/map.js ***!
|
|
19417
|
+
\********************************/
|
|
19418
|
+
/*! no static exports found */
|
|
19419
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
19420
|
+
|
|
19421
|
+
"use strict";
|
|
19422
|
+
|
|
19423
|
+
|
|
19424
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19425
|
+
|
|
19426
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19427
|
+
value: true
|
|
19428
|
+
});
|
|
19429
|
+
exports.MapStore = void 0;
|
|
19430
|
+
|
|
19431
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
19432
|
+
|
|
19433
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
19434
|
+
|
|
19435
|
+
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"));
|
|
19436
|
+
|
|
19437
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
|
|
19438
|
+
|
|
19439
|
+
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
|
|
19440
|
+
|
|
19441
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
19442
|
+
|
|
19443
|
+
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19444
|
+
|
|
19445
|
+
var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base-store.js");
|
|
19446
|
+
|
|
19447
|
+
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
19448
|
+
|
|
19449
|
+
var _utils2 = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19450
|
+
|
|
19451
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
19452
|
+
|
|
19453
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19454
|
+
|
|
19455
|
+
var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
19456
|
+
(0, _inherits2["default"])(MapStore, _HiveStore);
|
|
19457
|
+
|
|
19458
|
+
var _super = _createSuper(MapStore);
|
|
19459
|
+
|
|
19460
|
+
function MapStore() {
|
|
19461
|
+
(0, _classCallCheck2["default"])(this, MapStore);
|
|
19462
|
+
return _super.apply(this, arguments);
|
|
19463
|
+
}
|
|
19464
|
+
|
|
19465
|
+
(0, _createClass2["default"])(MapStore, [{
|
|
19466
|
+
key: "get",
|
|
19467
|
+
value: function get(keys) {
|
|
19468
|
+
if (keys !== undefined && !(typeof keys === 'string' || Array.isArray(keys))) {
|
|
19469
|
+
throw new Error('Key(s) must be a string or list of strings.');
|
|
19470
|
+
}
|
|
19471
|
+
|
|
19472
|
+
return this.app.request.post({
|
|
19473
|
+
url: this.getBaseURL(),
|
|
19474
|
+
data: _utils["default"].castArray(keys)
|
|
19475
|
+
});
|
|
19476
|
+
}
|
|
19477
|
+
}, {
|
|
19478
|
+
key: "getValue",
|
|
19479
|
+
value: function getValue(key) {
|
|
19480
|
+
if (!key || typeof key !== 'string') {
|
|
19481
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19482
|
+
}
|
|
19483
|
+
|
|
19484
|
+
return this.app.request.get({
|
|
19485
|
+
url: "".concat(this.getBaseURL(), "/get/").concat(key)
|
|
19486
|
+
});
|
|
19487
|
+
}
|
|
19488
|
+
}, {
|
|
19489
|
+
key: "keyExists",
|
|
19490
|
+
value: function keyExists(key) {
|
|
19491
|
+
if (!key || typeof key !== 'string') {
|
|
19492
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19493
|
+
}
|
|
19494
|
+
|
|
19495
|
+
return this.app.request.get({
|
|
19496
|
+
url: "".concat(this.getBaseURL(), "/exists/").concat(key)
|
|
19497
|
+
});
|
|
19498
|
+
}
|
|
19499
|
+
}, {
|
|
19500
|
+
key: "length",
|
|
19501
|
+
value: function length() {
|
|
19502
|
+
return this.app.request.get({
|
|
19503
|
+
url: "".concat(this.getBaseURL(), "/length")
|
|
19504
|
+
});
|
|
19505
|
+
}
|
|
19506
|
+
}, {
|
|
19507
|
+
key: "keys",
|
|
19508
|
+
value: function keys() {
|
|
19509
|
+
return this.app.request.get({
|
|
19510
|
+
url: "".concat(this.getBaseURL(), "/keys")
|
|
19511
|
+
});
|
|
19512
|
+
}
|
|
19513
|
+
}, {
|
|
19514
|
+
key: "values",
|
|
19515
|
+
value: function values() {
|
|
19516
|
+
return this.app.request.get({
|
|
19517
|
+
url: "".concat(this.getBaseURL(), "/values")
|
|
19518
|
+
});
|
|
19519
|
+
}
|
|
19520
|
+
}, {
|
|
19521
|
+
key: "set",
|
|
19522
|
+
value: function set(key, value) {
|
|
19523
|
+
if (!key) {
|
|
19524
|
+
throw new Error('First argument must be provided and must be a string or an object.');
|
|
19525
|
+
}
|
|
19526
|
+
|
|
19527
|
+
if (_utils["default"].isObject(key)) {
|
|
19528
|
+
if (!Object.keys(key).length) {
|
|
19529
|
+
throw new Error('Provided object must have at least 1 key.');
|
|
19530
|
+
}
|
|
19531
|
+
|
|
19532
|
+
return this.app.request.put({
|
|
19533
|
+
url: this.getBaseURL(),
|
|
19534
|
+
data: key
|
|
19535
|
+
});
|
|
19536
|
+
}
|
|
19537
|
+
|
|
19538
|
+
if (typeof key !== 'string') {
|
|
19539
|
+
throw new Error('Key must be a string.');
|
|
19540
|
+
}
|
|
19541
|
+
|
|
19542
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
19543
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19544
|
+
}
|
|
19545
|
+
|
|
19546
|
+
return this.app.request.put({
|
|
19547
|
+
url: "".concat(this.getBaseURL(), "/set/").concat(key),
|
|
19548
|
+
data: {
|
|
19549
|
+
value: value
|
|
19550
|
+
}
|
|
19551
|
+
});
|
|
19552
|
+
}
|
|
19553
|
+
}, {
|
|
19554
|
+
key: "setWithOverwrite",
|
|
19555
|
+
value: function setWithOverwrite(key, value, overwrite) {
|
|
19556
|
+
if (!key || typeof key !== 'string') {
|
|
19557
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19558
|
+
}
|
|
19559
|
+
|
|
19560
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
19561
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19562
|
+
}
|
|
19563
|
+
|
|
19564
|
+
if (overwrite !== undefined && typeof overwrite !== 'boolean') {
|
|
19565
|
+
throw new Error('Overwrite must be a boolean.');
|
|
19566
|
+
}
|
|
19567
|
+
|
|
19568
|
+
return this.app.request.put({
|
|
19569
|
+
url: "".concat(this.getBaseURL(), "/set-with-overwrite/").concat(key),
|
|
19570
|
+
data: {
|
|
19571
|
+
value: value,
|
|
19572
|
+
overwrite: overwrite
|
|
19573
|
+
}
|
|
19574
|
+
});
|
|
19575
|
+
}
|
|
19576
|
+
}, {
|
|
19577
|
+
key: "add",
|
|
19578
|
+
value: function add(data) {
|
|
19579
|
+
if (!_utils["default"].isObject(data)) {
|
|
19580
|
+
throw new Error('Payload must be an object.');
|
|
19581
|
+
}
|
|
19582
|
+
|
|
19583
|
+
if (!Object.keys(data).length) {
|
|
19584
|
+
throw new Error('Provided object must have at least 1 key.');
|
|
19585
|
+
}
|
|
19586
|
+
|
|
19587
|
+
return this.app.request.put({
|
|
19588
|
+
url: "".concat(this.getBaseURL(), "/add"),
|
|
19589
|
+
data: data
|
|
19590
|
+
});
|
|
19591
|
+
}
|
|
19592
|
+
}, {
|
|
19593
|
+
key: "increment",
|
|
19594
|
+
value: function increment(key, count) {
|
|
19595
|
+
if (!key || typeof key !== 'string') {
|
|
19596
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19597
|
+
}
|
|
19598
|
+
|
|
19599
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19600
|
+
throw new Error('Count must be a number.');
|
|
19601
|
+
}
|
|
19602
|
+
|
|
19603
|
+
return this.app.request.put({
|
|
19604
|
+
url: "".concat(this.getBaseURL(), "/increment/").concat(key),
|
|
19605
|
+
query: {
|
|
19606
|
+
count: count
|
|
19607
|
+
}
|
|
19608
|
+
});
|
|
19609
|
+
}
|
|
19610
|
+
}, {
|
|
19611
|
+
key: "decrement",
|
|
19612
|
+
value: function decrement(key, count) {
|
|
19613
|
+
if (!key || typeof key !== 'string') {
|
|
19614
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19615
|
+
}
|
|
19616
|
+
|
|
19617
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19618
|
+
throw new Error('Count must be a number.');
|
|
19619
|
+
}
|
|
19620
|
+
|
|
19621
|
+
return this.app.request.put({
|
|
19622
|
+
url: "".concat(this.getBaseURL(), "/decrement/").concat(key),
|
|
19623
|
+
query: {
|
|
19624
|
+
count: count
|
|
19625
|
+
}
|
|
19626
|
+
});
|
|
19627
|
+
}
|
|
19628
|
+
}, {
|
|
19629
|
+
key: "deleteKeys",
|
|
19630
|
+
value: function deleteKeys(keys) {
|
|
19631
|
+
if (!keys || !(typeof keys === 'string' || Array.isArray(keys))) {
|
|
19632
|
+
throw new Error('Key(s) must be provided and must be a string or list of strings.');
|
|
19633
|
+
}
|
|
19634
|
+
|
|
19635
|
+
return this.app.request["delete"]({
|
|
19636
|
+
url: "".concat(this.getBaseURL(), "/by-obj-keys"),
|
|
19637
|
+
data: _utils["default"].castArray(keys)
|
|
19638
|
+
});
|
|
19639
|
+
}
|
|
19640
|
+
}]);
|
|
19641
|
+
return MapStore;
|
|
19642
|
+
}(_baseStore.HiveStore);
|
|
19643
|
+
|
|
19644
|
+
exports.MapStore = MapStore;
|
|
19645
|
+
(0, _defineProperty2["default"])(MapStore, "TYPE", _constants.HiveTypes.MAP);
|
|
19646
|
+
|
|
19647
|
+
/***/ }),
|
|
19648
|
+
|
|
19649
|
+
/***/ "./src/hive/stores/set.js":
|
|
19650
|
+
/*!********************************!*\
|
|
19651
|
+
!*** ./src/hive/stores/set.js ***!
|
|
19652
|
+
\********************************/
|
|
19653
|
+
/*! no static exports found */
|
|
19654
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
19655
|
+
|
|
19656
|
+
"use strict";
|
|
19657
|
+
|
|
19658
|
+
|
|
19659
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19660
|
+
|
|
19661
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19662
|
+
value: true
|
|
19663
|
+
});
|
|
19664
|
+
exports.SetStore = void 0;
|
|
19665
|
+
|
|
19666
|
+
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
|
|
19667
|
+
|
|
19668
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
19669
|
+
|
|
19670
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
19671
|
+
|
|
19672
|
+
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"));
|
|
19673
|
+
|
|
19674
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
|
|
19675
|
+
|
|
19676
|
+
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
|
|
19677
|
+
|
|
19678
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
19679
|
+
|
|
19680
|
+
var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base-store.js");
|
|
19681
|
+
|
|
19682
|
+
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19683
|
+
|
|
19684
|
+
var _utils = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19685
|
+
|
|
19686
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
19687
|
+
|
|
19688
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19689
|
+
|
|
19690
|
+
var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
19691
|
+
(0, _inherits2["default"])(SetStore, _HiveStore);
|
|
19692
|
+
|
|
19693
|
+
var _super = _createSuper(SetStore);
|
|
19694
|
+
|
|
19695
|
+
function SetStore() {
|
|
19696
|
+
(0, _classCallCheck2["default"])(this, SetStore);
|
|
19697
|
+
return _super.apply(this, arguments);
|
|
19698
|
+
}
|
|
19699
|
+
|
|
19700
|
+
(0, _createClass2["default"])(SetStore, [{
|
|
19701
|
+
key: "get",
|
|
19702
|
+
value: function get() {
|
|
19703
|
+
return this.app.request.get({
|
|
19704
|
+
url: this.getBaseURL()
|
|
19705
|
+
});
|
|
19706
|
+
}
|
|
19707
|
+
}, {
|
|
19708
|
+
key: "getRandom",
|
|
19709
|
+
value: function getRandom(count) {
|
|
19710
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19711
|
+
throw new Error('Count must be a number.');
|
|
19712
|
+
}
|
|
19713
|
+
|
|
19714
|
+
return this.app.request.get({
|
|
19715
|
+
url: "".concat(this.getBaseURL(), "/random"),
|
|
19716
|
+
query: {
|
|
19717
|
+
count: count
|
|
19718
|
+
}
|
|
19719
|
+
});
|
|
19720
|
+
}
|
|
19721
|
+
}, {
|
|
19722
|
+
key: "getRandomAndDelete",
|
|
19723
|
+
value: function getRandomAndDelete(count) {
|
|
19724
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19725
|
+
throw new Error('Count must be a number.');
|
|
19726
|
+
}
|
|
19727
|
+
|
|
19728
|
+
return this.app.request.put({
|
|
19729
|
+
url: "".concat(this.getBaseURL(), "/random"),
|
|
19730
|
+
query: {
|
|
19731
|
+
count: count
|
|
19732
|
+
}
|
|
19733
|
+
});
|
|
19734
|
+
}
|
|
19735
|
+
}, {
|
|
19736
|
+
key: "setValue",
|
|
19737
|
+
value: function setValue(value) {
|
|
19738
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19739
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19740
|
+
}
|
|
19741
|
+
|
|
19742
|
+
return this.app.request.put({
|
|
19743
|
+
url: this.getBaseURL(),
|
|
19744
|
+
data: [value]
|
|
19745
|
+
});
|
|
19746
|
+
}
|
|
19747
|
+
}, {
|
|
19748
|
+
key: "setValues",
|
|
19749
|
+
value: function setValues(values) {
|
|
19750
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19751
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19752
|
+
}
|
|
19753
|
+
|
|
19754
|
+
return this.app.request.put({
|
|
19755
|
+
url: this.getBaseURL(),
|
|
19756
|
+
data: values
|
|
19757
|
+
});
|
|
19758
|
+
}
|
|
19759
|
+
}, {
|
|
19760
|
+
key: "addValue",
|
|
19761
|
+
value: function addValue(value) {
|
|
19762
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19763
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19764
|
+
}
|
|
19765
|
+
|
|
19766
|
+
return this.app.request.put({
|
|
19767
|
+
url: "".concat(this.getBaseURL(), "/add"),
|
|
19768
|
+
data: [value]
|
|
19769
|
+
});
|
|
19770
|
+
}
|
|
19771
|
+
}, {
|
|
19772
|
+
key: "addValues",
|
|
19773
|
+
value: function addValues(values) {
|
|
19774
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19775
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19776
|
+
}
|
|
19777
|
+
|
|
19778
|
+
return this.app.request.put({
|
|
19779
|
+
url: "".concat(this.getBaseURL(), "/add"),
|
|
19780
|
+
data: values
|
|
19781
|
+
});
|
|
19782
|
+
}
|
|
19783
|
+
}, {
|
|
19784
|
+
key: "deleteValue",
|
|
19785
|
+
value: function deleteValue(value) {
|
|
19786
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19787
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19788
|
+
}
|
|
19789
|
+
|
|
19790
|
+
return this.app.request["delete"]({
|
|
19791
|
+
url: "".concat(this.getBaseURL(), "/values"),
|
|
19792
|
+
data: [value]
|
|
19793
|
+
});
|
|
19794
|
+
}
|
|
19795
|
+
}, {
|
|
19796
|
+
key: "deleteValues",
|
|
19797
|
+
value: function deleteValues(values) {
|
|
19798
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19799
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19800
|
+
}
|
|
19801
|
+
|
|
19802
|
+
return this.app.request["delete"]({
|
|
19803
|
+
url: "".concat(this.getBaseURL(), "/values"),
|
|
19804
|
+
data: values
|
|
19805
|
+
});
|
|
19806
|
+
}
|
|
19807
|
+
}, {
|
|
19808
|
+
key: "isValueMember",
|
|
19809
|
+
value: function isValueMember(value) {
|
|
19810
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19811
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19812
|
+
}
|
|
19813
|
+
|
|
19814
|
+
return this.app.request.post({
|
|
19815
|
+
url: "".concat(this.getBaseURL(), "/contains"),
|
|
19816
|
+
data: [value]
|
|
19817
|
+
});
|
|
19818
|
+
}
|
|
19819
|
+
}, {
|
|
19820
|
+
key: "isValuesMembers",
|
|
19821
|
+
value: function isValuesMembers(values) {
|
|
19822
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19823
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19824
|
+
}
|
|
19825
|
+
|
|
19826
|
+
return this.app.request.post({
|
|
19827
|
+
url: "".concat(this.getBaseURL(), "/contains"),
|
|
19828
|
+
data: values
|
|
19829
|
+
});
|
|
19830
|
+
}
|
|
19831
|
+
}, {
|
|
19832
|
+
key: "length",
|
|
19833
|
+
value: function length() {
|
|
19834
|
+
return this.app.request.get({
|
|
19835
|
+
url: "".concat(this.getBaseURL(), "/length")
|
|
19836
|
+
});
|
|
19837
|
+
}
|
|
19838
|
+
}], [{
|
|
19839
|
+
key: "difference",
|
|
19840
|
+
value: function difference(keyNames) {
|
|
19841
|
+
if (!Array.isArray(keyNames)) {
|
|
19842
|
+
throw new Error('Store keys must be provided and must be an array.');
|
|
19843
|
+
}
|
|
19844
|
+
|
|
19845
|
+
return this.app.request.post({
|
|
19846
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/difference"),
|
|
19847
|
+
data: keyNames
|
|
19848
|
+
});
|
|
19849
|
+
}
|
|
19850
|
+
}, {
|
|
19851
|
+
key: "intersection",
|
|
19852
|
+
value: function intersection(keyNames) {
|
|
19853
|
+
if (!Array.isArray(keyNames)) {
|
|
19854
|
+
throw new Error('Store keys must be provided and must be an array.');
|
|
19855
|
+
}
|
|
19856
|
+
|
|
19857
|
+
return this.app.request.post({
|
|
19858
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/intersection"),
|
|
19859
|
+
data: keyNames
|
|
19860
|
+
});
|
|
19861
|
+
}
|
|
19862
|
+
}, {
|
|
19863
|
+
key: "union",
|
|
19864
|
+
value: function union(keyNames) {
|
|
19865
|
+
if (!Array.isArray(keyNames)) {
|
|
19866
|
+
throw new Error('Store keys must be provided and must be an array.');
|
|
19867
|
+
}
|
|
19868
|
+
|
|
19869
|
+
return this.app.request.post({
|
|
19870
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/union"),
|
|
19871
|
+
data: keyNames
|
|
19872
|
+
});
|
|
19873
|
+
}
|
|
19874
|
+
}]);
|
|
19875
|
+
return SetStore;
|
|
19876
|
+
}(_baseStore.HiveStore);
|
|
19877
|
+
|
|
19878
|
+
exports.SetStore = SetStore;
|
|
19879
|
+
(0, _defineProperty2["default"])(SetStore, "TYPE", _constants.HiveTypes.SET);
|
|
19880
|
+
(0, _defineProperty2["default"])(SetStore, "STATIC_METHODS", [].concat((0, _toConsumableArray2["default"])(_baseStore.HiveStore.STATIC_METHODS), ['difference', 'intersection', 'union']));
|
|
19881
|
+
|
|
19882
|
+
/***/ }),
|
|
19883
|
+
|
|
19884
|
+
/***/ "./src/hive/stores/sorted-set.js":
|
|
19885
|
+
/*!***************************************!*\
|
|
19886
|
+
!*** ./src/hive/stores/sorted-set.js ***!
|
|
19887
|
+
\***************************************/
|
|
19888
|
+
/*! no static exports found */
|
|
19889
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
19890
|
+
|
|
19891
|
+
"use strict";
|
|
19892
|
+
|
|
19893
|
+
|
|
19894
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19895
|
+
|
|
19896
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19897
|
+
value: true
|
|
19898
|
+
});
|
|
19899
|
+
exports.SortedSetStore = void 0;
|
|
19900
|
+
|
|
19901
|
+
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
|
|
19902
|
+
|
|
19903
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
19904
|
+
|
|
19905
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
19906
|
+
|
|
19907
|
+
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"));
|
|
19908
|
+
|
|
19909
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
|
|
19910
|
+
|
|
19911
|
+
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
|
|
19912
|
+
|
|
19913
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
19914
|
+
|
|
19915
|
+
var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base-store.js");
|
|
19916
|
+
|
|
19917
|
+
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19918
|
+
|
|
19919
|
+
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
19920
|
+
|
|
19921
|
+
var _set = __webpack_require__(/*! ./set */ "./src/hive/stores/set.js");
|
|
19922
|
+
|
|
19923
|
+
var _utils2 = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19924
|
+
|
|
19925
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19926
|
+
|
|
19927
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
19928
|
+
|
|
19929
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
19930
|
+
|
|
19931
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
19932
|
+
|
|
19933
|
+
var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
19934
|
+
(0, _inherits2["default"])(SortedSetStore, _HiveStore);
|
|
19935
|
+
|
|
19936
|
+
var _super = _createSuper(SortedSetStore);
|
|
19937
|
+
|
|
19938
|
+
function SortedSetStore() {
|
|
19939
|
+
(0, _classCallCheck2["default"])(this, SortedSetStore);
|
|
19940
|
+
return _super.apply(this, arguments);
|
|
19941
|
+
}
|
|
19942
|
+
|
|
19943
|
+
(0, _createClass2["default"])(SortedSetStore, [{
|
|
19944
|
+
key: "add",
|
|
19945
|
+
value: function add(items, options) {
|
|
19946
|
+
if (!items || !Array.isArray(items)) {
|
|
19947
|
+
throw new Error('Items must be provided and must be an array.');
|
|
19948
|
+
}
|
|
19949
|
+
|
|
19950
|
+
if (options !== undefined) {
|
|
19951
|
+
if (!_utils["default"].isObject(options)) {
|
|
19952
|
+
throw new Error('Options must be an object.');
|
|
19953
|
+
}
|
|
19954
|
+
|
|
19955
|
+
var duplicateBehaviour = options.duplicateBehaviour,
|
|
19956
|
+
scoreUpdateMode = options.scoreUpdateMode,
|
|
19957
|
+
resultType = options.resultType;
|
|
19958
|
+
|
|
19959
|
+
if (duplicateBehaviour !== undefined && !['OnlyUpdate', 'AlwaysAdd'].includes(duplicateBehaviour)) {
|
|
19960
|
+
throw new Error('Duplicate Behaviour argument must be one of this values: OnlyUpdate, AlwaysAdd.');
|
|
19961
|
+
}
|
|
19962
|
+
|
|
19963
|
+
if (scoreUpdateMode !== undefined && !['Greater', 'Less'].includes(scoreUpdateMode)) {
|
|
19964
|
+
throw new Error('Score Update Mode argument must be one of this values: Greater, Less.');
|
|
19965
|
+
}
|
|
19966
|
+
|
|
19967
|
+
if (resultType !== undefined && !['NewAdded', 'TotalChanged'].includes(resultType)) {
|
|
19968
|
+
throw new Error('Result Type must be one of this values: NewAdded, TotalChanged.');
|
|
19969
|
+
}
|
|
19970
|
+
}
|
|
19971
|
+
|
|
19972
|
+
return this.app.request.put({
|
|
19973
|
+
url: "".concat(this.getBaseURL(), "/add"),
|
|
19974
|
+
data: _objectSpread({
|
|
19975
|
+
items: items
|
|
19976
|
+
}, options)
|
|
19977
|
+
});
|
|
19978
|
+
}
|
|
19979
|
+
}, {
|
|
19980
|
+
key: "set",
|
|
19981
|
+
value: function set(items, options) {
|
|
19982
|
+
if (!items || !Array.isArray(items)) {
|
|
19983
|
+
throw new Error('Items must be provided and must be an array.');
|
|
19984
|
+
}
|
|
19985
|
+
|
|
19986
|
+
if (options !== undefined) {
|
|
19987
|
+
if (!_utils["default"].isObject(options)) {
|
|
19988
|
+
throw new Error('Options must be an object.');
|
|
19989
|
+
}
|
|
19990
|
+
|
|
19991
|
+
var duplicateBehaviour = options.duplicateBehaviour,
|
|
19992
|
+
scoreUpdateMode = options.scoreUpdateMode,
|
|
19993
|
+
resultType = options.resultType;
|
|
19994
|
+
|
|
19995
|
+
if (duplicateBehaviour !== undefined && !['OnlyUpdate', 'AlwaysAdd'].includes(duplicateBehaviour)) {
|
|
19996
|
+
throw new Error('Duplicate Behaviour argument must be one of this values: OnlyUpdate, AlwaysAdd.');
|
|
19997
|
+
}
|
|
19998
|
+
|
|
19999
|
+
if (scoreUpdateMode !== undefined && !['Greater', 'Less'].includes(scoreUpdateMode)) {
|
|
20000
|
+
throw new Error('Score Update Mode argument must be one of this values: Greater, Less.');
|
|
20001
|
+
}
|
|
20002
|
+
|
|
20003
|
+
if (resultType !== undefined && !['NewAdded', 'TotalChanged'].includes(resultType)) {
|
|
20004
|
+
throw new Error('Result Type must be one of this values: NewAdded, TotalChanged.');
|
|
20005
|
+
}
|
|
20006
|
+
} //TODO: Waining for BKNDLSS-28543
|
|
20007
|
+
|
|
20008
|
+
|
|
20009
|
+
return this.app.request.put({
|
|
20010
|
+
url: this.getBaseURL(),
|
|
20011
|
+
data: _objectSpread({
|
|
20012
|
+
items: items
|
|
20013
|
+
}, options)
|
|
20014
|
+
});
|
|
20015
|
+
}
|
|
20016
|
+
}, {
|
|
20017
|
+
key: "incrementScore",
|
|
20018
|
+
value: function incrementScore(value, scoreValue) {
|
|
20019
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20020
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20021
|
+
}
|
|
20022
|
+
|
|
20023
|
+
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
20024
|
+
throw new Error('ScoreValue must be provided and must be a number.');
|
|
20025
|
+
}
|
|
20026
|
+
|
|
20027
|
+
return this.app.request.put({
|
|
20028
|
+
url: "".concat(this.getBaseURL(), "/increment"),
|
|
20029
|
+
data: {
|
|
20030
|
+
scoreValue: scoreValue,
|
|
20031
|
+
value: value
|
|
20032
|
+
}
|
|
20033
|
+
});
|
|
20034
|
+
}
|
|
20035
|
+
}, {
|
|
20036
|
+
key: "decrementScore",
|
|
20037
|
+
value: function decrementScore(value, scoreValue) {
|
|
20038
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20039
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20040
|
+
}
|
|
20041
|
+
|
|
20042
|
+
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
20043
|
+
throw new Error('ScoreValue must be provided and must be a number.');
|
|
20044
|
+
}
|
|
20045
|
+
|
|
20046
|
+
return this.app.request.put({
|
|
20047
|
+
url: "".concat(this.getBaseURL(), "/decrement"),
|
|
20048
|
+
data: {
|
|
20049
|
+
scoreValue: scoreValue,
|
|
20050
|
+
value: value
|
|
20051
|
+
}
|
|
20052
|
+
});
|
|
20053
|
+
}
|
|
20054
|
+
}, {
|
|
20055
|
+
key: "getAndDeleteMaxScore",
|
|
20056
|
+
value: function getAndDeleteMaxScore(count) {
|
|
20057
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
20058
|
+
throw new Error('Count must be a number.');
|
|
20059
|
+
}
|
|
20060
|
+
|
|
20061
|
+
return this.app.request.put({
|
|
20062
|
+
url: "".concat(this.getBaseURL(), "/get-with-max-score-and-delete"),
|
|
20063
|
+
query: {
|
|
20064
|
+
count: count
|
|
20065
|
+
}
|
|
20066
|
+
});
|
|
20067
|
+
}
|
|
20068
|
+
}, {
|
|
20069
|
+
key: "getAndDeleteMinScore",
|
|
20070
|
+
value: function getAndDeleteMinScore(count) {
|
|
20071
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
20072
|
+
throw new Error('Count must be a number.');
|
|
20073
|
+
}
|
|
20074
|
+
|
|
20075
|
+
return this.app.request.put({
|
|
20076
|
+
url: "".concat(this.getBaseURL(), "/get-with-min-score-and-delete"),
|
|
20077
|
+
query: {
|
|
20078
|
+
count: count
|
|
20079
|
+
}
|
|
20080
|
+
});
|
|
20081
|
+
}
|
|
20082
|
+
}, {
|
|
20083
|
+
key: "getRandom",
|
|
20084
|
+
value: function getRandom(options) {
|
|
20085
|
+
if (options !== undefined) {
|
|
20086
|
+
if (!_utils["default"].isObject(options)) {
|
|
20087
|
+
throw new Error('Options must be an object.');
|
|
20088
|
+
}
|
|
20089
|
+
|
|
20090
|
+
var count = options.count,
|
|
20091
|
+
withScores = options.withScores;
|
|
20092
|
+
|
|
20093
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
20094
|
+
throw new Error('Count must be a number.');
|
|
20095
|
+
}
|
|
20096
|
+
|
|
20097
|
+
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
20098
|
+
throw new Error('With Scores argument must be a boolean.');
|
|
20099
|
+
}
|
|
20100
|
+
}
|
|
20101
|
+
|
|
20102
|
+
return this.app.request.get({
|
|
20103
|
+
url: "".concat(this.getBaseURL(), "/get-random"),
|
|
20104
|
+
query: _objectSpread({}, options)
|
|
20105
|
+
});
|
|
20106
|
+
}
|
|
20107
|
+
}, {
|
|
20108
|
+
key: "getScore",
|
|
20109
|
+
value: function getScore(value) {
|
|
20110
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20111
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20112
|
+
}
|
|
20113
|
+
|
|
20114
|
+
return this.app.request.post({
|
|
20115
|
+
url: "".concat(this.getBaseURL(), "/get-score"),
|
|
20116
|
+
data: {
|
|
20117
|
+
value: value
|
|
20118
|
+
}
|
|
20119
|
+
});
|
|
20120
|
+
}
|
|
20121
|
+
}, {
|
|
20122
|
+
key: "getRank",
|
|
20123
|
+
value: function getRank(value, reverse) {
|
|
20124
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20125
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20126
|
+
}
|
|
20127
|
+
|
|
20128
|
+
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
20129
|
+
throw new Error('Reverse argument must be a boolean.');
|
|
20130
|
+
}
|
|
20131
|
+
|
|
20132
|
+
return this.app.request.post({
|
|
20133
|
+
url: "".concat(this.getBaseURL(), "/get-rank"),
|
|
20134
|
+
data: {
|
|
20135
|
+
value: value,
|
|
20136
|
+
reverse: reverse
|
|
20137
|
+
}
|
|
20138
|
+
});
|
|
20139
|
+
}
|
|
20140
|
+
}, {
|
|
20141
|
+
key: "getRangeByRank",
|
|
20142
|
+
value: function getRangeByRank(startRank, stopRank, options) {
|
|
20143
|
+
if (isNaN(startRank) || typeof startRank !== 'number') {
|
|
20144
|
+
throw new Error('Start Rank must be provided and must be a number.');
|
|
20145
|
+
}
|
|
20146
|
+
|
|
20147
|
+
if (isNaN(stopRank) || typeof stopRank !== 'number') {
|
|
20148
|
+
throw new Error('Stop Rank must be provided and must be a number.');
|
|
20149
|
+
}
|
|
20150
|
+
|
|
20151
|
+
if (options !== undefined) {
|
|
20152
|
+
if (!_utils["default"].isObject(options)) {
|
|
20153
|
+
throw new Error('Options must be an object.');
|
|
20154
|
+
}
|
|
20155
|
+
|
|
20156
|
+
var withScores = options.withScores,
|
|
20157
|
+
reverse = options.reverse;
|
|
20158
|
+
|
|
20159
|
+
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
20160
|
+
throw new Error('With Scores argument must be a boolean.');
|
|
20161
|
+
}
|
|
20162
|
+
|
|
20163
|
+
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
20164
|
+
throw new Error('Reverse argument must be a boolean.');
|
|
20165
|
+
}
|
|
20166
|
+
}
|
|
20167
|
+
|
|
20168
|
+
return this.app.request.get({
|
|
20169
|
+
url: "".concat(this.getBaseURL(), "/get-range-by-rank"),
|
|
20170
|
+
query: _objectSpread({
|
|
20171
|
+
startRank: startRank,
|
|
20172
|
+
stopRank: stopRank
|
|
20173
|
+
}, options)
|
|
20174
|
+
});
|
|
20175
|
+
}
|
|
20176
|
+
}, {
|
|
20177
|
+
key: "getRangeByScore",
|
|
20178
|
+
value: function getRangeByScore(options) {
|
|
20179
|
+
if (options !== undefined) {
|
|
20180
|
+
if (!_utils["default"].isObject(options)) {
|
|
20181
|
+
throw new Error('Options must be an object.');
|
|
20182
|
+
}
|
|
20183
|
+
|
|
20184
|
+
var minScore = options.minScore,
|
|
20185
|
+
maxScore = options.maxScore,
|
|
20186
|
+
minBound = options.minBound,
|
|
20187
|
+
maxBound = options.maxBound,
|
|
20188
|
+
offset = options.offset,
|
|
20189
|
+
count = options.count,
|
|
20190
|
+
withScores = options.withScores,
|
|
20191
|
+
reverse = options.reverse;
|
|
20192
|
+
|
|
20193
|
+
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
20194
|
+
throw new Error('Minimal Score must be a number.');
|
|
20195
|
+
}
|
|
20196
|
+
|
|
20197
|
+
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
20198
|
+
throw new Error('Maximal Score must be a number.');
|
|
20199
|
+
}
|
|
20200
|
+
|
|
20201
|
+
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
20202
|
+
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20203
|
+
}
|
|
20204
|
+
|
|
20205
|
+
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
20206
|
+
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20207
|
+
}
|
|
20208
|
+
|
|
20209
|
+
if (offset !== undefined && (typeof offset !== 'number' || isNaN(offset))) {
|
|
20210
|
+
throw new Error('Offset must be a number.');
|
|
20211
|
+
}
|
|
20212
|
+
|
|
20213
|
+
if (count !== undefined && (typeof count !== 'number' || isNaN(count))) {
|
|
20214
|
+
throw new Error('Count must be a number.');
|
|
20215
|
+
}
|
|
20216
|
+
|
|
20217
|
+
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
20218
|
+
throw new Error('With Scores argument must be a boolean.');
|
|
20219
|
+
}
|
|
20220
|
+
|
|
20221
|
+
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
20222
|
+
throw new Error('Reverse argument must be a boolean.');
|
|
20223
|
+
}
|
|
20224
|
+
}
|
|
20225
|
+
|
|
20226
|
+
return this.app.request.get({
|
|
20227
|
+
url: "".concat(this.getBaseURL(), "/get-range-by-score"),
|
|
20228
|
+
query: _objectSpread({}, options)
|
|
20229
|
+
});
|
|
20230
|
+
}
|
|
20231
|
+
}, {
|
|
20232
|
+
key: "deleteValue",
|
|
20233
|
+
value: function deleteValue(value) {
|
|
20234
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20235
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20236
|
+
}
|
|
20237
|
+
|
|
20238
|
+
return this.app.request["delete"]({
|
|
20239
|
+
url: "".concat(this.getBaseURL(), "/values"),
|
|
20240
|
+
data: [value]
|
|
20241
|
+
});
|
|
20242
|
+
}
|
|
20243
|
+
}, {
|
|
20244
|
+
key: "deleteValues",
|
|
20245
|
+
value: function deleteValues(values) {
|
|
20246
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils2.isHiveValueValid)(values)) {
|
|
20247
|
+
throw new Error('Value must be provided and must be a list of JSON items.');
|
|
20248
|
+
}
|
|
20249
|
+
|
|
20250
|
+
return this.app.request["delete"]({
|
|
20251
|
+
url: "".concat(this.getBaseURL(), "/values"),
|
|
20252
|
+
data: values
|
|
20253
|
+
});
|
|
20254
|
+
}
|
|
20255
|
+
}, {
|
|
20256
|
+
key: "deleteValuesByRank",
|
|
20257
|
+
value: function deleteValuesByRank(startRank, stopRank) {
|
|
20258
|
+
if (isNaN(startRank) || typeof startRank !== 'number') {
|
|
20259
|
+
throw new Error('Start Rank must be provided and must be a number.');
|
|
20260
|
+
}
|
|
20261
|
+
|
|
20262
|
+
if (isNaN(stopRank) || typeof stopRank !== 'number') {
|
|
20263
|
+
throw new Error('Stop Rank must be provided and must be a number.');
|
|
20264
|
+
}
|
|
20265
|
+
|
|
20266
|
+
return this.app.request["delete"]({
|
|
20267
|
+
url: "".concat(this.getBaseURL(), "/delete-by-rank"),
|
|
20268
|
+
query: {
|
|
20269
|
+
startRank: startRank,
|
|
20270
|
+
stopRank: stopRank
|
|
20271
|
+
}
|
|
20272
|
+
});
|
|
20273
|
+
}
|
|
20274
|
+
}, {
|
|
20275
|
+
key: "deleteValuesByScore",
|
|
20276
|
+
value: function deleteValuesByScore(options) {
|
|
20277
|
+
if (options !== undefined) {
|
|
20278
|
+
if (!_utils["default"].isObject(options)) {
|
|
20279
|
+
throw new Error('Options must be an object.');
|
|
20280
|
+
}
|
|
20281
|
+
|
|
20282
|
+
var minScore = options.minScore,
|
|
20283
|
+
maxScore = options.maxScore,
|
|
20284
|
+
minBound = options.minBound,
|
|
20285
|
+
maxBound = options.maxBound;
|
|
20286
|
+
|
|
20287
|
+
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
20288
|
+
throw new Error('Minimal Score must be a number.');
|
|
20289
|
+
}
|
|
20290
|
+
|
|
20291
|
+
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
20292
|
+
throw new Error('Maximal Score must be a number.');
|
|
20293
|
+
}
|
|
20294
|
+
|
|
20295
|
+
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
20296
|
+
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20297
|
+
}
|
|
20298
|
+
|
|
20299
|
+
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
20300
|
+
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20301
|
+
}
|
|
20302
|
+
}
|
|
20303
|
+
|
|
20304
|
+
return this.app.request["delete"]({
|
|
20305
|
+
url: "".concat(this.getBaseURL(), "/delete-by-score"),
|
|
20306
|
+
query: _objectSpread({}, options)
|
|
20307
|
+
});
|
|
20308
|
+
}
|
|
20309
|
+
}, {
|
|
20310
|
+
key: "length",
|
|
20311
|
+
value: function length() {
|
|
20312
|
+
return this.app.request.get({
|
|
20313
|
+
url: "".concat(this.getBaseURL(), "/length")
|
|
20314
|
+
});
|
|
20315
|
+
}
|
|
20316
|
+
}, {
|
|
20317
|
+
key: "countBetweenScores",
|
|
20318
|
+
value: function countBetweenScores(options) {
|
|
20319
|
+
if (options !== undefined) {
|
|
20320
|
+
if (!_utils["default"].isObject(options)) {
|
|
20321
|
+
throw new Error('Options must be an object.');
|
|
20322
|
+
}
|
|
20323
|
+
|
|
20324
|
+
var minScore = options.minScore,
|
|
20325
|
+
maxScore = options.maxScore,
|
|
20326
|
+
minBound = options.minBound,
|
|
20327
|
+
maxBound = options.maxBound;
|
|
20328
|
+
|
|
20329
|
+
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
20330
|
+
throw new Error('Minimal Score must be a number.');
|
|
20331
|
+
}
|
|
20332
|
+
|
|
20333
|
+
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
20334
|
+
throw new Error('Maximal Score must be a number.');
|
|
20335
|
+
}
|
|
20336
|
+
|
|
20337
|
+
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
20338
|
+
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20339
|
+
}
|
|
20340
|
+
|
|
20341
|
+
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
20342
|
+
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20343
|
+
}
|
|
20344
|
+
}
|
|
20345
|
+
|
|
20346
|
+
return this.app.request.get({
|
|
20347
|
+
url: "".concat(this.getBaseURL(), "/count"),
|
|
20348
|
+
query: _objectSpread({}, options)
|
|
20349
|
+
});
|
|
20350
|
+
}
|
|
20351
|
+
}], [{
|
|
20352
|
+
key: "intersection",
|
|
20353
|
+
value: function intersection(keyNames) {
|
|
20354
|
+
if (!Array.isArray(keyNames)) {
|
|
20355
|
+
throw new Error('Store keys must be provided and must be an array.');
|
|
20356
|
+
}
|
|
20357
|
+
|
|
20358
|
+
return this.app.request.post({
|
|
20359
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/intersection"),
|
|
20360
|
+
data: keyNames
|
|
20361
|
+
});
|
|
20362
|
+
}
|
|
20363
|
+
}, {
|
|
20364
|
+
key: "union",
|
|
20365
|
+
value: function union(keyNames) {
|
|
20366
|
+
if (!Array.isArray(keyNames)) {
|
|
20367
|
+
throw new Error('Store keys must be provided and must be an array.');
|
|
20368
|
+
}
|
|
20369
|
+
|
|
20370
|
+
return this.app.request.post({
|
|
20371
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/union"),
|
|
20372
|
+
data: keyNames
|
|
20373
|
+
});
|
|
20374
|
+
}
|
|
20375
|
+
}]);
|
|
20376
|
+
return SortedSetStore;
|
|
20377
|
+
}(_baseStore.HiveStore);
|
|
20378
|
+
|
|
20379
|
+
exports.SortedSetStore = SortedSetStore;
|
|
20380
|
+
(0, _defineProperty2["default"])(SortedSetStore, "TYPE", _constants.HiveTypes.SORTED_SET);
|
|
20381
|
+
(0, _defineProperty2["default"])(SortedSetStore, "STATIC_METHODS", [].concat((0, _toConsumableArray2["default"])(_baseStore.HiveStore.STATIC_METHODS), ['difference', 'intersection', 'union']));
|
|
20382
|
+
(0, _defineProperty2["default"])(SortedSetStore, "difference", _set.SetStore.difference);
|
|
20383
|
+
|
|
20384
|
+
/***/ }),
|
|
20385
|
+
|
|
20386
|
+
/***/ "./src/hive/utils.js":
|
|
20387
|
+
/*!***************************!*\
|
|
20388
|
+
!*** ./src/hive/utils.js ***!
|
|
20389
|
+
\***************************/
|
|
20390
|
+
/*! no static exports found */
|
|
20391
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
20392
|
+
|
|
20393
|
+
"use strict";
|
|
20394
|
+
|
|
20395
|
+
|
|
20396
|
+
Object.defineProperty(exports, "__esModule", {
|
|
20397
|
+
value: true
|
|
20398
|
+
});
|
|
20399
|
+
exports.isHiveValueValid = isHiveValueValid;
|
|
20400
|
+
|
|
20401
|
+
function isHiveValueValid(value) {
|
|
20402
|
+
if (value == null) {
|
|
20403
|
+
return false;
|
|
20404
|
+
}
|
|
20405
|
+
|
|
20406
|
+
try {
|
|
20407
|
+
var json = JSON.stringify(value);
|
|
20408
|
+
return !!json;
|
|
20409
|
+
} catch (_unused) {
|
|
20410
|
+
return false;
|
|
20411
|
+
}
|
|
20412
|
+
}
|
|
20413
|
+
|
|
20414
|
+
/***/ }),
|
|
20415
|
+
|
|
18541
20416
|
/***/ "./src/index.js":
|
|
18542
20417
|
/*!**********************!*\
|
|
18543
20418
|
!*** ./src/index.js ***!
|
|
@@ -18658,6 +20533,9 @@ var SERVICES = {
|
|
|
18658
20533
|
'Data': function Data() {
|
|
18659
20534
|
return __webpack_require__(/*! ./data */ "./src/data/index.js")["default"];
|
|
18660
20535
|
},
|
|
20536
|
+
'Hive': function Hive() {
|
|
20537
|
+
return __webpack_require__(/*! ./hive */ "./src/hive/index.js")["default"];
|
|
20538
|
+
},
|
|
18661
20539
|
'Messaging': function Messaging() {
|
|
18662
20540
|
return __webpack_require__(/*! ./messaging */ "./src/messaging/index.js")["default"];
|
|
18663
20541
|
},
|
|
@@ -18977,6 +20855,11 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
18977
20855
|
get: function get() {
|
|
18978
20856
|
return this.__getService('Data');
|
|
18979
20857
|
}
|
|
20858
|
+
}, {
|
|
20859
|
+
key: "Hive",
|
|
20860
|
+
get: function get() {
|
|
20861
|
+
return this.__getService('Hive');
|
|
20862
|
+
}
|
|
18980
20863
|
}, {
|
|
18981
20864
|
key: "Messaging",
|
|
18982
20865
|
get: function get() {
|
|
@@ -22861,8 +24744,22 @@ var Urls = /*#__PURE__*/function () {
|
|
|
22861
24744
|
key: "transactions",
|
|
22862
24745
|
value: function transactions() {
|
|
22863
24746
|
return "".concat(this.root(), "/transaction/unit-of-work");
|
|
22864
|
-
}
|
|
22865
|
-
|
|
24747
|
+
}
|
|
24748
|
+
}, {
|
|
24749
|
+
key: "dataHives",
|
|
24750
|
+
value: function dataHives() {
|
|
24751
|
+
return "".concat(this.root(), "/hive");
|
|
24752
|
+
}
|
|
24753
|
+
}, {
|
|
24754
|
+
key: "dataHive",
|
|
24755
|
+
value: function dataHive(name) {
|
|
24756
|
+
return "".concat(this.dataHives(), "/").concat(name);
|
|
24757
|
+
}
|
|
24758
|
+
}, {
|
|
24759
|
+
key: "hiveStore",
|
|
24760
|
+
value: function hiveStore(name, storeType) {
|
|
24761
|
+
return "".concat(this.dataHive(name), "/").concat(storeType);
|
|
24762
|
+
}
|
|
22866
24763
|
}, {
|
|
22867
24764
|
key: "messaging",
|
|
22868
24765
|
value: function messaging() {
|
|
@@ -25105,6 +27002,9 @@ var Utils = {
|
|
|
25105
27002
|
};
|
|
25106
27003
|
|
|
25107
27004
|
return "".concat(chr8(), "-").concat(chr4(), "-").concat(chr4(), "-").concat(chr4(), "-").concat(chr12());
|
|
27005
|
+
},
|
|
27006
|
+
isObject: function isObject(obj) {
|
|
27007
|
+
return obj != null && obj.constructor.name === 'Object';
|
|
25108
27008
|
}
|
|
25109
27009
|
};
|
|
25110
27010
|
|