backendless 6.7.0 → 6.7.1-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backendless.d.ts +5 -0
- package/dist/backendless.js +20966 -23929
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/bl/constants.js +0 -2
- package/es/bl/custom-services.js +40 -65
- package/es/bl/events.js +30 -52
- package/es/bl/index.js +3 -9
- package/es/cache/index.js +125 -189
- package/es/commerce/index.js +78 -119
- package/es/counters/counter.js +0 -8
- package/es/counters/index.js +171 -258
- package/es/data/data-query-builder.js +2 -39
- package/es/data/geo/geo-constructor.js +5 -26
- package/es/data/geo/geo-json-parser.js +0 -7
- package/es/data/geo/geometry.js +4 -13
- package/es/data/geo/linestring.js +4 -21
- package/es/data/geo/point.js +4 -22
- package/es/data/geo/polygon.js +4 -30
- package/es/data/geo/spatial-reference-system.js +1 -7
- package/es/data/geo/wkt-parser.js +0 -10
- package/es/data/geo/wkt-to-geojson.js +4 -44
- package/es/data/group-query-builder.js +0 -23
- package/es/data/index.js +17 -54
- package/es/data/json-update-builder.js +0 -18
- package/es/data/load-relations-query-builder.js +0 -16
- package/es/data/persmission.js +0 -16
- package/es/data/rt-handlers.js +1 -46
- package/es/data/store.js +316 -518
- package/es/decorators/deprecated.js +2 -5
- package/es/decorators/index.js +0 -2
- package/es/device/index.js +3 -8
- package/es/expression.js +29 -0
- package/es/files/index.js +354 -493
- package/es/files/persmission.js +0 -15
- package/es/files/utils.js +32 -55
- package/es/hive/index.js +1 -13
- package/es/hive/stores/base-store.js +14 -50
- package/es/hive/stores/index.js +0 -10
- package/es/hive/stores/key-value.js +4 -37
- package/es/hive/stores/list.js +0 -32
- package/es/hive/stores/map.js +0 -34
- package/es/hive/stores/set.js +0 -29
- package/es/hive/stores/sorted-set.js +19 -94
- package/es/hive/utils.js +0 -2
- package/es/index.js +51 -71
- package/es/local-cache/index.js +0 -10
- package/es/local-cache/local-storage.js +1 -9
- package/es/local-cache/virtual-storage.js +0 -6
- package/es/logging/index.js +21 -46
- package/es/logging/logger.js +0 -6
- package/es/management/data.js +0 -8
- package/es/management/index.js +3 -7
- package/es/messaging/channel/index.js +0 -27
- package/es/messaging/helpers/body-parts.js +3 -6
- package/es/messaging/helpers/delivery-options.js +3 -6
- package/es/messaging/helpers/email-envelope.js +13 -25
- package/es/messaging/helpers/index.js +10 -16
- package/es/messaging/helpers/publish-options.js +3 -6
- package/es/messaging/index.js +213 -317
- package/es/persmission.js +7 -16
- package/es/request/index.js +2 -16
- package/es/rso/connection.js +3 -34
- package/es/rso/index.js +0 -7
- package/es/rt.js +21 -52
- package/es/unit-of-work/constants.js +1 -1
- package/es/unit-of-work/index.js +27 -145
- package/es/unit-of-work/json-adapter.js +14 -35
- package/es/unit-of-work/op-result-value-reference.js +1 -11
- package/es/unit-of-work/op-result.js +2 -13
- package/es/urls.js +18 -15
- package/es/user-agent.js +0 -7
- package/es/users/index.js +345 -552
- package/es/users/roles.js +79 -128
- package/es/users/social/container.js +0 -16
- package/es/users/social/index.js +166 -250
- package/es/users/user.js +2 -9
- package/es/users/utils.js +0 -3
- package/es/utils.js +0 -17
- package/lib/bl/constants.js +0 -2
- package/lib/bl/custom-services.js +40 -65
- package/lib/bl/events.js +30 -52
- package/lib/bl/index.js +3 -9
- package/lib/cache/index.js +125 -189
- package/lib/commerce/index.js +78 -119
- package/lib/counters/counter.js +0 -8
- package/lib/counters/index.js +171 -258
- package/lib/data/data-query-builder.js +2 -39
- package/lib/data/geo/geo-constructor.js +5 -26
- package/lib/data/geo/geo-json-parser.js +0 -7
- package/lib/data/geo/geometry.js +4 -13
- package/lib/data/geo/linestring.js +4 -21
- package/lib/data/geo/point.js +4 -22
- package/lib/data/geo/polygon.js +4 -30
- package/lib/data/geo/spatial-reference-system.js +1 -7
- package/lib/data/geo/wkt-parser.js +0 -10
- package/lib/data/geo/wkt-to-geojson.js +4 -44
- package/lib/data/group-query-builder.js +0 -23
- package/lib/data/index.js +17 -54
- package/lib/data/json-update-builder.js +0 -18
- package/lib/data/load-relations-query-builder.js +0 -16
- package/lib/data/persmission.js +0 -16
- package/lib/data/rt-handlers.js +1 -46
- package/lib/data/store.js +316 -518
- package/lib/decorators/deprecated.js +2 -5
- package/lib/decorators/index.js +0 -2
- package/lib/device/index.js +3 -8
- package/lib/expression.js +29 -0
- package/lib/files/index.js +354 -493
- package/lib/files/persmission.js +0 -15
- package/lib/files/utils.js +32 -55
- package/lib/hive/index.js +1 -13
- package/lib/hive/stores/base-store.js +14 -50
- package/lib/hive/stores/index.js +0 -10
- package/lib/hive/stores/key-value.js +4 -37
- package/lib/hive/stores/list.js +0 -32
- package/lib/hive/stores/map.js +0 -34
- package/lib/hive/stores/set.js +0 -29
- package/lib/hive/stores/sorted-set.js +19 -94
- package/lib/hive/utils.js +0 -2
- package/lib/index.js +51 -71
- package/lib/local-cache/index.js +0 -10
- package/lib/local-cache/local-storage.js +1 -9
- package/lib/local-cache/virtual-storage.js +0 -6
- package/lib/logging/index.js +21 -46
- package/lib/logging/logger.js +0 -6
- package/lib/management/data.js +0 -8
- package/lib/management/index.js +3 -7
- package/lib/messaging/channel/index.js +0 -27
- package/lib/messaging/helpers/body-parts.js +3 -6
- package/lib/messaging/helpers/delivery-options.js +3 -6
- package/lib/messaging/helpers/email-envelope.js +13 -25
- package/lib/messaging/helpers/index.js +10 -16
- package/lib/messaging/helpers/publish-options.js +3 -6
- package/lib/messaging/index.js +213 -317
- package/lib/persmission.js +7 -16
- package/lib/request/index.js +2 -16
- package/lib/rso/connection.js +3 -34
- package/lib/rso/index.js +0 -7
- package/lib/rt.js +21 -52
- package/lib/unit-of-work/constants.js +1 -1
- package/lib/unit-of-work/index.js +27 -145
- package/lib/unit-of-work/json-adapter.js +14 -35
- package/lib/unit-of-work/op-result-value-reference.js +1 -11
- package/lib/unit-of-work/op-result.js +2 -13
- package/lib/urls.js +18 -15
- package/lib/user-agent.js +0 -7
- package/lib/users/index.js +345 -552
- package/lib/users/roles.js +79 -128
- package/lib/users/social/container.js +0 -16
- package/lib/users/social/index.js +166 -250
- package/lib/users/user.js +2 -9
- package/lib/users/utils.js +0 -3
- package/lib/utils.js +0 -17
- package/package.json +16 -16
- package/src/data/store.js +3 -1
- package/src/expression.js +16 -0
- package/src/files/utils.js +1 -1
- package/src/index.js +5 -0
|
@@ -1,83 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.SortedSetStore = void 0;
|
|
9
|
-
|
|
10
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
-
|
|
12
9
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
-
|
|
14
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
|
|
16
11
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
-
|
|
18
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
|
|
20
13
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
-
|
|
22
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
23
|
-
|
|
24
15
|
var _baseStore = require("./base-store");
|
|
25
|
-
|
|
26
16
|
var _constants = require("../constants");
|
|
27
|
-
|
|
28
17
|
var _utils = _interopRequireDefault(require("../../utils"));
|
|
29
|
-
|
|
30
18
|
var _set = require("./set");
|
|
31
|
-
|
|
32
19
|
var _utils2 = require("../utils");
|
|
33
|
-
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
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; }
|
|
37
|
-
|
|
20
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
38
22
|
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); }; }
|
|
39
|
-
|
|
40
23
|
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; } }
|
|
41
|
-
|
|
42
24
|
var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
43
25
|
(0, _inherits2["default"])(SortedSetStore, _HiveStore);
|
|
44
|
-
|
|
45
26
|
var _super = _createSuper(SortedSetStore);
|
|
46
|
-
|
|
47
27
|
function SortedSetStore() {
|
|
48
28
|
(0, _classCallCheck2["default"])(this, SortedSetStore);
|
|
49
29
|
return _super.apply(this, arguments);
|
|
50
30
|
}
|
|
51
|
-
|
|
52
31
|
(0, _createClass2["default"])(SortedSetStore, [{
|
|
53
32
|
key: "add",
|
|
54
33
|
value: function add(items, options) {
|
|
55
34
|
if (!items || !Array.isArray(items)) {
|
|
56
35
|
throw new Error('Items must be provided and must be an array.');
|
|
57
36
|
}
|
|
58
|
-
|
|
59
37
|
if (options !== undefined) {
|
|
60
38
|
if (!_utils["default"].isObject(options)) {
|
|
61
39
|
throw new Error('Options must be an object.');
|
|
62
40
|
}
|
|
63
|
-
|
|
64
41
|
var duplicateBehaviour = options.duplicateBehaviour,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
42
|
+
scoreUpdateMode = options.scoreUpdateMode,
|
|
43
|
+
resultType = options.resultType;
|
|
68
44
|
if (duplicateBehaviour !== undefined && !['OnlyUpdate', 'AlwaysAdd'].includes(duplicateBehaviour)) {
|
|
69
45
|
throw new Error('Duplicate Behaviour argument must be one of this values: OnlyUpdate, AlwaysAdd.');
|
|
70
46
|
}
|
|
71
|
-
|
|
72
47
|
if (scoreUpdateMode !== undefined && !['Greater', 'Less'].includes(scoreUpdateMode)) {
|
|
73
48
|
throw new Error('Score Update Mode argument must be one of this values: Greater, Less.');
|
|
74
49
|
}
|
|
75
|
-
|
|
76
50
|
if (resultType !== undefined && !['NewAdded', 'TotalChanged'].includes(resultType)) {
|
|
77
51
|
throw new Error('Result Type must be one of this values: NewAdded, TotalChanged.');
|
|
78
52
|
}
|
|
79
53
|
}
|
|
80
|
-
|
|
81
54
|
return this.app.request.put({
|
|
82
55
|
url: "".concat(this.getBaseURL(), "/add"),
|
|
83
56
|
data: _objectSpread({
|
|
@@ -91,11 +64,9 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
91
64
|
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
92
65
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
93
66
|
}
|
|
94
|
-
|
|
95
67
|
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
96
68
|
throw new Error('ScoreValue must be provided and must be a number.');
|
|
97
69
|
}
|
|
98
|
-
|
|
99
70
|
return this.app.request.put({
|
|
100
71
|
url: "".concat(this.getBaseURL(), "/increment"),
|
|
101
72
|
data: {
|
|
@@ -110,11 +81,9 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
110
81
|
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
111
82
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
112
83
|
}
|
|
113
|
-
|
|
114
84
|
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
115
85
|
throw new Error('ScoreValue must be provided and must be a number.');
|
|
116
86
|
}
|
|
117
|
-
|
|
118
87
|
return this.app.request.put({
|
|
119
88
|
url: "".concat(this.getBaseURL(), "/decrement"),
|
|
120
89
|
data: {
|
|
@@ -129,7 +98,6 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
129
98
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
130
99
|
throw new Error('Count must be a number.');
|
|
131
100
|
}
|
|
132
|
-
|
|
133
101
|
return this.app.request.put({
|
|
134
102
|
url: "".concat(this.getBaseURL(), "/get-with-max-score-and-delete"),
|
|
135
103
|
query: {
|
|
@@ -143,7 +111,6 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
143
111
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
144
112
|
throw new Error('Count must be a number.');
|
|
145
113
|
}
|
|
146
|
-
|
|
147
114
|
return this.app.request.put({
|
|
148
115
|
url: "".concat(this.getBaseURL(), "/get-with-min-score-and-delete"),
|
|
149
116
|
query: {
|
|
@@ -158,19 +125,15 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
158
125
|
if (!_utils["default"].isObject(options)) {
|
|
159
126
|
throw new Error('Options must be an object.');
|
|
160
127
|
}
|
|
161
|
-
|
|
162
128
|
var count = options.count,
|
|
163
|
-
|
|
164
|
-
|
|
129
|
+
withScores = options.withScores;
|
|
165
130
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
166
131
|
throw new Error('Count must be a number.');
|
|
167
132
|
}
|
|
168
|
-
|
|
169
133
|
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
170
134
|
throw new Error('With Scores argument must be a boolean.');
|
|
171
135
|
}
|
|
172
136
|
}
|
|
173
|
-
|
|
174
137
|
return this.app.request.get({
|
|
175
138
|
url: "".concat(this.getBaseURL(), "/get-random"),
|
|
176
139
|
query: _objectSpread({}, options)
|
|
@@ -182,7 +145,6 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
182
145
|
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
183
146
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
184
147
|
}
|
|
185
|
-
|
|
186
148
|
return this.app.request.post({
|
|
187
149
|
url: "".concat(this.getBaseURL(), "/get-score"),
|
|
188
150
|
data: {
|
|
@@ -196,11 +158,9 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
196
158
|
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
197
159
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
198
160
|
}
|
|
199
|
-
|
|
200
161
|
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
201
162
|
throw new Error('Reverse argument must be a boolean.');
|
|
202
163
|
}
|
|
203
|
-
|
|
204
164
|
return this.app.request.post({
|
|
205
165
|
url: "".concat(this.getBaseURL(), "/get-rank"),
|
|
206
166
|
data: {
|
|
@@ -215,28 +175,22 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
215
175
|
if (isNaN(startRank) || typeof startRank !== 'number') {
|
|
216
176
|
throw new Error('Start Rank must be provided and must be a number.');
|
|
217
177
|
}
|
|
218
|
-
|
|
219
178
|
if (isNaN(stopRank) || typeof stopRank !== 'number') {
|
|
220
179
|
throw new Error('Stop Rank must be provided and must be a number.');
|
|
221
180
|
}
|
|
222
|
-
|
|
223
181
|
if (options !== undefined) {
|
|
224
182
|
if (!_utils["default"].isObject(options)) {
|
|
225
183
|
throw new Error('Options must be an object.');
|
|
226
184
|
}
|
|
227
|
-
|
|
228
185
|
var withScores = options.withScores,
|
|
229
|
-
|
|
230
|
-
|
|
186
|
+
reverse = options.reverse;
|
|
231
187
|
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
232
188
|
throw new Error('With Scores argument must be a boolean.');
|
|
233
189
|
}
|
|
234
|
-
|
|
235
190
|
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
236
191
|
throw new Error('Reverse argument must be a boolean.');
|
|
237
192
|
}
|
|
238
193
|
}
|
|
239
|
-
|
|
240
194
|
return this.app.request.get({
|
|
241
195
|
url: "".concat(this.getBaseURL(), "/get-range-by-rank"),
|
|
242
196
|
query: _objectSpread({
|
|
@@ -252,49 +206,39 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
252
206
|
if (!_utils["default"].isObject(options)) {
|
|
253
207
|
throw new Error('Options must be an object.');
|
|
254
208
|
}
|
|
255
|
-
|
|
256
209
|
var minScore = options.minScore,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
210
|
+
maxScore = options.maxScore,
|
|
211
|
+
minBound = options.minBound,
|
|
212
|
+
maxBound = options.maxBound,
|
|
213
|
+
offset = options.offset,
|
|
214
|
+
pageSize = options.pageSize,
|
|
215
|
+
withScores = options.withScores,
|
|
216
|
+
reverse = options.reverse;
|
|
265
217
|
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
266
218
|
throw new Error('Minimal Score must be a number.');
|
|
267
219
|
}
|
|
268
|
-
|
|
269
220
|
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
270
221
|
throw new Error('Maximal Score must be a number.');
|
|
271
222
|
}
|
|
272
|
-
|
|
273
223
|
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
274
224
|
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.');
|
|
275
225
|
}
|
|
276
|
-
|
|
277
226
|
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
278
227
|
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.');
|
|
279
228
|
}
|
|
280
|
-
|
|
281
229
|
if (offset !== undefined && (typeof offset !== 'number' || isNaN(offset))) {
|
|
282
230
|
throw new Error('Offset must be a number.');
|
|
283
231
|
}
|
|
284
|
-
|
|
285
232
|
if (pageSize !== undefined && (typeof pageSize !== 'number' || isNaN(pageSize))) {
|
|
286
233
|
throw new Error('Page Size must be a number.');
|
|
287
234
|
}
|
|
288
|
-
|
|
289
235
|
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
290
236
|
throw new Error('With Scores argument must be a boolean.');
|
|
291
237
|
}
|
|
292
|
-
|
|
293
238
|
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
294
239
|
throw new Error('Reverse argument must be a boolean.');
|
|
295
240
|
}
|
|
296
241
|
}
|
|
297
|
-
|
|
298
242
|
return this.app.request.get({
|
|
299
243
|
url: "".concat(this.getBaseURL(), "/get-range-by-score"),
|
|
300
244
|
query: _objectSpread({}, options)
|
|
@@ -306,7 +250,6 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
306
250
|
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
307
251
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
308
252
|
}
|
|
309
|
-
|
|
310
253
|
return this.app.request["delete"]({
|
|
311
254
|
url: "".concat(this.getBaseURL(), "/values"),
|
|
312
255
|
data: [value]
|
|
@@ -318,7 +261,6 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
318
261
|
if (!values || !Array.isArray(values) || !values.length || !(0, _utils2.isHiveValueValid)(values)) {
|
|
319
262
|
throw new Error('Value must be provided and must be a list of JSON items.');
|
|
320
263
|
}
|
|
321
|
-
|
|
322
264
|
return this.app.request["delete"]({
|
|
323
265
|
url: "".concat(this.getBaseURL(), "/values"),
|
|
324
266
|
data: values
|
|
@@ -330,11 +272,9 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
330
272
|
if (isNaN(startRank) || typeof startRank !== 'number') {
|
|
331
273
|
throw new Error('Start Rank must be provided and must be a number.');
|
|
332
274
|
}
|
|
333
|
-
|
|
334
275
|
if (isNaN(stopRank) || typeof stopRank !== 'number') {
|
|
335
276
|
throw new Error('Stop Rank must be provided and must be a number.');
|
|
336
277
|
}
|
|
337
|
-
|
|
338
278
|
return this.app.request["delete"]({
|
|
339
279
|
url: "".concat(this.getBaseURL(), "/delete-by-rank"),
|
|
340
280
|
query: {
|
|
@@ -350,29 +290,23 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
350
290
|
if (!_utils["default"].isObject(options)) {
|
|
351
291
|
throw new Error('Options must be an object.');
|
|
352
292
|
}
|
|
353
|
-
|
|
354
293
|
var minScore = options.minScore,
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
294
|
+
maxScore = options.maxScore,
|
|
295
|
+
minBound = options.minBound,
|
|
296
|
+
maxBound = options.maxBound;
|
|
359
297
|
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
360
298
|
throw new Error('Minimal Score must be a number.');
|
|
361
299
|
}
|
|
362
|
-
|
|
363
300
|
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
364
301
|
throw new Error('Maximal Score must be a number.');
|
|
365
302
|
}
|
|
366
|
-
|
|
367
303
|
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
368
304
|
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.');
|
|
369
305
|
}
|
|
370
|
-
|
|
371
306
|
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
372
307
|
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.');
|
|
373
308
|
}
|
|
374
309
|
}
|
|
375
|
-
|
|
376
310
|
return this.app.request["delete"]({
|
|
377
311
|
url: "".concat(this.getBaseURL(), "/delete-by-score"),
|
|
378
312
|
query: _objectSpread({}, options)
|
|
@@ -392,29 +326,23 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
392
326
|
if (!_utils["default"].isObject(options)) {
|
|
393
327
|
throw new Error('Options must be an object.');
|
|
394
328
|
}
|
|
395
|
-
|
|
396
329
|
var minScore = options.minScore,
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
330
|
+
maxScore = options.maxScore,
|
|
331
|
+
minBound = options.minBound,
|
|
332
|
+
maxBound = options.maxBound;
|
|
401
333
|
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
402
334
|
throw new Error('Minimal Score must be a number.');
|
|
403
335
|
}
|
|
404
|
-
|
|
405
336
|
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
406
337
|
throw new Error('Maximal Score must be a number.');
|
|
407
338
|
}
|
|
408
|
-
|
|
409
339
|
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
410
340
|
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.');
|
|
411
341
|
}
|
|
412
|
-
|
|
413
342
|
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
414
343
|
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.');
|
|
415
344
|
}
|
|
416
345
|
}
|
|
417
|
-
|
|
418
346
|
return this.app.request.get({
|
|
419
347
|
url: "".concat(this.getBaseURL(), "/count"),
|
|
420
348
|
query: _objectSpread({}, options)
|
|
@@ -426,7 +354,6 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
426
354
|
if (!Array.isArray(keyNames)) {
|
|
427
355
|
throw new Error('Store keys must be provided and must be an array.');
|
|
428
356
|
}
|
|
429
|
-
|
|
430
357
|
return this.app.request.post({
|
|
431
358
|
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/intersection"),
|
|
432
359
|
data: keyNames
|
|
@@ -438,7 +365,6 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
438
365
|
if (!Array.isArray(keyNames)) {
|
|
439
366
|
throw new Error('Store keys must be provided and must be an array.');
|
|
440
367
|
}
|
|
441
|
-
|
|
442
368
|
return this.app.request.post({
|
|
443
369
|
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/union"),
|
|
444
370
|
data: keyNames
|
|
@@ -447,7 +373,6 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
447
373
|
}]);
|
|
448
374
|
return SortedSetStore;
|
|
449
375
|
}(_baseStore.HiveStore);
|
|
450
|
-
|
|
451
376
|
exports.SortedSetStore = SortedSetStore;
|
|
452
377
|
(0, _defineProperty2["default"])(SortedSetStore, "TYPE", _constants.HiveTypes.SORTED_SET);
|
|
453
378
|
(0, _defineProperty2["default"])(SortedSetStore, "STATIC_METHODS", [].concat((0, _toConsumableArray2["default"])(_baseStore.HiveStore.STATIC_METHODS), ['difference', 'intersection', 'union']));
|
package/lib/hive/utils.js
CHANGED
|
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isHiveValueValid = isHiveValueValid;
|
|
7
|
-
|
|
8
7
|
function isHiveValueValid(value) {
|
|
9
8
|
if (value == null) {
|
|
10
9
|
return false;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
try {
|
|
14
12
|
var json = JSON.stringify(value);
|
|
15
13
|
return !!json;
|