backendless 6.4.0 → 6.5.0
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 +332 -0
- package/dist/backendless.js +1783 -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 +153 -0
- package/es/hive/stores/list.js +210 -0
- package/es/hive/stores/map.js +222 -0
- package/es/hive/stores/set.js +180 -0
- package/es/hive/stores/sorted-set.js +477 -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 +153 -0
- package/lib/hive/stores/list.js +210 -0
- package/lib/hive/stores/map.js +222 -0
- package/lib/hive/stores/set.js +180 -0
- package/lib/hive/stores/sorted-set.js +477 -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 +108 -0
- package/src/hive/stores/list.js +165 -0
- package/src/hive/stores/map.js +180 -0
- package/src/hive/stores/set.js +136 -0
- package/src/hive/stores/sorted-set.js +407 -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.0
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2012-2022 BACKENDLESS.COM. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -18538,6 +18538,1761 @@ 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
|
+
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; }
|
|
19037
|
+
|
|
19038
|
+
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; }
|
|
19039
|
+
|
|
19040
|
+
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); }; }
|
|
19041
|
+
|
|
19042
|
+
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; } }
|
|
19043
|
+
|
|
19044
|
+
var KeyValueStore = /*#__PURE__*/function (_HiveStore) {
|
|
19045
|
+
(0, _inherits2["default"])(KeyValueStore, _HiveStore);
|
|
19046
|
+
|
|
19047
|
+
var _super = _createSuper(KeyValueStore);
|
|
19048
|
+
|
|
19049
|
+
function KeyValueStore() {
|
|
19050
|
+
(0, _classCallCheck2["default"])(this, KeyValueStore);
|
|
19051
|
+
return _super.apply(this, arguments);
|
|
19052
|
+
}
|
|
19053
|
+
|
|
19054
|
+
(0, _createClass2["default"])(KeyValueStore, [{
|
|
19055
|
+
key: "get",
|
|
19056
|
+
value: function get() {
|
|
19057
|
+
return this.app.request.get({
|
|
19058
|
+
url: this.getBaseURL()
|
|
19059
|
+
});
|
|
19060
|
+
}
|
|
19061
|
+
}, {
|
|
19062
|
+
key: "set",
|
|
19063
|
+
value: function set(value, options) {
|
|
19064
|
+
return this.constructor.set.apply(_objectSpread(_objectSpread({}, this), this.constructor), [this.storeKey, value, options]);
|
|
19065
|
+
}
|
|
19066
|
+
}, {
|
|
19067
|
+
key: "increment",
|
|
19068
|
+
value: function increment(value) {
|
|
19069
|
+
if (isNaN(value) || typeof value !== 'number') {
|
|
19070
|
+
throw new Error('Value must be provided and must be a number.');
|
|
19071
|
+
}
|
|
19072
|
+
|
|
19073
|
+
return this.app.request.put({
|
|
19074
|
+
url: "".concat(this.getBaseURL(), "/increment"),
|
|
19075
|
+
query: {
|
|
19076
|
+
value: value
|
|
19077
|
+
}
|
|
19078
|
+
});
|
|
19079
|
+
}
|
|
19080
|
+
}, {
|
|
19081
|
+
key: "decrement",
|
|
19082
|
+
value: function decrement(value) {
|
|
19083
|
+
if (isNaN(value) || typeof value !== 'number') {
|
|
19084
|
+
throw new Error('Value must be provided and must be a number.');
|
|
19085
|
+
}
|
|
19086
|
+
|
|
19087
|
+
return this.app.request.put({
|
|
19088
|
+
url: "".concat(this.getBaseURL(), "/decrement"),
|
|
19089
|
+
query: {
|
|
19090
|
+
value: value
|
|
19091
|
+
}
|
|
19092
|
+
});
|
|
19093
|
+
}
|
|
19094
|
+
}], [{
|
|
19095
|
+
key: "get",
|
|
19096
|
+
value: function get(keys) {
|
|
19097
|
+
if (!Array.isArray(keys)) {
|
|
19098
|
+
throw new Error('Keys must be provided and must be a list of strings.');
|
|
19099
|
+
}
|
|
19100
|
+
|
|
19101
|
+
return this.app.request.post({
|
|
19102
|
+
url: this.app.urls.hiveStore(this.hiveName, this.TYPE),
|
|
19103
|
+
data: keys
|
|
19104
|
+
});
|
|
19105
|
+
}
|
|
19106
|
+
}, {
|
|
19107
|
+
key: "set",
|
|
19108
|
+
value: function set(key, value, options) {
|
|
19109
|
+
if (_utils["default"].isObject(key)) {
|
|
19110
|
+
if (!Object.keys(key).length) {
|
|
19111
|
+
throw new Error('Provided object must have at least 1 key.');
|
|
19112
|
+
}
|
|
19113
|
+
|
|
19114
|
+
return this.app.request.put({
|
|
19115
|
+
url: this.app.urls.hiveStore(this.hiveName, this.TYPE),
|
|
19116
|
+
data: key
|
|
19117
|
+
});
|
|
19118
|
+
}
|
|
19119
|
+
|
|
19120
|
+
if (!key || typeof key !== 'string') {
|
|
19121
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19122
|
+
}
|
|
19123
|
+
|
|
19124
|
+
if (options !== undefined) {
|
|
19125
|
+
if (!_utils["default"].isObject(options)) {
|
|
19126
|
+
throw new Error('Options must be an object.');
|
|
19127
|
+
}
|
|
19128
|
+
|
|
19129
|
+
var ttl = options.ttl,
|
|
19130
|
+
expireAt = options.expireAt,
|
|
19131
|
+
condition = options.condition;
|
|
19132
|
+
|
|
19133
|
+
if (ttl !== undefined && (isNaN(ttl) || typeof ttl !== 'number')) {
|
|
19134
|
+
throw new Error('TTL in seconds must be a number.');
|
|
19135
|
+
}
|
|
19136
|
+
|
|
19137
|
+
if (expireAt !== undefined && (isNaN(expireAt) || typeof expireAt !== 'number')) {
|
|
19138
|
+
throw new Error('ExpireAt timestamp must be a number.');
|
|
19139
|
+
}
|
|
19140
|
+
|
|
19141
|
+
if (condition !== undefined && !['IfExists', 'IfNotExists', 'Always'].includes(condition)) {
|
|
19142
|
+
throw new Error('Condition must be one of this values: [IfExists, IfNotExists, Always].');
|
|
19143
|
+
}
|
|
19144
|
+
}
|
|
19145
|
+
|
|
19146
|
+
return this.app.request.put({
|
|
19147
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/").concat(key),
|
|
19148
|
+
data: _objectSpread({
|
|
19149
|
+
value: value
|
|
19150
|
+
}, options)
|
|
19151
|
+
});
|
|
19152
|
+
}
|
|
19153
|
+
}]);
|
|
19154
|
+
return KeyValueStore;
|
|
19155
|
+
}(_baseStore.HiveStore);
|
|
19156
|
+
|
|
19157
|
+
exports.KeyValueStore = KeyValueStore;
|
|
19158
|
+
(0, _defineProperty2["default"])(KeyValueStore, "TYPE", _constants.HiveTypes.KEY_VALUE);
|
|
19159
|
+
(0, _defineProperty2["default"])(KeyValueStore, "STATIC_METHODS", [].concat((0, _toConsumableArray2["default"])(_baseStore.HiveStore.STATIC_METHODS), ['get', 'set']));
|
|
19160
|
+
|
|
19161
|
+
/***/ }),
|
|
19162
|
+
|
|
19163
|
+
/***/ "./src/hive/stores/list.js":
|
|
19164
|
+
/*!*********************************!*\
|
|
19165
|
+
!*** ./src/hive/stores/list.js ***!
|
|
19166
|
+
\*********************************/
|
|
19167
|
+
/*! no static exports found */
|
|
19168
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
19169
|
+
|
|
19170
|
+
"use strict";
|
|
19171
|
+
|
|
19172
|
+
|
|
19173
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19174
|
+
|
|
19175
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19176
|
+
value: true
|
|
19177
|
+
});
|
|
19178
|
+
exports.ListStore = void 0;
|
|
19179
|
+
|
|
19180
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
19181
|
+
|
|
19182
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
19183
|
+
|
|
19184
|
+
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"));
|
|
19185
|
+
|
|
19186
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
|
|
19187
|
+
|
|
19188
|
+
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
|
|
19189
|
+
|
|
19190
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
19191
|
+
|
|
19192
|
+
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19193
|
+
|
|
19194
|
+
var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base-store.js");
|
|
19195
|
+
|
|
19196
|
+
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
19197
|
+
|
|
19198
|
+
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); }; }
|
|
19199
|
+
|
|
19200
|
+
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; } }
|
|
19201
|
+
|
|
19202
|
+
var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
19203
|
+
(0, _inherits2["default"])(ListStore, _HiveStore);
|
|
19204
|
+
|
|
19205
|
+
var _super = _createSuper(ListStore);
|
|
19206
|
+
|
|
19207
|
+
function ListStore() {
|
|
19208
|
+
(0, _classCallCheck2["default"])(this, ListStore);
|
|
19209
|
+
return _super.apply(this, arguments);
|
|
19210
|
+
}
|
|
19211
|
+
|
|
19212
|
+
(0, _createClass2["default"])(ListStore, [{
|
|
19213
|
+
key: "get",
|
|
19214
|
+
value: function get(from, to) {
|
|
19215
|
+
if (to !== undefined) {
|
|
19216
|
+
if (isNaN(to) || typeof to !== 'number') {
|
|
19217
|
+
throw new Error('Index To must be a number.');
|
|
19218
|
+
}
|
|
19219
|
+
|
|
19220
|
+
if (isNaN(from) || typeof from !== 'number') {
|
|
19221
|
+
throw new Error('Index From must be a number.');
|
|
19222
|
+
}
|
|
19223
|
+
|
|
19224
|
+
return this.app.request.get({
|
|
19225
|
+
url: this.getBaseURL(),
|
|
19226
|
+
query: {
|
|
19227
|
+
from: from,
|
|
19228
|
+
to: to
|
|
19229
|
+
}
|
|
19230
|
+
});
|
|
19231
|
+
}
|
|
19232
|
+
|
|
19233
|
+
if (from !== undefined) {
|
|
19234
|
+
if (isNaN(from) || typeof from !== 'number') {
|
|
19235
|
+
throw new Error('Index must be a number.');
|
|
19236
|
+
}
|
|
19237
|
+
|
|
19238
|
+
return this.app.request.get({
|
|
19239
|
+
url: "".concat(this.getBaseURL(), "/").concat(from)
|
|
19240
|
+
});
|
|
19241
|
+
}
|
|
19242
|
+
|
|
19243
|
+
return this.app.request.get({
|
|
19244
|
+
url: this.getBaseURL()
|
|
19245
|
+
});
|
|
19246
|
+
}
|
|
19247
|
+
}, {
|
|
19248
|
+
key: "set",
|
|
19249
|
+
value: function set(value, index) {
|
|
19250
|
+
if (Array.isArray(value)) {
|
|
19251
|
+
return this.app.request.put({
|
|
19252
|
+
url: this.getBaseURL(),
|
|
19253
|
+
data: value
|
|
19254
|
+
});
|
|
19255
|
+
}
|
|
19256
|
+
|
|
19257
|
+
if (isNaN(index) || typeof index !== 'number') {
|
|
19258
|
+
throw new Error('Index must be a number.');
|
|
19259
|
+
}
|
|
19260
|
+
|
|
19261
|
+
return this.app.request.put({
|
|
19262
|
+
url: "".concat(this.getBaseURL(), "/").concat(index),
|
|
19263
|
+
data: {
|
|
19264
|
+
value: value
|
|
19265
|
+
}
|
|
19266
|
+
});
|
|
19267
|
+
}
|
|
19268
|
+
}, {
|
|
19269
|
+
key: "length",
|
|
19270
|
+
value: function length() {
|
|
19271
|
+
return this.app.request.get({
|
|
19272
|
+
url: "".concat(this.getBaseURL(), "/length")
|
|
19273
|
+
});
|
|
19274
|
+
}
|
|
19275
|
+
}, {
|
|
19276
|
+
key: "insertBefore",
|
|
19277
|
+
value: function insertBefore(valueToInsert, anchorValue) {
|
|
19278
|
+
return this.insert(valueToInsert, anchorValue, true);
|
|
19279
|
+
}
|
|
19280
|
+
}, {
|
|
19281
|
+
key: "insertAfter",
|
|
19282
|
+
value: function insertAfter(valueToInsert, anchorValue) {
|
|
19283
|
+
return this.insert(valueToInsert, anchorValue, false);
|
|
19284
|
+
}
|
|
19285
|
+
}, {
|
|
19286
|
+
key: "insert",
|
|
19287
|
+
value: function insert(valueToInsert, anchorValue, before) {
|
|
19288
|
+
if (!valueToInsert || typeof valueToInsert !== 'string') {
|
|
19289
|
+
throw new Error('ValueToInsert must be provided and must be a string.');
|
|
19290
|
+
}
|
|
19291
|
+
|
|
19292
|
+
if (!anchorValue || typeof anchorValue !== 'string') {
|
|
19293
|
+
throw new Error('AnchorValue must be provided and must be a string.');
|
|
19294
|
+
}
|
|
19295
|
+
|
|
19296
|
+
return this.app.request.put({
|
|
19297
|
+
url: "".concat(this.getBaseURL(), "/insert-").concat(before ? 'before' : 'after'),
|
|
19298
|
+
data: {
|
|
19299
|
+
valueToInsert: valueToInsert,
|
|
19300
|
+
anchorValue: anchorValue
|
|
19301
|
+
}
|
|
19302
|
+
});
|
|
19303
|
+
}
|
|
19304
|
+
}, {
|
|
19305
|
+
key: "deleteValue",
|
|
19306
|
+
value: function deleteValue(value, count) {
|
|
19307
|
+
if (!value || typeof value !== 'string') {
|
|
19308
|
+
throw new Error('Value must be provided and must be a string.');
|
|
19309
|
+
}
|
|
19310
|
+
|
|
19311
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19312
|
+
throw new Error('Count must be a number.');
|
|
19313
|
+
}
|
|
19314
|
+
|
|
19315
|
+
return this.app.request.put({
|
|
19316
|
+
url: "".concat(this.getBaseURL(), "/delete-value"),
|
|
19317
|
+
data: {
|
|
19318
|
+
value: value,
|
|
19319
|
+
count: count
|
|
19320
|
+
}
|
|
19321
|
+
});
|
|
19322
|
+
}
|
|
19323
|
+
}, {
|
|
19324
|
+
key: "addFirst",
|
|
19325
|
+
value: function addFirst(value) {
|
|
19326
|
+
if (!value || !(typeof value === 'string' || Array.isArray(value))) {
|
|
19327
|
+
throw new Error('Value(s) must be provided and must be a string or list of strings.');
|
|
19328
|
+
}
|
|
19329
|
+
|
|
19330
|
+
return this.app.request.put({
|
|
19331
|
+
url: "".concat(this.getBaseURL(), "/add-first"),
|
|
19332
|
+
data: _utils["default"].castArray(value)
|
|
19333
|
+
});
|
|
19334
|
+
}
|
|
19335
|
+
}, {
|
|
19336
|
+
key: "addLast",
|
|
19337
|
+
value: function addLast(value) {
|
|
19338
|
+
if (!value || !(typeof value === 'string' || Array.isArray(value))) {
|
|
19339
|
+
throw new Error('Value(s) must be provided and must be a string or list of strings.');
|
|
19340
|
+
}
|
|
19341
|
+
|
|
19342
|
+
return this.app.request.put({
|
|
19343
|
+
url: "".concat(this.getBaseURL(), "/add-last"),
|
|
19344
|
+
data: _utils["default"].castArray(value)
|
|
19345
|
+
});
|
|
19346
|
+
}
|
|
19347
|
+
}, {
|
|
19348
|
+
key: "deleteFirst",
|
|
19349
|
+
value: function deleteFirst(count) {
|
|
19350
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19351
|
+
throw new Error('Count must be a number.');
|
|
19352
|
+
}
|
|
19353
|
+
|
|
19354
|
+
return this.app.request.put({
|
|
19355
|
+
url: "".concat(this.getBaseURL(), "/get-first-and-delete"),
|
|
19356
|
+
query: {
|
|
19357
|
+
count: count
|
|
19358
|
+
}
|
|
19359
|
+
});
|
|
19360
|
+
}
|
|
19361
|
+
}, {
|
|
19362
|
+
key: "deleteLast",
|
|
19363
|
+
value: function deleteLast(count) {
|
|
19364
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19365
|
+
throw new Error('Count must be a number.');
|
|
19366
|
+
}
|
|
19367
|
+
|
|
19368
|
+
return this.app.request.put({
|
|
19369
|
+
url: "".concat(this.getBaseURL(), "/get-last-and-delete"),
|
|
19370
|
+
query: {
|
|
19371
|
+
count: count
|
|
19372
|
+
}
|
|
19373
|
+
});
|
|
19374
|
+
}
|
|
19375
|
+
}]);
|
|
19376
|
+
return ListStore;
|
|
19377
|
+
}(_baseStore.HiveStore);
|
|
19378
|
+
|
|
19379
|
+
exports.ListStore = ListStore;
|
|
19380
|
+
(0, _defineProperty2["default"])(ListStore, "TYPE", _constants.HiveTypes.LIST);
|
|
19381
|
+
|
|
19382
|
+
/***/ }),
|
|
19383
|
+
|
|
19384
|
+
/***/ "./src/hive/stores/map.js":
|
|
19385
|
+
/*!********************************!*\
|
|
19386
|
+
!*** ./src/hive/stores/map.js ***!
|
|
19387
|
+
\********************************/
|
|
19388
|
+
/*! no static exports found */
|
|
19389
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
19390
|
+
|
|
19391
|
+
"use strict";
|
|
19392
|
+
|
|
19393
|
+
|
|
19394
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19395
|
+
|
|
19396
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19397
|
+
value: true
|
|
19398
|
+
});
|
|
19399
|
+
exports.MapStore = void 0;
|
|
19400
|
+
|
|
19401
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
19402
|
+
|
|
19403
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
19404
|
+
|
|
19405
|
+
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"));
|
|
19406
|
+
|
|
19407
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
|
|
19408
|
+
|
|
19409
|
+
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
|
|
19410
|
+
|
|
19411
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
19412
|
+
|
|
19413
|
+
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19414
|
+
|
|
19415
|
+
var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base-store.js");
|
|
19416
|
+
|
|
19417
|
+
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
19418
|
+
|
|
19419
|
+
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); }; }
|
|
19420
|
+
|
|
19421
|
+
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; } }
|
|
19422
|
+
|
|
19423
|
+
var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
19424
|
+
(0, _inherits2["default"])(MapStore, _HiveStore);
|
|
19425
|
+
|
|
19426
|
+
var _super = _createSuper(MapStore);
|
|
19427
|
+
|
|
19428
|
+
function MapStore() {
|
|
19429
|
+
(0, _classCallCheck2["default"])(this, MapStore);
|
|
19430
|
+
return _super.apply(this, arguments);
|
|
19431
|
+
}
|
|
19432
|
+
|
|
19433
|
+
(0, _createClass2["default"])(MapStore, [{
|
|
19434
|
+
key: "get",
|
|
19435
|
+
value: function get(keys) {
|
|
19436
|
+
if (keys !== undefined && !(typeof keys === 'string' || Array.isArray(keys))) {
|
|
19437
|
+
throw new Error('Key(s) must be a string or list of strings.');
|
|
19438
|
+
}
|
|
19439
|
+
|
|
19440
|
+
return this.app.request.post({
|
|
19441
|
+
url: this.getBaseURL(),
|
|
19442
|
+
data: _utils["default"].castArray(keys)
|
|
19443
|
+
});
|
|
19444
|
+
}
|
|
19445
|
+
}, {
|
|
19446
|
+
key: "getValue",
|
|
19447
|
+
value: function getValue(key) {
|
|
19448
|
+
if (!key || typeof key !== 'string') {
|
|
19449
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19450
|
+
}
|
|
19451
|
+
|
|
19452
|
+
return this.app.request.get({
|
|
19453
|
+
url: "".concat(this.getBaseURL(), "/get/").concat(key)
|
|
19454
|
+
});
|
|
19455
|
+
}
|
|
19456
|
+
}, {
|
|
19457
|
+
key: "keyExists",
|
|
19458
|
+
value: function keyExists(key) {
|
|
19459
|
+
if (!key || typeof key !== 'string') {
|
|
19460
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19461
|
+
}
|
|
19462
|
+
|
|
19463
|
+
return this.app.request.get({
|
|
19464
|
+
url: "".concat(this.getBaseURL(), "/exists/").concat(key)
|
|
19465
|
+
});
|
|
19466
|
+
}
|
|
19467
|
+
}, {
|
|
19468
|
+
key: "length",
|
|
19469
|
+
value: function length() {
|
|
19470
|
+
return this.app.request.get({
|
|
19471
|
+
url: "".concat(this.getBaseURL(), "/length")
|
|
19472
|
+
});
|
|
19473
|
+
}
|
|
19474
|
+
}, {
|
|
19475
|
+
key: "keys",
|
|
19476
|
+
value: function keys() {
|
|
19477
|
+
return this.app.request.get({
|
|
19478
|
+
url: "".concat(this.getBaseURL(), "/keys")
|
|
19479
|
+
});
|
|
19480
|
+
}
|
|
19481
|
+
}, {
|
|
19482
|
+
key: "values",
|
|
19483
|
+
value: function values() {
|
|
19484
|
+
return this.app.request.get({
|
|
19485
|
+
url: "".concat(this.getBaseURL(), "/values")
|
|
19486
|
+
});
|
|
19487
|
+
}
|
|
19488
|
+
}, {
|
|
19489
|
+
key: "set",
|
|
19490
|
+
value: function set(key, value) {
|
|
19491
|
+
if (!key) {
|
|
19492
|
+
throw new Error('First argument must be provided and must be a string or an object.');
|
|
19493
|
+
}
|
|
19494
|
+
|
|
19495
|
+
if (_utils["default"].isObject(key)) {
|
|
19496
|
+
if (!Object.keys(key).length) {
|
|
19497
|
+
throw new Error('Provided object must have at least 1 key.');
|
|
19498
|
+
}
|
|
19499
|
+
|
|
19500
|
+
return this.app.request.put({
|
|
19501
|
+
url: this.getBaseURL(),
|
|
19502
|
+
data: key
|
|
19503
|
+
});
|
|
19504
|
+
}
|
|
19505
|
+
|
|
19506
|
+
if (typeof key !== 'string') {
|
|
19507
|
+
throw new Error('Key must be a string.');
|
|
19508
|
+
}
|
|
19509
|
+
|
|
19510
|
+
if (!value || typeof value !== 'string') {
|
|
19511
|
+
throw new Error('Value must be provided and must be a string.');
|
|
19512
|
+
}
|
|
19513
|
+
|
|
19514
|
+
return this.app.request.put({
|
|
19515
|
+
url: "".concat(this.getBaseURL(), "/set/").concat(key),
|
|
19516
|
+
data: {
|
|
19517
|
+
value: value
|
|
19518
|
+
}
|
|
19519
|
+
});
|
|
19520
|
+
}
|
|
19521
|
+
}, {
|
|
19522
|
+
key: "setWithOverwrite",
|
|
19523
|
+
value: function setWithOverwrite(key, value, overwrite) {
|
|
19524
|
+
if (!key || typeof key !== 'string') {
|
|
19525
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19526
|
+
}
|
|
19527
|
+
|
|
19528
|
+
if (!value || typeof value !== 'string') {
|
|
19529
|
+
throw new Error('Value must be provided and must be a string.');
|
|
19530
|
+
}
|
|
19531
|
+
|
|
19532
|
+
if (overwrite !== undefined && typeof overwrite !== 'boolean') {
|
|
19533
|
+
throw new Error('Overwrite must be a boolean.');
|
|
19534
|
+
}
|
|
19535
|
+
|
|
19536
|
+
return this.app.request.put({
|
|
19537
|
+
url: "".concat(this.getBaseURL(), "/set-with-overwrite/").concat(key),
|
|
19538
|
+
data: {
|
|
19539
|
+
value: value,
|
|
19540
|
+
overwrite: overwrite
|
|
19541
|
+
}
|
|
19542
|
+
});
|
|
19543
|
+
}
|
|
19544
|
+
}, {
|
|
19545
|
+
key: "add",
|
|
19546
|
+
value: function add(data) {
|
|
19547
|
+
if (!_utils["default"].isObject(data)) {
|
|
19548
|
+
throw new Error('Payload must be an object.');
|
|
19549
|
+
}
|
|
19550
|
+
|
|
19551
|
+
if (!Object.keys(data).length) {
|
|
19552
|
+
throw new Error('Provided object must have at least 1 key.');
|
|
19553
|
+
}
|
|
19554
|
+
|
|
19555
|
+
return this.app.request.put({
|
|
19556
|
+
url: "".concat(this.getBaseURL(), "/add"),
|
|
19557
|
+
data: data
|
|
19558
|
+
});
|
|
19559
|
+
}
|
|
19560
|
+
}, {
|
|
19561
|
+
key: "increment",
|
|
19562
|
+
value: function increment(key, count) {
|
|
19563
|
+
if (!key || typeof key !== 'string') {
|
|
19564
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19565
|
+
}
|
|
19566
|
+
|
|
19567
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19568
|
+
throw new Error('Count must be a number.');
|
|
19569
|
+
}
|
|
19570
|
+
|
|
19571
|
+
return this.app.request.put({
|
|
19572
|
+
url: "".concat(this.getBaseURL(), "/increment/").concat(key),
|
|
19573
|
+
query: {
|
|
19574
|
+
count: count
|
|
19575
|
+
}
|
|
19576
|
+
});
|
|
19577
|
+
}
|
|
19578
|
+
}, {
|
|
19579
|
+
key: "decrement",
|
|
19580
|
+
value: function decrement(key, count) {
|
|
19581
|
+
if (!key || typeof key !== 'string') {
|
|
19582
|
+
throw new Error('Key must be provided and must be a string.');
|
|
19583
|
+
}
|
|
19584
|
+
|
|
19585
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19586
|
+
throw new Error('Count must be a number.');
|
|
19587
|
+
}
|
|
19588
|
+
|
|
19589
|
+
return this.app.request.put({
|
|
19590
|
+
url: "".concat(this.getBaseURL(), "/decrement/").concat(key),
|
|
19591
|
+
query: {
|
|
19592
|
+
count: count
|
|
19593
|
+
}
|
|
19594
|
+
});
|
|
19595
|
+
}
|
|
19596
|
+
}, {
|
|
19597
|
+
key: "deleteKeys",
|
|
19598
|
+
value: function deleteKeys(keys) {
|
|
19599
|
+
if (!keys || !(typeof keys === 'string' || Array.isArray(keys))) {
|
|
19600
|
+
throw new Error('Key(s) must be provided and must be a string or list of strings.');
|
|
19601
|
+
}
|
|
19602
|
+
|
|
19603
|
+
return this.app.request["delete"]({
|
|
19604
|
+
url: "".concat(this.getBaseURL(), "/by-obj-keys"),
|
|
19605
|
+
data: _utils["default"].castArray(keys)
|
|
19606
|
+
});
|
|
19607
|
+
}
|
|
19608
|
+
}]);
|
|
19609
|
+
return MapStore;
|
|
19610
|
+
}(_baseStore.HiveStore);
|
|
19611
|
+
|
|
19612
|
+
exports.MapStore = MapStore;
|
|
19613
|
+
(0, _defineProperty2["default"])(MapStore, "TYPE", _constants.HiveTypes.MAP);
|
|
19614
|
+
|
|
19615
|
+
/***/ }),
|
|
19616
|
+
|
|
19617
|
+
/***/ "./src/hive/stores/set.js":
|
|
19618
|
+
/*!********************************!*\
|
|
19619
|
+
!*** ./src/hive/stores/set.js ***!
|
|
19620
|
+
\********************************/
|
|
19621
|
+
/*! no static exports found */
|
|
19622
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
19623
|
+
|
|
19624
|
+
"use strict";
|
|
19625
|
+
|
|
19626
|
+
|
|
19627
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19628
|
+
|
|
19629
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19630
|
+
value: true
|
|
19631
|
+
});
|
|
19632
|
+
exports.SetStore = void 0;
|
|
19633
|
+
|
|
19634
|
+
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
|
|
19635
|
+
|
|
19636
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
19637
|
+
|
|
19638
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
19639
|
+
|
|
19640
|
+
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"));
|
|
19641
|
+
|
|
19642
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
|
|
19643
|
+
|
|
19644
|
+
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
|
|
19645
|
+
|
|
19646
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
19647
|
+
|
|
19648
|
+
var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base-store.js");
|
|
19649
|
+
|
|
19650
|
+
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19651
|
+
|
|
19652
|
+
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
19653
|
+
|
|
19654
|
+
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); }; }
|
|
19655
|
+
|
|
19656
|
+
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; } }
|
|
19657
|
+
|
|
19658
|
+
var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
19659
|
+
(0, _inherits2["default"])(SetStore, _HiveStore);
|
|
19660
|
+
|
|
19661
|
+
var _super = _createSuper(SetStore);
|
|
19662
|
+
|
|
19663
|
+
function SetStore() {
|
|
19664
|
+
(0, _classCallCheck2["default"])(this, SetStore);
|
|
19665
|
+
return _super.apply(this, arguments);
|
|
19666
|
+
}
|
|
19667
|
+
|
|
19668
|
+
(0, _createClass2["default"])(SetStore, [{
|
|
19669
|
+
key: "get",
|
|
19670
|
+
value: function get() {
|
|
19671
|
+
return this.app.request.get({
|
|
19672
|
+
url: this.getBaseURL()
|
|
19673
|
+
});
|
|
19674
|
+
}
|
|
19675
|
+
}, {
|
|
19676
|
+
key: "getRandom",
|
|
19677
|
+
value: function getRandom(count) {
|
|
19678
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19679
|
+
throw new Error('Count must be a number.');
|
|
19680
|
+
}
|
|
19681
|
+
|
|
19682
|
+
return this.app.request.get({
|
|
19683
|
+
url: "".concat(this.getBaseURL(), "/random"),
|
|
19684
|
+
query: {
|
|
19685
|
+
count: count
|
|
19686
|
+
}
|
|
19687
|
+
});
|
|
19688
|
+
}
|
|
19689
|
+
}, {
|
|
19690
|
+
key: "getRandomAndDelete",
|
|
19691
|
+
value: function getRandomAndDelete(count) {
|
|
19692
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19693
|
+
throw new Error('Count must be a number.');
|
|
19694
|
+
}
|
|
19695
|
+
|
|
19696
|
+
return this.app.request.put({
|
|
19697
|
+
url: "".concat(this.getBaseURL(), "/random"),
|
|
19698
|
+
query: {
|
|
19699
|
+
count: count
|
|
19700
|
+
}
|
|
19701
|
+
});
|
|
19702
|
+
}
|
|
19703
|
+
}, {
|
|
19704
|
+
key: "set",
|
|
19705
|
+
value: function set(values) {
|
|
19706
|
+
if (!values || typeof values !== 'string' && !Array.isArray(values)) {
|
|
19707
|
+
throw new Error('Value(s) must be provided and must be a string or list of strings.');
|
|
19708
|
+
}
|
|
19709
|
+
|
|
19710
|
+
return this.app.request.put({
|
|
19711
|
+
url: this.getBaseURL(),
|
|
19712
|
+
data: _utils["default"].castArray(values)
|
|
19713
|
+
});
|
|
19714
|
+
}
|
|
19715
|
+
}, {
|
|
19716
|
+
key: "add",
|
|
19717
|
+
value: function add(values) {
|
|
19718
|
+
if (!values || !(typeof values === 'string' || Array.isArray(values))) {
|
|
19719
|
+
throw new Error('Value(s) must be provided and must be a string or list of strings.');
|
|
19720
|
+
}
|
|
19721
|
+
|
|
19722
|
+
return this.app.request.put({
|
|
19723
|
+
url: "".concat(this.getBaseURL(), "/add"),
|
|
19724
|
+
data: _utils["default"].castArray(values)
|
|
19725
|
+
});
|
|
19726
|
+
}
|
|
19727
|
+
}, {
|
|
19728
|
+
key: "deleteValues",
|
|
19729
|
+
value: function deleteValues(values) {
|
|
19730
|
+
if (!values || !(typeof values === 'string' || Array.isArray(values))) {
|
|
19731
|
+
throw new Error('Value(s) must be provided and must be a string or list of strings.');
|
|
19732
|
+
}
|
|
19733
|
+
|
|
19734
|
+
return this.app.request["delete"]({
|
|
19735
|
+
url: "".concat(this.getBaseURL(), "/values"),
|
|
19736
|
+
data: _utils["default"].castArray(values)
|
|
19737
|
+
});
|
|
19738
|
+
}
|
|
19739
|
+
}, {
|
|
19740
|
+
key: "isMember",
|
|
19741
|
+
value: function isMember(value) {
|
|
19742
|
+
if (typeof value === 'string') {
|
|
19743
|
+
value = [value];
|
|
19744
|
+
}
|
|
19745
|
+
|
|
19746
|
+
if (!Array.isArray(value)) {
|
|
19747
|
+
throw new Error('Value must be provided and must be a string or a list of strings.');
|
|
19748
|
+
}
|
|
19749
|
+
|
|
19750
|
+
return this.app.request.post({
|
|
19751
|
+
url: "".concat(this.getBaseURL(), "/contains"),
|
|
19752
|
+
data: value
|
|
19753
|
+
});
|
|
19754
|
+
}
|
|
19755
|
+
}, {
|
|
19756
|
+
key: "length",
|
|
19757
|
+
value: function length() {
|
|
19758
|
+
return this.app.request.get({
|
|
19759
|
+
url: "".concat(this.getBaseURL(), "/length")
|
|
19760
|
+
});
|
|
19761
|
+
}
|
|
19762
|
+
}], [{
|
|
19763
|
+
key: "difference",
|
|
19764
|
+
value: function difference(keyNames) {
|
|
19765
|
+
if (!Array.isArray(keyNames)) {
|
|
19766
|
+
throw new Error('Store keys must be provided and must be an array.');
|
|
19767
|
+
}
|
|
19768
|
+
|
|
19769
|
+
return this.app.request.post({
|
|
19770
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/difference"),
|
|
19771
|
+
data: keyNames
|
|
19772
|
+
});
|
|
19773
|
+
}
|
|
19774
|
+
}, {
|
|
19775
|
+
key: "intersection",
|
|
19776
|
+
value: function intersection(keyNames) {
|
|
19777
|
+
if (!Array.isArray(keyNames)) {
|
|
19778
|
+
throw new Error('Store keys must be provided and must be an array.');
|
|
19779
|
+
}
|
|
19780
|
+
|
|
19781
|
+
return this.app.request.post({
|
|
19782
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/intersection"),
|
|
19783
|
+
data: keyNames
|
|
19784
|
+
});
|
|
19785
|
+
}
|
|
19786
|
+
}, {
|
|
19787
|
+
key: "union",
|
|
19788
|
+
value: function union(keyNames) {
|
|
19789
|
+
if (!Array.isArray(keyNames)) {
|
|
19790
|
+
throw new Error('Store keys must be provided and must be an array.');
|
|
19791
|
+
}
|
|
19792
|
+
|
|
19793
|
+
return this.app.request.post({
|
|
19794
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/union"),
|
|
19795
|
+
data: keyNames
|
|
19796
|
+
});
|
|
19797
|
+
}
|
|
19798
|
+
}]);
|
|
19799
|
+
return SetStore;
|
|
19800
|
+
}(_baseStore.HiveStore);
|
|
19801
|
+
|
|
19802
|
+
exports.SetStore = SetStore;
|
|
19803
|
+
(0, _defineProperty2["default"])(SetStore, "TYPE", _constants.HiveTypes.SET);
|
|
19804
|
+
(0, _defineProperty2["default"])(SetStore, "STATIC_METHODS", [].concat((0, _toConsumableArray2["default"])(_baseStore.HiveStore.STATIC_METHODS), ['difference', 'intersection', 'union']));
|
|
19805
|
+
|
|
19806
|
+
/***/ }),
|
|
19807
|
+
|
|
19808
|
+
/***/ "./src/hive/stores/sorted-set.js":
|
|
19809
|
+
/*!***************************************!*\
|
|
19810
|
+
!*** ./src/hive/stores/sorted-set.js ***!
|
|
19811
|
+
\***************************************/
|
|
19812
|
+
/*! no static exports found */
|
|
19813
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
19814
|
+
|
|
19815
|
+
"use strict";
|
|
19816
|
+
|
|
19817
|
+
|
|
19818
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
19819
|
+
|
|
19820
|
+
Object.defineProperty(exports, "__esModule", {
|
|
19821
|
+
value: true
|
|
19822
|
+
});
|
|
19823
|
+
exports.SortedSetStore = void 0;
|
|
19824
|
+
|
|
19825
|
+
var _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js"));
|
|
19826
|
+
|
|
19827
|
+
var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js"));
|
|
19828
|
+
|
|
19829
|
+
var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js"));
|
|
19830
|
+
|
|
19831
|
+
var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js"));
|
|
19832
|
+
|
|
19833
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"));
|
|
19834
|
+
|
|
19835
|
+
var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js"));
|
|
19836
|
+
|
|
19837
|
+
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js"));
|
|
19838
|
+
|
|
19839
|
+
var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base-store.js");
|
|
19840
|
+
|
|
19841
|
+
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19842
|
+
|
|
19843
|
+
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
19844
|
+
|
|
19845
|
+
var _set = __webpack_require__(/*! ./set */ "./src/hive/stores/set.js");
|
|
19846
|
+
|
|
19847
|
+
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; }
|
|
19848
|
+
|
|
19849
|
+
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; }
|
|
19850
|
+
|
|
19851
|
+
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); }; }
|
|
19852
|
+
|
|
19853
|
+
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; } }
|
|
19854
|
+
|
|
19855
|
+
var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
19856
|
+
(0, _inherits2["default"])(SortedSetStore, _HiveStore);
|
|
19857
|
+
|
|
19858
|
+
var _super = _createSuper(SortedSetStore);
|
|
19859
|
+
|
|
19860
|
+
function SortedSetStore() {
|
|
19861
|
+
(0, _classCallCheck2["default"])(this, SortedSetStore);
|
|
19862
|
+
return _super.apply(this, arguments);
|
|
19863
|
+
}
|
|
19864
|
+
|
|
19865
|
+
(0, _createClass2["default"])(SortedSetStore, [{
|
|
19866
|
+
key: "add",
|
|
19867
|
+
value: function add(items, options) {
|
|
19868
|
+
if (!items || !Array.isArray(items)) {
|
|
19869
|
+
throw new Error('Items must be provided and must be an array.');
|
|
19870
|
+
}
|
|
19871
|
+
|
|
19872
|
+
if (options !== undefined) {
|
|
19873
|
+
if (!_utils["default"].isObject(options)) {
|
|
19874
|
+
throw new Error('Options must be an object.');
|
|
19875
|
+
}
|
|
19876
|
+
|
|
19877
|
+
var duplicateBehaviour = options.duplicateBehaviour,
|
|
19878
|
+
scoreUpdateMode = options.scoreUpdateMode,
|
|
19879
|
+
resultType = options.resultType;
|
|
19880
|
+
|
|
19881
|
+
if (duplicateBehaviour !== undefined && !['OnlyUpdate', 'AlwaysAdd'].includes(duplicateBehaviour)) {
|
|
19882
|
+
throw new Error('Duplicate Behaviour argument must be one of this values: OnlyUpdate, AlwaysAdd.');
|
|
19883
|
+
}
|
|
19884
|
+
|
|
19885
|
+
if (scoreUpdateMode !== undefined && !['Greater', 'Less'].includes(scoreUpdateMode)) {
|
|
19886
|
+
throw new Error('Score Update Mode argument must be one of this values: Greater, Less.');
|
|
19887
|
+
}
|
|
19888
|
+
|
|
19889
|
+
if (resultType !== undefined && !['NewAdded', 'TotalChanged'].includes(resultType)) {
|
|
19890
|
+
throw new Error('Result Type must be one of this values: NewAdded, TotalChanged.');
|
|
19891
|
+
}
|
|
19892
|
+
}
|
|
19893
|
+
|
|
19894
|
+
return this.app.request.put({
|
|
19895
|
+
url: "".concat(this.getBaseURL(), "/add"),
|
|
19896
|
+
data: _objectSpread({
|
|
19897
|
+
items: items
|
|
19898
|
+
}, options)
|
|
19899
|
+
});
|
|
19900
|
+
}
|
|
19901
|
+
}, {
|
|
19902
|
+
key: "set",
|
|
19903
|
+
value: function set(items, options) {
|
|
19904
|
+
if (!items || !Array.isArray(items)) {
|
|
19905
|
+
throw new Error('Items must be provided and must be an array.');
|
|
19906
|
+
}
|
|
19907
|
+
|
|
19908
|
+
if (options !== undefined) {
|
|
19909
|
+
if (!_utils["default"].isObject(options)) {
|
|
19910
|
+
throw new Error('Options must be an object.');
|
|
19911
|
+
}
|
|
19912
|
+
|
|
19913
|
+
var duplicateBehaviour = options.duplicateBehaviour,
|
|
19914
|
+
scoreUpdateMode = options.scoreUpdateMode,
|
|
19915
|
+
resultType = options.resultType;
|
|
19916
|
+
|
|
19917
|
+
if (duplicateBehaviour !== undefined && !['OnlyUpdate', 'AlwaysAdd'].includes(duplicateBehaviour)) {
|
|
19918
|
+
throw new Error('Duplicate Behaviour argument must be one of this values: OnlyUpdate, AlwaysAdd.');
|
|
19919
|
+
}
|
|
19920
|
+
|
|
19921
|
+
if (scoreUpdateMode !== undefined && !['Greater', 'Less'].includes(scoreUpdateMode)) {
|
|
19922
|
+
throw new Error('Score Update Mode argument must be one of this values: Greater, Less.');
|
|
19923
|
+
}
|
|
19924
|
+
|
|
19925
|
+
if (resultType !== undefined && !['NewAdded', 'TotalChanged'].includes(resultType)) {
|
|
19926
|
+
throw new Error('Result Type must be one of this values: NewAdded, TotalChanged.');
|
|
19927
|
+
}
|
|
19928
|
+
} //TODO: Waining for BKNDLSS-28543
|
|
19929
|
+
|
|
19930
|
+
|
|
19931
|
+
return this.app.request.put({
|
|
19932
|
+
url: this.getBaseURL(),
|
|
19933
|
+
data: _objectSpread({
|
|
19934
|
+
items: items
|
|
19935
|
+
}, options)
|
|
19936
|
+
});
|
|
19937
|
+
}
|
|
19938
|
+
}, {
|
|
19939
|
+
key: "incrementScore",
|
|
19940
|
+
value: function incrementScore(value, scoreValue) {
|
|
19941
|
+
if (!value || typeof value !== 'string') {
|
|
19942
|
+
throw new Error('Value must be provided and must be a string.');
|
|
19943
|
+
}
|
|
19944
|
+
|
|
19945
|
+
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
19946
|
+
throw new Error('ScoreValue must be provided and must be a number.');
|
|
19947
|
+
}
|
|
19948
|
+
|
|
19949
|
+
return this.app.request.put({
|
|
19950
|
+
url: "".concat(this.getBaseURL(), "/increment"),
|
|
19951
|
+
data: {
|
|
19952
|
+
scoreValue: scoreValue,
|
|
19953
|
+
value: value
|
|
19954
|
+
}
|
|
19955
|
+
});
|
|
19956
|
+
}
|
|
19957
|
+
}, {
|
|
19958
|
+
key: "decrementScore",
|
|
19959
|
+
value: function decrementScore(value, scoreValue) {
|
|
19960
|
+
if (!value || typeof value !== 'string') {
|
|
19961
|
+
throw new Error('Value must be provided and must be a string.');
|
|
19962
|
+
}
|
|
19963
|
+
|
|
19964
|
+
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
19965
|
+
throw new Error('ScoreValue must be provided and must be a number.');
|
|
19966
|
+
}
|
|
19967
|
+
|
|
19968
|
+
return this.app.request.put({
|
|
19969
|
+
url: "".concat(this.getBaseURL(), "/decrement"),
|
|
19970
|
+
data: {
|
|
19971
|
+
scoreValue: scoreValue,
|
|
19972
|
+
value: value
|
|
19973
|
+
}
|
|
19974
|
+
});
|
|
19975
|
+
}
|
|
19976
|
+
}, {
|
|
19977
|
+
key: "getAndDeleteMaxScore",
|
|
19978
|
+
value: function getAndDeleteMaxScore(count) {
|
|
19979
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19980
|
+
throw new Error('Count must be a number.');
|
|
19981
|
+
}
|
|
19982
|
+
|
|
19983
|
+
return this.app.request.put({
|
|
19984
|
+
url: "".concat(this.getBaseURL(), "/get-with-max-score-and-delete"),
|
|
19985
|
+
query: {
|
|
19986
|
+
count: count
|
|
19987
|
+
}
|
|
19988
|
+
});
|
|
19989
|
+
}
|
|
19990
|
+
}, {
|
|
19991
|
+
key: "getAndDeleteMinScore",
|
|
19992
|
+
value: function getAndDeleteMinScore(count) {
|
|
19993
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
19994
|
+
throw new Error('Count must be a number.');
|
|
19995
|
+
}
|
|
19996
|
+
|
|
19997
|
+
return this.app.request.put({
|
|
19998
|
+
url: "".concat(this.getBaseURL(), "/get-with-min-score-and-delete"),
|
|
19999
|
+
query: {
|
|
20000
|
+
count: count
|
|
20001
|
+
}
|
|
20002
|
+
});
|
|
20003
|
+
}
|
|
20004
|
+
}, {
|
|
20005
|
+
key: "getRandom",
|
|
20006
|
+
value: function getRandom(options) {
|
|
20007
|
+
if (options !== undefined) {
|
|
20008
|
+
if (!_utils["default"].isObject(options)) {
|
|
20009
|
+
throw new Error('Options must be an object.');
|
|
20010
|
+
}
|
|
20011
|
+
|
|
20012
|
+
var count = options.count,
|
|
20013
|
+
withScores = options.withScores;
|
|
20014
|
+
|
|
20015
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
20016
|
+
throw new Error('Count must be a number.');
|
|
20017
|
+
}
|
|
20018
|
+
|
|
20019
|
+
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
20020
|
+
throw new Error('With Scores argument must be a boolean.');
|
|
20021
|
+
}
|
|
20022
|
+
}
|
|
20023
|
+
|
|
20024
|
+
return this.app.request.get({
|
|
20025
|
+
url: "".concat(this.getBaseURL(), "/get-random"),
|
|
20026
|
+
query: _objectSpread({}, options)
|
|
20027
|
+
});
|
|
20028
|
+
}
|
|
20029
|
+
}, {
|
|
20030
|
+
key: "getScore",
|
|
20031
|
+
value: function getScore(value) {
|
|
20032
|
+
if (!value || typeof value !== 'string') {
|
|
20033
|
+
throw new Error('Value must be provided and must be a string.');
|
|
20034
|
+
}
|
|
20035
|
+
|
|
20036
|
+
return this.app.request.post({
|
|
20037
|
+
url: "".concat(this.getBaseURL(), "/get-score"),
|
|
20038
|
+
data: {
|
|
20039
|
+
value: value
|
|
20040
|
+
}
|
|
20041
|
+
});
|
|
20042
|
+
}
|
|
20043
|
+
}, {
|
|
20044
|
+
key: "getRank",
|
|
20045
|
+
value: function getRank(value, reverse) {
|
|
20046
|
+
if (!value || typeof value !== 'string') {
|
|
20047
|
+
throw new Error('Value must be provided and must be a string.');
|
|
20048
|
+
}
|
|
20049
|
+
|
|
20050
|
+
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
20051
|
+
throw new Error('Reverse argument must be a boolean.');
|
|
20052
|
+
}
|
|
20053
|
+
|
|
20054
|
+
return this.app.request.post({
|
|
20055
|
+
url: "".concat(this.getBaseURL(), "/get-rank"),
|
|
20056
|
+
data: {
|
|
20057
|
+
value: value,
|
|
20058
|
+
reverse: reverse
|
|
20059
|
+
}
|
|
20060
|
+
});
|
|
20061
|
+
}
|
|
20062
|
+
}, {
|
|
20063
|
+
key: "getRangeByRank",
|
|
20064
|
+
value: function getRangeByRank(startRank, stopRank, options) {
|
|
20065
|
+
if (isNaN(startRank) || typeof startRank !== 'number') {
|
|
20066
|
+
throw new Error('Start Rank must be provided and must be a number.');
|
|
20067
|
+
}
|
|
20068
|
+
|
|
20069
|
+
if (isNaN(stopRank) || typeof stopRank !== 'number') {
|
|
20070
|
+
throw new Error('Stop Rank must be provided and must be a number.');
|
|
20071
|
+
}
|
|
20072
|
+
|
|
20073
|
+
if (options !== undefined) {
|
|
20074
|
+
if (!_utils["default"].isObject(options)) {
|
|
20075
|
+
throw new Error('Options must be an object.');
|
|
20076
|
+
}
|
|
20077
|
+
|
|
20078
|
+
var withScores = options.withScores,
|
|
20079
|
+
reverse = options.reverse;
|
|
20080
|
+
|
|
20081
|
+
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
20082
|
+
throw new Error('With Scores argument must be a boolean.');
|
|
20083
|
+
}
|
|
20084
|
+
|
|
20085
|
+
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
20086
|
+
throw new Error('Reverse argument must be a boolean.');
|
|
20087
|
+
}
|
|
20088
|
+
}
|
|
20089
|
+
|
|
20090
|
+
return this.app.request.get({
|
|
20091
|
+
url: "".concat(this.getBaseURL(), "/get-range-by-rank"),
|
|
20092
|
+
query: _objectSpread({
|
|
20093
|
+
startRank: startRank,
|
|
20094
|
+
stopRank: stopRank
|
|
20095
|
+
}, options)
|
|
20096
|
+
});
|
|
20097
|
+
}
|
|
20098
|
+
}, {
|
|
20099
|
+
key: "getRangeByScore",
|
|
20100
|
+
value: function getRangeByScore(options) {
|
|
20101
|
+
if (options !== undefined) {
|
|
20102
|
+
if (!_utils["default"].isObject(options)) {
|
|
20103
|
+
throw new Error('Options must be an object.');
|
|
20104
|
+
}
|
|
20105
|
+
|
|
20106
|
+
var minScore = options.minScore,
|
|
20107
|
+
maxScore = options.maxScore,
|
|
20108
|
+
minBound = options.minBound,
|
|
20109
|
+
maxBound = options.maxBound,
|
|
20110
|
+
offset = options.offset,
|
|
20111
|
+
count = options.count,
|
|
20112
|
+
withScores = options.withScores,
|
|
20113
|
+
reverse = options.reverse;
|
|
20114
|
+
|
|
20115
|
+
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
20116
|
+
throw new Error('Minimal Score must be a number.');
|
|
20117
|
+
}
|
|
20118
|
+
|
|
20119
|
+
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
20120
|
+
throw new Error('Maximal Score must be a number.');
|
|
20121
|
+
}
|
|
20122
|
+
|
|
20123
|
+
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
20124
|
+
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20125
|
+
}
|
|
20126
|
+
|
|
20127
|
+
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
20128
|
+
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20129
|
+
}
|
|
20130
|
+
|
|
20131
|
+
if (offset !== undefined && (typeof offset !== 'number' || isNaN(offset))) {
|
|
20132
|
+
throw new Error('Offset must be a number.');
|
|
20133
|
+
}
|
|
20134
|
+
|
|
20135
|
+
if (count !== undefined && (typeof count !== 'number' || isNaN(count))) {
|
|
20136
|
+
throw new Error('Count must be a number.');
|
|
20137
|
+
}
|
|
20138
|
+
|
|
20139
|
+
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
20140
|
+
throw new Error('With Scores argument must be a boolean.');
|
|
20141
|
+
}
|
|
20142
|
+
|
|
20143
|
+
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
20144
|
+
throw new Error('Reverse argument must be a boolean.');
|
|
20145
|
+
}
|
|
20146
|
+
}
|
|
20147
|
+
|
|
20148
|
+
return this.app.request.get({
|
|
20149
|
+
url: "".concat(this.getBaseURL(), "/get-range-by-score"),
|
|
20150
|
+
query: _objectSpread({}, options)
|
|
20151
|
+
});
|
|
20152
|
+
}
|
|
20153
|
+
}, {
|
|
20154
|
+
key: "deleteValues",
|
|
20155
|
+
value: function deleteValues(values) {
|
|
20156
|
+
if (!values || !(typeof values === 'string' || Array.isArray(values))) {
|
|
20157
|
+
throw new Error('Value(s) must be provided and must be a string or list of strings.');
|
|
20158
|
+
}
|
|
20159
|
+
|
|
20160
|
+
return this.app.request["delete"]({
|
|
20161
|
+
url: "".concat(this.getBaseURL(), "/values"),
|
|
20162
|
+
data: _utils["default"].castArray(values)
|
|
20163
|
+
});
|
|
20164
|
+
}
|
|
20165
|
+
}, {
|
|
20166
|
+
key: "deleteValuesByRank",
|
|
20167
|
+
value: function deleteValuesByRank(startRank, stopRank) {
|
|
20168
|
+
if (isNaN(startRank) || typeof startRank !== 'number') {
|
|
20169
|
+
throw new Error('Start Rank must be provided and must be a number.');
|
|
20170
|
+
}
|
|
20171
|
+
|
|
20172
|
+
if (isNaN(stopRank) || typeof stopRank !== 'number') {
|
|
20173
|
+
throw new Error('Stop Rank must be provided and must be a number.');
|
|
20174
|
+
}
|
|
20175
|
+
|
|
20176
|
+
return this.app.request["delete"]({
|
|
20177
|
+
url: "".concat(this.getBaseURL(), "/delete-by-rank"),
|
|
20178
|
+
query: {
|
|
20179
|
+
startRank: startRank,
|
|
20180
|
+
stopRank: stopRank
|
|
20181
|
+
}
|
|
20182
|
+
});
|
|
20183
|
+
}
|
|
20184
|
+
}, {
|
|
20185
|
+
key: "deleteValuesByScore",
|
|
20186
|
+
value: function deleteValuesByScore(options) {
|
|
20187
|
+
if (options !== undefined) {
|
|
20188
|
+
if (!_utils["default"].isObject(options)) {
|
|
20189
|
+
throw new Error('Options must be an object.');
|
|
20190
|
+
}
|
|
20191
|
+
|
|
20192
|
+
var minScore = options.minScore,
|
|
20193
|
+
maxScore = options.maxScore,
|
|
20194
|
+
minBound = options.minBound,
|
|
20195
|
+
maxBound = options.maxBound;
|
|
20196
|
+
|
|
20197
|
+
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
20198
|
+
throw new Error('Minimal Score must be a number.');
|
|
20199
|
+
}
|
|
20200
|
+
|
|
20201
|
+
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
20202
|
+
throw new Error('Maximal Score must be a number.');
|
|
20203
|
+
}
|
|
20204
|
+
|
|
20205
|
+
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
20206
|
+
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20207
|
+
}
|
|
20208
|
+
|
|
20209
|
+
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
20210
|
+
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20211
|
+
}
|
|
20212
|
+
}
|
|
20213
|
+
|
|
20214
|
+
return this.app.request["delete"]({
|
|
20215
|
+
url: "".concat(this.getBaseURL(), "/delete-by-score"),
|
|
20216
|
+
query: _objectSpread({}, options)
|
|
20217
|
+
});
|
|
20218
|
+
}
|
|
20219
|
+
}, {
|
|
20220
|
+
key: "length",
|
|
20221
|
+
value: function length() {
|
|
20222
|
+
return this.app.request.get({
|
|
20223
|
+
url: "".concat(this.getBaseURL(), "/length")
|
|
20224
|
+
});
|
|
20225
|
+
}
|
|
20226
|
+
}, {
|
|
20227
|
+
key: "countBetweenScores",
|
|
20228
|
+
value: function countBetweenScores(options) {
|
|
20229
|
+
if (options !== undefined) {
|
|
20230
|
+
if (!_utils["default"].isObject(options)) {
|
|
20231
|
+
throw new Error('Options must be an object.');
|
|
20232
|
+
}
|
|
20233
|
+
|
|
20234
|
+
var minScore = options.minScore,
|
|
20235
|
+
maxScore = options.maxScore,
|
|
20236
|
+
minBound = options.minBound,
|
|
20237
|
+
maxBound = options.maxBound;
|
|
20238
|
+
|
|
20239
|
+
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
20240
|
+
throw new Error('Minimal Score must be a number.');
|
|
20241
|
+
}
|
|
20242
|
+
|
|
20243
|
+
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
20244
|
+
throw new Error('Maximal Score must be a number.');
|
|
20245
|
+
}
|
|
20246
|
+
|
|
20247
|
+
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
20248
|
+
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20249
|
+
}
|
|
20250
|
+
|
|
20251
|
+
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
20252
|
+
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.');
|
|
20253
|
+
}
|
|
20254
|
+
}
|
|
20255
|
+
|
|
20256
|
+
return this.app.request.get({
|
|
20257
|
+
url: "".concat(this.getBaseURL(), "/count"),
|
|
20258
|
+
query: _objectSpread({}, options)
|
|
20259
|
+
});
|
|
20260
|
+
}
|
|
20261
|
+
}], [{
|
|
20262
|
+
key: "intersection",
|
|
20263
|
+
value: function intersection(keyNames) {
|
|
20264
|
+
if (!Array.isArray(keyNames)) {
|
|
20265
|
+
throw new Error('Store keys must be provided and must be an array.');
|
|
20266
|
+
}
|
|
20267
|
+
|
|
20268
|
+
return this.app.request.post({
|
|
20269
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/intersection"),
|
|
20270
|
+
data: keyNames
|
|
20271
|
+
});
|
|
20272
|
+
}
|
|
20273
|
+
}, {
|
|
20274
|
+
key: "union",
|
|
20275
|
+
value: function union(keyNames) {
|
|
20276
|
+
if (!Array.isArray(keyNames)) {
|
|
20277
|
+
throw new Error('Store keys must be provided and must be an array.');
|
|
20278
|
+
}
|
|
20279
|
+
|
|
20280
|
+
return this.app.request.post({
|
|
20281
|
+
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/union"),
|
|
20282
|
+
data: keyNames
|
|
20283
|
+
});
|
|
20284
|
+
}
|
|
20285
|
+
}]);
|
|
20286
|
+
return SortedSetStore;
|
|
20287
|
+
}(_baseStore.HiveStore);
|
|
20288
|
+
|
|
20289
|
+
exports.SortedSetStore = SortedSetStore;
|
|
20290
|
+
(0, _defineProperty2["default"])(SortedSetStore, "TYPE", _constants.HiveTypes.SORTED_SET);
|
|
20291
|
+
(0, _defineProperty2["default"])(SortedSetStore, "STATIC_METHODS", [].concat((0, _toConsumableArray2["default"])(_baseStore.HiveStore.STATIC_METHODS), ['difference', 'intersection', 'union']));
|
|
20292
|
+
(0, _defineProperty2["default"])(SortedSetStore, "difference", _set.SetStore.difference);
|
|
20293
|
+
|
|
20294
|
+
/***/ }),
|
|
20295
|
+
|
|
18541
20296
|
/***/ "./src/index.js":
|
|
18542
20297
|
/*!**********************!*\
|
|
18543
20298
|
!*** ./src/index.js ***!
|
|
@@ -18658,6 +20413,9 @@ var SERVICES = {
|
|
|
18658
20413
|
'Data': function Data() {
|
|
18659
20414
|
return __webpack_require__(/*! ./data */ "./src/data/index.js")["default"];
|
|
18660
20415
|
},
|
|
20416
|
+
'Hive': function Hive() {
|
|
20417
|
+
return __webpack_require__(/*! ./hive */ "./src/hive/index.js")["default"];
|
|
20418
|
+
},
|
|
18661
20419
|
'Messaging': function Messaging() {
|
|
18662
20420
|
return __webpack_require__(/*! ./messaging */ "./src/messaging/index.js")["default"];
|
|
18663
20421
|
},
|
|
@@ -18977,6 +20735,11 @@ var Backendless = /*#__PURE__*/function () {
|
|
|
18977
20735
|
get: function get() {
|
|
18978
20736
|
return this.__getService('Data');
|
|
18979
20737
|
}
|
|
20738
|
+
}, {
|
|
20739
|
+
key: "Hive",
|
|
20740
|
+
get: function get() {
|
|
20741
|
+
return this.__getService('Hive');
|
|
20742
|
+
}
|
|
18980
20743
|
}, {
|
|
18981
20744
|
key: "Messaging",
|
|
18982
20745
|
get: function get() {
|
|
@@ -22861,8 +24624,22 @@ var Urls = /*#__PURE__*/function () {
|
|
|
22861
24624
|
key: "transactions",
|
|
22862
24625
|
value: function transactions() {
|
|
22863
24626
|
return "".concat(this.root(), "/transaction/unit-of-work");
|
|
22864
|
-
}
|
|
22865
|
-
|
|
24627
|
+
}
|
|
24628
|
+
}, {
|
|
24629
|
+
key: "dataHives",
|
|
24630
|
+
value: function dataHives() {
|
|
24631
|
+
return "".concat(this.root(), "/hive");
|
|
24632
|
+
}
|
|
24633
|
+
}, {
|
|
24634
|
+
key: "dataHive",
|
|
24635
|
+
value: function dataHive(name) {
|
|
24636
|
+
return "".concat(this.dataHives(), "/").concat(name);
|
|
24637
|
+
}
|
|
24638
|
+
}, {
|
|
24639
|
+
key: "hiveStore",
|
|
24640
|
+
value: function hiveStore(name, storeType) {
|
|
24641
|
+
return "".concat(this.dataHive(name), "/").concat(storeType);
|
|
24642
|
+
}
|
|
22866
24643
|
}, {
|
|
22867
24644
|
key: "messaging",
|
|
22868
24645
|
value: function messaging() {
|
|
@@ -25105,6 +26882,9 @@ var Utils = {
|
|
|
25105
26882
|
};
|
|
25106
26883
|
|
|
25107
26884
|
return "".concat(chr8(), "-").concat(chr4(), "-").concat(chr4(), "-").concat(chr4(), "-").concat(chr12());
|
|
26885
|
+
},
|
|
26886
|
+
isObject: function isObject(obj) {
|
|
26887
|
+
return obj != null && obj.constructor.name === 'Object';
|
|
25108
26888
|
}
|
|
25109
26889
|
};
|
|
25110
26890
|
|