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/es/counters/index.js
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
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["default"] = void 0;
|
|
9
|
-
|
|
10
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
|
|
14
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
-
|
|
16
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
-
|
|
18
12
|
var _counter = _interopRequireDefault(require("./counter"));
|
|
19
|
-
|
|
20
13
|
var Counters = /*#__PURE__*/function () {
|
|
21
14
|
function Counters(app) {
|
|
22
15
|
(0, _classCallCheck2["default"])(this, Counters);
|
|
23
16
|
this.app = app;
|
|
24
17
|
}
|
|
25
|
-
|
|
26
18
|
(0, _createClass2["default"])(Counters, [{
|
|
27
19
|
key: "of",
|
|
28
20
|
value: function of(name) {
|
|
@@ -33,33 +25,26 @@ var Counters = /*#__PURE__*/function () {
|
|
|
33
25
|
value: function () {
|
|
34
26
|
var _list = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(pattern) {
|
|
35
27
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
36
|
-
while (1) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
case 3:
|
|
52
|
-
case "end":
|
|
53
|
-
return _context.stop();
|
|
54
|
-
}
|
|
28
|
+
while (1) switch (_context.prev = _context.next) {
|
|
29
|
+
case 0:
|
|
30
|
+
if (!(pattern !== null && pattern !== undefined && typeof pattern !== 'string')) {
|
|
31
|
+
_context.next = 2;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
throw new Error('Counters Pattern can be a string only');
|
|
35
|
+
case 2:
|
|
36
|
+
return _context.abrupt("return", this.app.request.get({
|
|
37
|
+
url: this.app.urls.countersList(pattern)
|
|
38
|
+
}));
|
|
39
|
+
case 3:
|
|
40
|
+
case "end":
|
|
41
|
+
return _context.stop();
|
|
55
42
|
}
|
|
56
43
|
}, _callee, this);
|
|
57
44
|
}));
|
|
58
|
-
|
|
59
45
|
function list(_x) {
|
|
60
46
|
return _list.apply(this, arguments);
|
|
61
47
|
}
|
|
62
|
-
|
|
63
48
|
return list;
|
|
64
49
|
}()
|
|
65
50
|
}, {
|
|
@@ -67,33 +52,26 @@ var Counters = /*#__PURE__*/function () {
|
|
|
67
52
|
value: function () {
|
|
68
53
|
var _incrementAndGet = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(counterName) {
|
|
69
54
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
70
|
-
while (1) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
case 3:
|
|
86
|
-
case "end":
|
|
87
|
-
return _context2.stop();
|
|
88
|
-
}
|
|
55
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
56
|
+
case 0:
|
|
57
|
+
if (!(!counterName || typeof counterName !== 'string')) {
|
|
58
|
+
_context2.next = 2;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
throw new Error('Counter Name must be provided and must be a string.');
|
|
62
|
+
case 2:
|
|
63
|
+
return _context2.abrupt("return", this.app.request.put({
|
|
64
|
+
url: this.app.urls.counterIncrementAndGet(counterName)
|
|
65
|
+
}));
|
|
66
|
+
case 3:
|
|
67
|
+
case "end":
|
|
68
|
+
return _context2.stop();
|
|
89
69
|
}
|
|
90
70
|
}, _callee2, this);
|
|
91
71
|
}));
|
|
92
|
-
|
|
93
72
|
function incrementAndGet(_x2) {
|
|
94
73
|
return _incrementAndGet.apply(this, arguments);
|
|
95
74
|
}
|
|
96
|
-
|
|
97
75
|
return incrementAndGet;
|
|
98
76
|
}()
|
|
99
77
|
}, {
|
|
@@ -101,33 +79,26 @@ var Counters = /*#__PURE__*/function () {
|
|
|
101
79
|
value: function () {
|
|
102
80
|
var _getAndIncrement = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(counterName) {
|
|
103
81
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
104
|
-
while (1) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
case 3:
|
|
120
|
-
case "end":
|
|
121
|
-
return _context3.stop();
|
|
122
|
-
}
|
|
82
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
83
|
+
case 0:
|
|
84
|
+
if (!(!counterName || typeof counterName !== 'string')) {
|
|
85
|
+
_context3.next = 2;
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
throw new Error('Counter Name must be provided and must be a string.');
|
|
89
|
+
case 2:
|
|
90
|
+
return _context3.abrupt("return", this.app.request.put({
|
|
91
|
+
url: this.app.urls.counterGetAndIncrement(counterName)
|
|
92
|
+
}));
|
|
93
|
+
case 3:
|
|
94
|
+
case "end":
|
|
95
|
+
return _context3.stop();
|
|
123
96
|
}
|
|
124
97
|
}, _callee3, this);
|
|
125
98
|
}));
|
|
126
|
-
|
|
127
99
|
function getAndIncrement(_x3) {
|
|
128
100
|
return _getAndIncrement.apply(this, arguments);
|
|
129
101
|
}
|
|
130
|
-
|
|
131
102
|
return getAndIncrement;
|
|
132
103
|
}()
|
|
133
104
|
}, {
|
|
@@ -135,33 +106,26 @@ var Counters = /*#__PURE__*/function () {
|
|
|
135
106
|
value: function () {
|
|
136
107
|
var _decrementAndGet = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(counterName) {
|
|
137
108
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
138
|
-
while (1) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
case 3:
|
|
154
|
-
case "end":
|
|
155
|
-
return _context4.stop();
|
|
156
|
-
}
|
|
109
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
110
|
+
case 0:
|
|
111
|
+
if (!(!counterName || typeof counterName !== 'string')) {
|
|
112
|
+
_context4.next = 2;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
throw new Error('Counter Name must be provided and must be a string.');
|
|
116
|
+
case 2:
|
|
117
|
+
return _context4.abrupt("return", this.app.request.put({
|
|
118
|
+
url: this.app.urls.counterDecrementAndGet(counterName)
|
|
119
|
+
}));
|
|
120
|
+
case 3:
|
|
121
|
+
case "end":
|
|
122
|
+
return _context4.stop();
|
|
157
123
|
}
|
|
158
124
|
}, _callee4, this);
|
|
159
125
|
}));
|
|
160
|
-
|
|
161
126
|
function decrementAndGet(_x4) {
|
|
162
127
|
return _decrementAndGet.apply(this, arguments);
|
|
163
128
|
}
|
|
164
|
-
|
|
165
129
|
return decrementAndGet;
|
|
166
130
|
}()
|
|
167
131
|
}, {
|
|
@@ -169,33 +133,26 @@ var Counters = /*#__PURE__*/function () {
|
|
|
169
133
|
value: function () {
|
|
170
134
|
var _getAndDecrement = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(counterName) {
|
|
171
135
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
172
|
-
while (1) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
case 3:
|
|
188
|
-
case "end":
|
|
189
|
-
return _context5.stop();
|
|
190
|
-
}
|
|
136
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
137
|
+
case 0:
|
|
138
|
+
if (!(!counterName || typeof counterName !== 'string')) {
|
|
139
|
+
_context5.next = 2;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
throw new Error('Counter Name must be provided and must be a string.');
|
|
143
|
+
case 2:
|
|
144
|
+
return _context5.abrupt("return", this.app.request.put({
|
|
145
|
+
url: this.app.urls.counterGetAndDecrement(counterName)
|
|
146
|
+
}));
|
|
147
|
+
case 3:
|
|
148
|
+
case "end":
|
|
149
|
+
return _context5.stop();
|
|
191
150
|
}
|
|
192
151
|
}, _callee5, this);
|
|
193
152
|
}));
|
|
194
|
-
|
|
195
153
|
function getAndDecrement(_x5) {
|
|
196
154
|
return _getAndDecrement.apply(this, arguments);
|
|
197
155
|
}
|
|
198
|
-
|
|
199
156
|
return getAndDecrement;
|
|
200
157
|
}()
|
|
201
158
|
}, {
|
|
@@ -203,33 +160,26 @@ var Counters = /*#__PURE__*/function () {
|
|
|
203
160
|
value: function () {
|
|
204
161
|
var _reset = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(counterName) {
|
|
205
162
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
206
|
-
while (1) {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
case 3:
|
|
222
|
-
case "end":
|
|
223
|
-
return _context6.stop();
|
|
224
|
-
}
|
|
163
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
164
|
+
case 0:
|
|
165
|
+
if (!(!counterName || typeof counterName !== 'string')) {
|
|
166
|
+
_context6.next = 2;
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
throw new Error('Counter Name must be provided and must be a string.');
|
|
170
|
+
case 2:
|
|
171
|
+
return _context6.abrupt("return", this.app.request.put({
|
|
172
|
+
url: this.app.urls.counterReset(counterName)
|
|
173
|
+
}));
|
|
174
|
+
case 3:
|
|
175
|
+
case "end":
|
|
176
|
+
return _context6.stop();
|
|
225
177
|
}
|
|
226
178
|
}, _callee6, this);
|
|
227
179
|
}));
|
|
228
|
-
|
|
229
180
|
function reset(_x6) {
|
|
230
181
|
return _reset.apply(this, arguments);
|
|
231
182
|
}
|
|
232
|
-
|
|
233
183
|
return reset;
|
|
234
184
|
}()
|
|
235
185
|
}, {
|
|
@@ -237,33 +187,26 @@ var Counters = /*#__PURE__*/function () {
|
|
|
237
187
|
value: function () {
|
|
238
188
|
var _get = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(counterName) {
|
|
239
189
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
240
|
-
while (1) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
case 3:
|
|
256
|
-
case "end":
|
|
257
|
-
return _context7.stop();
|
|
258
|
-
}
|
|
190
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
191
|
+
case 0:
|
|
192
|
+
if (!(!counterName || typeof counterName !== 'string')) {
|
|
193
|
+
_context7.next = 2;
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
throw new Error('Counter Name must be provided and must be a string.');
|
|
197
|
+
case 2:
|
|
198
|
+
return _context7.abrupt("return", this.app.request.get({
|
|
199
|
+
url: this.app.urls.counter(counterName)
|
|
200
|
+
}));
|
|
201
|
+
case 3:
|
|
202
|
+
case "end":
|
|
203
|
+
return _context7.stop();
|
|
259
204
|
}
|
|
260
205
|
}, _callee7, this);
|
|
261
206
|
}));
|
|
262
|
-
|
|
263
207
|
function get(_x7) {
|
|
264
208
|
return _get.apply(this, arguments);
|
|
265
209
|
}
|
|
266
|
-
|
|
267
210
|
return get;
|
|
268
211
|
}()
|
|
269
212
|
}, {
|
|
@@ -271,44 +214,35 @@ var Counters = /*#__PURE__*/function () {
|
|
|
271
214
|
value: function () {
|
|
272
215
|
var _addAndGet = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(counterName, value) {
|
|
273
216
|
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
274
|
-
while (1) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
217
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
218
|
+
case 0:
|
|
219
|
+
if (!(!counterName || typeof counterName !== 'string')) {
|
|
220
|
+
_context8.next = 2;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
throw new Error('Counter Name must be provided and must be a string.');
|
|
224
|
+
case 2:
|
|
225
|
+
if (!(typeof value !== 'number')) {
|
|
226
|
+
_context8.next = 4;
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
throw new Error('Counter Value must be a number.');
|
|
230
|
+
case 4:
|
|
231
|
+
return _context8.abrupt("return", this.app.request.put({
|
|
232
|
+
url: this.app.urls.counterAddAndGet(counterName),
|
|
233
|
+
query: {
|
|
234
|
+
value: value
|
|
280
235
|
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (!(typeof value !== 'number')) {
|
|
286
|
-
_context8.next = 4;
|
|
287
|
-
break;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
throw new Error('Counter Value must be a number.');
|
|
291
|
-
|
|
292
|
-
case 4:
|
|
293
|
-
return _context8.abrupt("return", this.app.request.put({
|
|
294
|
-
url: this.app.urls.counterAddAndGet(counterName),
|
|
295
|
-
query: {
|
|
296
|
-
value: value
|
|
297
|
-
}
|
|
298
|
-
}));
|
|
299
|
-
|
|
300
|
-
case 5:
|
|
301
|
-
case "end":
|
|
302
|
-
return _context8.stop();
|
|
303
|
-
}
|
|
236
|
+
}));
|
|
237
|
+
case 5:
|
|
238
|
+
case "end":
|
|
239
|
+
return _context8.stop();
|
|
304
240
|
}
|
|
305
241
|
}, _callee8, this);
|
|
306
242
|
}));
|
|
307
|
-
|
|
308
243
|
function addAndGet(_x8, _x9) {
|
|
309
244
|
return _addAndGet.apply(this, arguments);
|
|
310
245
|
}
|
|
311
|
-
|
|
312
246
|
return addAndGet;
|
|
313
247
|
}()
|
|
314
248
|
}, {
|
|
@@ -316,44 +250,35 @@ var Counters = /*#__PURE__*/function () {
|
|
|
316
250
|
value: function () {
|
|
317
251
|
var _getAndAdd = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(counterName, value) {
|
|
318
252
|
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
319
|
-
while (1) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
253
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
254
|
+
case 0:
|
|
255
|
+
if (!(!counterName || typeof counterName !== 'string')) {
|
|
256
|
+
_context9.next = 2;
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
throw new Error('Counter Name must be provided and must be a string.');
|
|
260
|
+
case 2:
|
|
261
|
+
if (!(typeof value !== 'number')) {
|
|
262
|
+
_context9.next = 4;
|
|
263
|
+
break;
|
|
264
|
+
}
|
|
265
|
+
throw new Error('Counter Value must be a number.');
|
|
266
|
+
case 4:
|
|
267
|
+
return _context9.abrupt("return", this.app.request.put({
|
|
268
|
+
url: this.app.urls.counterGetAndAdd(counterName),
|
|
269
|
+
query: {
|
|
270
|
+
value: value
|
|
325
271
|
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
if (!(typeof value !== 'number')) {
|
|
331
|
-
_context9.next = 4;
|
|
332
|
-
break;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
throw new Error('Counter Value must be a number.');
|
|
336
|
-
|
|
337
|
-
case 4:
|
|
338
|
-
return _context9.abrupt("return", this.app.request.put({
|
|
339
|
-
url: this.app.urls.counterGetAndAdd(counterName),
|
|
340
|
-
query: {
|
|
341
|
-
value: value
|
|
342
|
-
}
|
|
343
|
-
}));
|
|
344
|
-
|
|
345
|
-
case 5:
|
|
346
|
-
case "end":
|
|
347
|
-
return _context9.stop();
|
|
348
|
-
}
|
|
272
|
+
}));
|
|
273
|
+
case 5:
|
|
274
|
+
case "end":
|
|
275
|
+
return _context9.stop();
|
|
349
276
|
}
|
|
350
277
|
}, _callee9, this);
|
|
351
278
|
}));
|
|
352
|
-
|
|
353
279
|
function getAndAdd(_x10, _x11) {
|
|
354
280
|
return _getAndAdd.apply(this, arguments);
|
|
355
281
|
}
|
|
356
|
-
|
|
357
282
|
return getAndAdd;
|
|
358
283
|
}()
|
|
359
284
|
}, {
|
|
@@ -361,57 +286,45 @@ var Counters = /*#__PURE__*/function () {
|
|
|
361
286
|
value: function () {
|
|
362
287
|
var _compareAndSet = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(counterName, expected, updated) {
|
|
363
288
|
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
364
|
-
while (1) {
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
289
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
290
|
+
case 0:
|
|
291
|
+
if (!(!counterName || typeof counterName !== 'string')) {
|
|
292
|
+
_context10.next = 2;
|
|
293
|
+
break;
|
|
294
|
+
}
|
|
295
|
+
throw new Error('Counter Name must be provided and must be a string.');
|
|
296
|
+
case 2:
|
|
297
|
+
if (!(typeof expected !== 'number')) {
|
|
298
|
+
_context10.next = 4;
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
throw new Error('Counter Expected Value must be a number.');
|
|
302
|
+
case 4:
|
|
303
|
+
if (!(typeof updated !== 'number')) {
|
|
304
|
+
_context10.next = 6;
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
throw new Error('Counter Updated Value must be a number.');
|
|
308
|
+
case 6:
|
|
309
|
+
return _context10.abrupt("return", this.app.request.put({
|
|
310
|
+
url: this.app.urls.counterCompareAndSet(counterName),
|
|
311
|
+
query: {
|
|
312
|
+
expected: expected,
|
|
313
|
+
updatedvalue: updated
|
|
378
314
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
if (!(typeof updated !== 'number')) {
|
|
384
|
-
_context10.next = 6;
|
|
385
|
-
break;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
throw new Error('Counter Updated Value must be a number.');
|
|
389
|
-
|
|
390
|
-
case 6:
|
|
391
|
-
return _context10.abrupt("return", this.app.request.put({
|
|
392
|
-
url: this.app.urls.counterCompareAndSet(counterName),
|
|
393
|
-
query: {
|
|
394
|
-
expected: expected,
|
|
395
|
-
updatedvalue: updated
|
|
396
|
-
}
|
|
397
|
-
}));
|
|
398
|
-
|
|
399
|
-
case 7:
|
|
400
|
-
case "end":
|
|
401
|
-
return _context10.stop();
|
|
402
|
-
}
|
|
315
|
+
}));
|
|
316
|
+
case 7:
|
|
317
|
+
case "end":
|
|
318
|
+
return _context10.stop();
|
|
403
319
|
}
|
|
404
320
|
}, _callee10, this);
|
|
405
321
|
}));
|
|
406
|
-
|
|
407
322
|
function compareAndSet(_x12, _x13, _x14) {
|
|
408
323
|
return _compareAndSet.apply(this, arguments);
|
|
409
324
|
}
|
|
410
|
-
|
|
411
325
|
return compareAndSet;
|
|
412
326
|
}()
|
|
413
327
|
}]);
|
|
414
328
|
return Counters;
|
|
415
329
|
}();
|
|
416
|
-
|
|
417
330
|
exports["default"] = Counters;
|