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
package/lib/hive/stores/list.js
CHANGED
|
@@ -1,44 +1,28 @@
|
|
|
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.ListStore = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
|
|
16
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
-
|
|
18
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
-
|
|
20
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
14
|
var _constants = require("../constants");
|
|
23
|
-
|
|
24
15
|
var _baseStore = require("./base-store");
|
|
25
|
-
|
|
26
16
|
var _utils = require("../utils");
|
|
27
|
-
|
|
28
17
|
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); }; }
|
|
29
|
-
|
|
30
18
|
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; } }
|
|
31
|
-
|
|
32
19
|
var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
33
20
|
(0, _inherits2["default"])(ListStore, _HiveStore);
|
|
34
|
-
|
|
35
21
|
var _super = _createSuper(ListStore);
|
|
36
|
-
|
|
37
22
|
function ListStore() {
|
|
38
23
|
(0, _classCallCheck2["default"])(this, ListStore);
|
|
39
24
|
return _super.apply(this, arguments);
|
|
40
25
|
}
|
|
41
|
-
|
|
42
26
|
(0, _createClass2["default"])(ListStore, [{
|
|
43
27
|
key: "get",
|
|
44
28
|
value: function get(from, to) {
|
|
@@ -46,11 +30,9 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
46
30
|
if (isNaN(to) || typeof to !== 'number') {
|
|
47
31
|
throw new Error('Index To must be a number.');
|
|
48
32
|
}
|
|
49
|
-
|
|
50
33
|
if (isNaN(from) || typeof from !== 'number') {
|
|
51
34
|
throw new Error('Index From must be a number.');
|
|
52
35
|
}
|
|
53
|
-
|
|
54
36
|
return this.app.request.get({
|
|
55
37
|
url: this.getBaseURL(),
|
|
56
38
|
query: {
|
|
@@ -59,17 +41,14 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
59
41
|
}
|
|
60
42
|
});
|
|
61
43
|
}
|
|
62
|
-
|
|
63
44
|
if (from !== undefined) {
|
|
64
45
|
if (isNaN(from) || typeof from !== 'number') {
|
|
65
46
|
throw new Error('Index must be a number.');
|
|
66
47
|
}
|
|
67
|
-
|
|
68
48
|
return this.app.request.get({
|
|
69
49
|
url: "".concat(this.getBaseURL(), "/").concat(from)
|
|
70
50
|
});
|
|
71
51
|
}
|
|
72
|
-
|
|
73
52
|
return this.app.request.get({
|
|
74
53
|
url: this.getBaseURL()
|
|
75
54
|
});
|
|
@@ -97,11 +76,9 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
97
76
|
if (!(0, _utils.isHiveValueValid)(valueToInsert)) {
|
|
98
77
|
throw new Error('ValueToInsert must be provided and must be one of types: string, number, boolean, object, array.');
|
|
99
78
|
}
|
|
100
|
-
|
|
101
79
|
if (!(0, _utils.isHiveValueValid)(anchorValue)) {
|
|
102
80
|
throw new Error('AnchorValue must be provided and must be one of types: string, number, boolean, object, array.');
|
|
103
81
|
}
|
|
104
|
-
|
|
105
82
|
return this.app.request.put({
|
|
106
83
|
url: "".concat(this.getBaseURL(), "/insert-").concat(before ? 'before' : 'after'),
|
|
107
84
|
data: {
|
|
@@ -116,11 +93,9 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
116
93
|
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
117
94
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
118
95
|
}
|
|
119
|
-
|
|
120
96
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
121
97
|
throw new Error('Count must be a number.');
|
|
122
98
|
}
|
|
123
|
-
|
|
124
99
|
return this.app.request.put({
|
|
125
100
|
url: "".concat(this.getBaseURL(), "/delete-value"),
|
|
126
101
|
data: {
|
|
@@ -135,7 +110,6 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
135
110
|
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
136
111
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
137
112
|
}
|
|
138
|
-
|
|
139
113
|
return this.app.request.put({
|
|
140
114
|
url: "".concat(this.getBaseURL(), "/add-first"),
|
|
141
115
|
data: [value]
|
|
@@ -147,7 +121,6 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
147
121
|
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
148
122
|
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
149
123
|
}
|
|
150
|
-
|
|
151
124
|
return this.app.request.put({
|
|
152
125
|
url: "".concat(this.getBaseURL(), "/add-first"),
|
|
153
126
|
data: values
|
|
@@ -159,7 +132,6 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
159
132
|
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
160
133
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
161
134
|
}
|
|
162
|
-
|
|
163
135
|
return this.app.request.put({
|
|
164
136
|
url: "".concat(this.getBaseURL(), "/add-last"),
|
|
165
137
|
data: [value]
|
|
@@ -171,7 +143,6 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
171
143
|
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
172
144
|
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
173
145
|
}
|
|
174
|
-
|
|
175
146
|
return this.app.request.put({
|
|
176
147
|
url: "".concat(this.getBaseURL(), "/add-last"),
|
|
177
148
|
data: values
|
|
@@ -183,7 +154,6 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
183
154
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
184
155
|
throw new Error('Count must be a number.');
|
|
185
156
|
}
|
|
186
|
-
|
|
187
157
|
return this.app.request.put({
|
|
188
158
|
url: "".concat(this.getBaseURL(), "/get-first-and-delete"),
|
|
189
159
|
query: {
|
|
@@ -197,7 +167,6 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
197
167
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
198
168
|
throw new Error('Count must be a number.');
|
|
199
169
|
}
|
|
200
|
-
|
|
201
170
|
return this.app.request.put({
|
|
202
171
|
url: "".concat(this.getBaseURL(), "/get-last-and-delete"),
|
|
203
172
|
query: {
|
|
@@ -208,6 +177,5 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
208
177
|
}]);
|
|
209
178
|
return ListStore;
|
|
210
179
|
}(_baseStore.HiveStore);
|
|
211
|
-
|
|
212
180
|
exports.ListStore = ListStore;
|
|
213
181
|
(0, _defineProperty2["default"])(ListStore, "TYPE", _constants.HiveTypes.LIST);
|
package/lib/hive/stores/map.js
CHANGED
|
@@ -1,53 +1,35 @@
|
|
|
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.MapStore = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
|
|
16
11
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
17
|
-
|
|
18
12
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
19
|
-
|
|
20
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
|
|
22
14
|
var _constants = require("../constants");
|
|
23
|
-
|
|
24
15
|
var _baseStore = require("./base-store");
|
|
25
|
-
|
|
26
16
|
var _utils = _interopRequireDefault(require("../../utils"));
|
|
27
|
-
|
|
28
17
|
var _utils2 = require("../utils");
|
|
29
|
-
|
|
30
18
|
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); }; }
|
|
31
|
-
|
|
32
19
|
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; } }
|
|
33
|
-
|
|
34
20
|
var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
35
21
|
(0, _inherits2["default"])(MapStore, _HiveStore);
|
|
36
|
-
|
|
37
22
|
var _super = _createSuper(MapStore);
|
|
38
|
-
|
|
39
23
|
function MapStore() {
|
|
40
24
|
(0, _classCallCheck2["default"])(this, MapStore);
|
|
41
25
|
return _super.apply(this, arguments);
|
|
42
26
|
}
|
|
43
|
-
|
|
44
27
|
(0, _createClass2["default"])(MapStore, [{
|
|
45
28
|
key: "get",
|
|
46
29
|
value: function get(keys) {
|
|
47
30
|
if (keys !== undefined && !(typeof keys === 'string' || Array.isArray(keys))) {
|
|
48
31
|
throw new Error('Key(s) must be a string or list of strings.');
|
|
49
32
|
}
|
|
50
|
-
|
|
51
33
|
return this.app.request.post({
|
|
52
34
|
url: this.getBaseURL(),
|
|
53
35
|
data: _utils["default"].castArray(keys)
|
|
@@ -59,7 +41,6 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
59
41
|
if (!key || typeof key !== 'string') {
|
|
60
42
|
throw new Error('Key must be provided and must be a string.');
|
|
61
43
|
}
|
|
62
|
-
|
|
63
44
|
return this.app.request.get({
|
|
64
45
|
url: "".concat(this.getBaseURL(), "/get/").concat(key)
|
|
65
46
|
});
|
|
@@ -70,7 +51,6 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
70
51
|
if (!key || typeof key !== 'string') {
|
|
71
52
|
throw new Error('Key must be provided and must be a string.');
|
|
72
53
|
}
|
|
73
|
-
|
|
74
54
|
return this.app.request.get({
|
|
75
55
|
url: "".concat(this.getBaseURL(), "/exists/").concat(key)
|
|
76
56
|
});
|
|
@@ -102,26 +82,21 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
102
82
|
if (!key) {
|
|
103
83
|
throw new Error('First argument must be provided and must be a string or an object.');
|
|
104
84
|
}
|
|
105
|
-
|
|
106
85
|
if (_utils["default"].isObject(key)) {
|
|
107
86
|
if (!Object.keys(key).length) {
|
|
108
87
|
throw new Error('Provided object must have at least 1 key.');
|
|
109
88
|
}
|
|
110
|
-
|
|
111
89
|
return this.app.request.put({
|
|
112
90
|
url: this.getBaseURL(),
|
|
113
91
|
data: key
|
|
114
92
|
});
|
|
115
93
|
}
|
|
116
|
-
|
|
117
94
|
if (typeof key !== 'string') {
|
|
118
95
|
throw new Error('Key must be a string.');
|
|
119
96
|
}
|
|
120
|
-
|
|
121
97
|
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
122
98
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
123
99
|
}
|
|
124
|
-
|
|
125
100
|
return this.app.request.put({
|
|
126
101
|
url: "".concat(this.getBaseURL(), "/set/").concat(key),
|
|
127
102
|
data: {
|
|
@@ -135,15 +110,12 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
135
110
|
if (!key || typeof key !== 'string') {
|
|
136
111
|
throw new Error('Key must be provided and must be a string.');
|
|
137
112
|
}
|
|
138
|
-
|
|
139
113
|
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
140
114
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
141
115
|
}
|
|
142
|
-
|
|
143
116
|
if (overwrite !== undefined && typeof overwrite !== 'boolean') {
|
|
144
117
|
throw new Error('Overwrite must be a boolean.');
|
|
145
118
|
}
|
|
146
|
-
|
|
147
119
|
return this.app.request.put({
|
|
148
120
|
url: "".concat(this.getBaseURL(), "/set-with-overwrite/").concat(key),
|
|
149
121
|
data: {
|
|
@@ -158,11 +130,9 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
158
130
|
if (!key || typeof key !== 'string') {
|
|
159
131
|
throw new Error('Key must be provided and must be a string.');
|
|
160
132
|
}
|
|
161
|
-
|
|
162
133
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
163
134
|
throw new Error('Count must be a number.');
|
|
164
135
|
}
|
|
165
|
-
|
|
166
136
|
return this.app.request.put({
|
|
167
137
|
url: "".concat(this.getBaseURL(), "/increment/").concat(key),
|
|
168
138
|
query: {
|
|
@@ -176,11 +146,9 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
176
146
|
if (!key || typeof key !== 'string') {
|
|
177
147
|
throw new Error('Key must be provided and must be a string.');
|
|
178
148
|
}
|
|
179
|
-
|
|
180
149
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
181
150
|
throw new Error('Count must be a number.');
|
|
182
151
|
}
|
|
183
|
-
|
|
184
152
|
return this.app.request.put({
|
|
185
153
|
url: "".concat(this.getBaseURL(), "/decrement/").concat(key),
|
|
186
154
|
query: {
|
|
@@ -194,7 +162,6 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
194
162
|
if (!keys || !(typeof keys === 'string' || Array.isArray(keys))) {
|
|
195
163
|
throw new Error('Key(s) must be provided and must be a string or list of strings.');
|
|
196
164
|
}
|
|
197
|
-
|
|
198
165
|
return this.app.request["delete"]({
|
|
199
166
|
url: "".concat(this.getBaseURL(), "/by-obj-keys"),
|
|
200
167
|
data: _utils["default"].castArray(keys)
|
|
@@ -203,6 +170,5 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
203
170
|
}]);
|
|
204
171
|
return MapStore;
|
|
205
172
|
}(_baseStore.HiveStore);
|
|
206
|
-
|
|
207
173
|
exports.MapStore = MapStore;
|
|
208
174
|
(0, _defineProperty2["default"])(MapStore, "TYPE", _constants.HiveTypes.MAP);
|
package/lib/hive/stores/set.js
CHANGED
|
@@ -1,46 +1,29 @@
|
|
|
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.SetStore = 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 = require("../utils");
|
|
29
|
-
|
|
30
18
|
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); }; }
|
|
31
|
-
|
|
32
19
|
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; } }
|
|
33
|
-
|
|
34
20
|
var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
35
21
|
(0, _inherits2["default"])(SetStore, _HiveStore);
|
|
36
|
-
|
|
37
22
|
var _super = _createSuper(SetStore);
|
|
38
|
-
|
|
39
23
|
function SetStore() {
|
|
40
24
|
(0, _classCallCheck2["default"])(this, SetStore);
|
|
41
25
|
return _super.apply(this, arguments);
|
|
42
26
|
}
|
|
43
|
-
|
|
44
27
|
(0, _createClass2["default"])(SetStore, [{
|
|
45
28
|
key: "get",
|
|
46
29
|
value: function get() {
|
|
@@ -54,7 +37,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
54
37
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
55
38
|
throw new Error('Count must be a number.');
|
|
56
39
|
}
|
|
57
|
-
|
|
58
40
|
return this.app.request.get({
|
|
59
41
|
url: "".concat(this.getBaseURL(), "/random"),
|
|
60
42
|
query: {
|
|
@@ -68,7 +50,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
68
50
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
69
51
|
throw new Error('Count must be a number.');
|
|
70
52
|
}
|
|
71
|
-
|
|
72
53
|
return this.app.request.put({
|
|
73
54
|
url: "".concat(this.getBaseURL(), "/random"),
|
|
74
55
|
query: {
|
|
@@ -82,7 +63,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
82
63
|
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
83
64
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
84
65
|
}
|
|
85
|
-
|
|
86
66
|
return this.app.request.put({
|
|
87
67
|
url: "".concat(this.getBaseURL(), "/add"),
|
|
88
68
|
data: [value]
|
|
@@ -94,7 +74,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
94
74
|
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
95
75
|
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
96
76
|
}
|
|
97
|
-
|
|
98
77
|
return this.app.request.put({
|
|
99
78
|
url: "".concat(this.getBaseURL(), "/add"),
|
|
100
79
|
data: values
|
|
@@ -106,7 +85,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
106
85
|
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
107
86
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
108
87
|
}
|
|
109
|
-
|
|
110
88
|
return this.app.request["delete"]({
|
|
111
89
|
url: "".concat(this.getBaseURL(), "/values"),
|
|
112
90
|
data: [value]
|
|
@@ -118,7 +96,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
118
96
|
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
119
97
|
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
120
98
|
}
|
|
121
|
-
|
|
122
99
|
return this.app.request["delete"]({
|
|
123
100
|
url: "".concat(this.getBaseURL(), "/values"),
|
|
124
101
|
data: values
|
|
@@ -130,7 +107,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
130
107
|
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
131
108
|
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
132
109
|
}
|
|
133
|
-
|
|
134
110
|
return this.app.request.post({
|
|
135
111
|
url: "".concat(this.getBaseURL(), "/contains"),
|
|
136
112
|
data: [value]
|
|
@@ -142,7 +118,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
142
118
|
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
143
119
|
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
144
120
|
}
|
|
145
|
-
|
|
146
121
|
return this.app.request.post({
|
|
147
122
|
url: "".concat(this.getBaseURL(), "/contains"),
|
|
148
123
|
data: values
|
|
@@ -161,7 +136,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
161
136
|
if (!Array.isArray(keyNames)) {
|
|
162
137
|
throw new Error('Store keys must be provided and must be an array.');
|
|
163
138
|
}
|
|
164
|
-
|
|
165
139
|
return this.app.request.post({
|
|
166
140
|
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/difference"),
|
|
167
141
|
data: keyNames
|
|
@@ -173,7 +147,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
173
147
|
if (!Array.isArray(keyNames)) {
|
|
174
148
|
throw new Error('Store keys must be provided and must be an array.');
|
|
175
149
|
}
|
|
176
|
-
|
|
177
150
|
return this.app.request.post({
|
|
178
151
|
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/intersection"),
|
|
179
152
|
data: keyNames
|
|
@@ -185,7 +158,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
185
158
|
if (!Array.isArray(keyNames)) {
|
|
186
159
|
throw new Error('Store keys must be provided and must be an array.');
|
|
187
160
|
}
|
|
188
|
-
|
|
189
161
|
return this.app.request.post({
|
|
190
162
|
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/action/union"),
|
|
191
163
|
data: keyNames
|
|
@@ -194,7 +166,6 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
194
166
|
}]);
|
|
195
167
|
return SetStore;
|
|
196
168
|
}(_baseStore.HiveStore);
|
|
197
|
-
|
|
198
169
|
exports.SetStore = SetStore;
|
|
199
170
|
(0, _defineProperty2["default"])(SetStore, "TYPE", _constants.HiveTypes.SET);
|
|
200
171
|
(0, _defineProperty2["default"])(SetStore, "STATIC_METHODS", [].concat((0, _toConsumableArray2["default"])(_baseStore.HiveStore.STATIC_METHODS), ['difference', 'intersection', 'union']));
|