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
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { HiveStore } from './base-store'
|
|
2
|
+
import { HiveTypes } from '../constants'
|
|
3
|
+
import Utils from '../../utils'
|
|
4
|
+
|
|
5
|
+
export class SetStore extends HiveStore {
|
|
6
|
+
|
|
7
|
+
static TYPE = HiveTypes.SET
|
|
8
|
+
|
|
9
|
+
static STATIC_METHODS = [...HiveStore.STATIC_METHODS, 'difference', 'intersection', 'union']
|
|
10
|
+
|
|
11
|
+
static difference(keyNames) {
|
|
12
|
+
if (!Array.isArray(keyNames)) {
|
|
13
|
+
throw new Error('Store keys must be provided and must be an array.')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return this.app.request
|
|
17
|
+
.post({
|
|
18
|
+
url : `${this.app.urls.hiveStore(this.hiveName, this.TYPE)}/action/difference`,
|
|
19
|
+
data: keyNames
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static intersection(keyNames) {
|
|
24
|
+
if (!Array.isArray(keyNames)) {
|
|
25
|
+
throw new Error('Store keys must be provided and must be an array.')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return this.app.request
|
|
29
|
+
.post({
|
|
30
|
+
url : `${this.app.urls.hiveStore(this.hiveName, this.TYPE)}/action/intersection`,
|
|
31
|
+
data: keyNames
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static union(keyNames) {
|
|
36
|
+
if (!Array.isArray(keyNames)) {
|
|
37
|
+
throw new Error('Store keys must be provided and must be an array.')
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return this.app.request
|
|
41
|
+
.post({
|
|
42
|
+
url : `${this.app.urls.hiveStore(this.hiveName, this.TYPE)}/action/union`,
|
|
43
|
+
data: keyNames
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get() {
|
|
48
|
+
return this.app.request
|
|
49
|
+
.get({
|
|
50
|
+
url: this.getBaseURL(),
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
getRandom(count) {
|
|
55
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
56
|
+
throw new Error('Count must be a number.')
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return this.app.request
|
|
60
|
+
.get({
|
|
61
|
+
url : `${this.getBaseURL()}/random`,
|
|
62
|
+
query: { count }
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
getRandomAndDelete(count) {
|
|
67
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
68
|
+
throw new Error('Count must be a number.')
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return this.app.request
|
|
72
|
+
.put({
|
|
73
|
+
url : `${this.getBaseURL()}/random`,
|
|
74
|
+
query: { count }
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
set(values) {
|
|
79
|
+
if (!values || (typeof values !== 'string' && !Array.isArray(values))) {
|
|
80
|
+
throw new Error('Value(s) must be provided and must be a string or list of strings.')
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return this.app.request
|
|
84
|
+
.put({
|
|
85
|
+
url : this.getBaseURL(),
|
|
86
|
+
data: Utils.castArray(values)
|
|
87
|
+
})
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
add(values) {
|
|
91
|
+
if (!values || !(typeof values === 'string' || Array.isArray(values))) {
|
|
92
|
+
throw new Error('Value(s) must be provided and must be a string or list of strings.')
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return this.app.request
|
|
96
|
+
.put({
|
|
97
|
+
url : `${this.getBaseURL()}/add`,
|
|
98
|
+
data: Utils.castArray(values)
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
deleteValues(values) {
|
|
103
|
+
if (!values || !(typeof values === 'string' || Array.isArray(values))) {
|
|
104
|
+
throw new Error('Value(s) must be provided and must be a string or list of strings.')
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return this.app.request
|
|
108
|
+
.delete({
|
|
109
|
+
url : `${this.getBaseURL()}/values`,
|
|
110
|
+
data: Utils.castArray(values)
|
|
111
|
+
})
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
isMember(value) {
|
|
115
|
+
if (typeof value === 'string') {
|
|
116
|
+
value = [value]
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!Array.isArray(value)) {
|
|
120
|
+
throw new Error('Value must be provided and must be a string or a list of strings.')
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return this.app.request
|
|
124
|
+
.post({
|
|
125
|
+
url : `${this.getBaseURL()}/contains`,
|
|
126
|
+
data: value
|
|
127
|
+
})
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
length() {
|
|
131
|
+
return this.app.request.get({
|
|
132
|
+
url: `${this.getBaseURL()}/length`,
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
}
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import { HiveStore } from './base-store'
|
|
2
|
+
import { HiveTypes } from '../constants'
|
|
3
|
+
import Utils from '../../utils'
|
|
4
|
+
|
|
5
|
+
import { SetStore } from './set'
|
|
6
|
+
|
|
7
|
+
export class SortedSetStore extends HiveStore {
|
|
8
|
+
|
|
9
|
+
static TYPE = HiveTypes.SORTED_SET
|
|
10
|
+
|
|
11
|
+
static STATIC_METHODS = [...HiveStore.STATIC_METHODS, 'difference', 'intersection', 'union']
|
|
12
|
+
|
|
13
|
+
static difference = SetStore.difference
|
|
14
|
+
|
|
15
|
+
static intersection(keyNames) {
|
|
16
|
+
if (!Array.isArray(keyNames)) {
|
|
17
|
+
throw new Error('Store keys must be provided and must be an array.')
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return this.app.request
|
|
21
|
+
.post({
|
|
22
|
+
url : `${this.app.urls.hiveStore(this.hiveName, this.TYPE)}/action/intersection`,
|
|
23
|
+
data: keyNames
|
|
24
|
+
})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
static union(keyNames) {
|
|
28
|
+
if (!Array.isArray(keyNames)) {
|
|
29
|
+
throw new Error('Store keys must be provided and must be an array.')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return this.app.request
|
|
33
|
+
.post({
|
|
34
|
+
url : `${this.app.urls.hiveStore(this.hiveName, this.TYPE)}/action/union`,
|
|
35
|
+
data: keyNames
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
add(items, options) {
|
|
40
|
+
if (!items || !Array.isArray(items)) {
|
|
41
|
+
throw new Error('Items must be provided and must be an array.')
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (options !== undefined) {
|
|
45
|
+
if (!Utils.isObject(options)) {
|
|
46
|
+
throw new Error('Options must be an object.')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const { duplicateBehaviour, scoreUpdateMode, resultType } = options
|
|
50
|
+
|
|
51
|
+
if (duplicateBehaviour !== undefined && !['OnlyUpdate', 'AlwaysAdd'].includes(duplicateBehaviour)) {
|
|
52
|
+
throw new Error('Duplicate Behaviour argument must be one of this values: OnlyUpdate, AlwaysAdd.')
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (scoreUpdateMode !== undefined && !['Greater', 'Less'].includes(scoreUpdateMode)) {
|
|
56
|
+
throw new Error('Score Update Mode argument must be one of this values: Greater, Less.')
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (resultType !== undefined && !['NewAdded', 'TotalChanged'].includes(resultType)) {
|
|
60
|
+
throw new Error('Result Type must be one of this values: NewAdded, TotalChanged.')
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return this.app.request
|
|
65
|
+
.put({
|
|
66
|
+
url : `${this.getBaseURL()}/add`,
|
|
67
|
+
data: {
|
|
68
|
+
items,
|
|
69
|
+
...options
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
set(items, options) {
|
|
75
|
+
if (!items || !Array.isArray(items)) {
|
|
76
|
+
throw new Error('Items must be provided and must be an array.')
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (options !== undefined) {
|
|
80
|
+
if (!Utils.isObject(options)) {
|
|
81
|
+
throw new Error('Options must be an object.')
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const { duplicateBehaviour, scoreUpdateMode, resultType } = options
|
|
85
|
+
|
|
86
|
+
if (duplicateBehaviour !== undefined && !['OnlyUpdate', 'AlwaysAdd'].includes(duplicateBehaviour)) {
|
|
87
|
+
throw new Error('Duplicate Behaviour argument must be one of this values: OnlyUpdate, AlwaysAdd.')
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (scoreUpdateMode !== undefined && !['Greater', 'Less'].includes(scoreUpdateMode)) {
|
|
91
|
+
throw new Error('Score Update Mode argument must be one of this values: Greater, Less.')
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (resultType !== undefined && !['NewAdded', 'TotalChanged'].includes(resultType)) {
|
|
95
|
+
throw new Error('Result Type must be one of this values: NewAdded, TotalChanged.')
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//TODO: Waining for BKNDLSS-28543
|
|
100
|
+
return this.app.request
|
|
101
|
+
.put({
|
|
102
|
+
url : this.getBaseURL(),
|
|
103
|
+
data: {
|
|
104
|
+
items,
|
|
105
|
+
...options
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
incrementScore(value, scoreValue) {
|
|
111
|
+
if (!value || typeof value !== 'string') {
|
|
112
|
+
throw new Error('Value must be provided and must be a string.')
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
116
|
+
throw new Error('ScoreValue must be provided and must be a number.')
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return this.app.request
|
|
120
|
+
.put({
|
|
121
|
+
url : `${this.getBaseURL()}/increment`,
|
|
122
|
+
data: {
|
|
123
|
+
scoreValue,
|
|
124
|
+
value,
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
decrementScore(value, scoreValue) {
|
|
130
|
+
if (!value || typeof value !== 'string') {
|
|
131
|
+
throw new Error('Value must be provided and must be a string.')
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
135
|
+
throw new Error('ScoreValue must be provided and must be a number.')
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return this.app.request
|
|
139
|
+
.put({
|
|
140
|
+
url : `${this.getBaseURL()}/decrement`,
|
|
141
|
+
data: {
|
|
142
|
+
scoreValue,
|
|
143
|
+
value,
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
getAndDeleteMaxScore(count) {
|
|
149
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
150
|
+
throw new Error('Count must be a number.')
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return this.app.request
|
|
154
|
+
.put({
|
|
155
|
+
url : `${this.getBaseURL()}/get-with-max-score-and-delete`,
|
|
156
|
+
query: { count },
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
getAndDeleteMinScore(count) {
|
|
161
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
162
|
+
throw new Error('Count must be a number.')
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return this.app.request
|
|
166
|
+
.put({
|
|
167
|
+
url : `${this.getBaseURL()}/get-with-min-score-and-delete`,
|
|
168
|
+
query: { count },
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
getRandom(options) {
|
|
173
|
+
if (options !== undefined) {
|
|
174
|
+
if (!Utils.isObject(options)) {
|
|
175
|
+
throw new Error('Options must be an object.')
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
const { count, withScores } = options
|
|
179
|
+
|
|
180
|
+
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
181
|
+
throw new Error('Count must be a number.')
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
185
|
+
throw new Error('With Scores argument must be a boolean.')
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return this.app.request
|
|
190
|
+
.get({
|
|
191
|
+
url : `${this.getBaseURL()}/get-random`,
|
|
192
|
+
query: { ...options },
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
getScore(value) {
|
|
197
|
+
if (!value || typeof value !== 'string') {
|
|
198
|
+
throw new Error('Value must be provided and must be a string.')
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return this.app.request
|
|
202
|
+
.post({
|
|
203
|
+
url : `${this.getBaseURL()}/get-score`,
|
|
204
|
+
data: {
|
|
205
|
+
value
|
|
206
|
+
},
|
|
207
|
+
})
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
getRank(value, reverse) {
|
|
211
|
+
if (!value || typeof value !== 'string') {
|
|
212
|
+
throw new Error('Value must be provided and must be a string.')
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
216
|
+
throw new Error('Reverse argument must be a boolean.')
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return this.app.request
|
|
220
|
+
.post({
|
|
221
|
+
url : `${this.getBaseURL()}/get-rank`,
|
|
222
|
+
data: {
|
|
223
|
+
value,
|
|
224
|
+
reverse
|
|
225
|
+
},
|
|
226
|
+
})
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
getRangeByRank(startRank, stopRank, options) {
|
|
230
|
+
if (isNaN(startRank) || typeof startRank !== 'number') {
|
|
231
|
+
throw new Error('Start Rank must be provided and must be a number.')
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
if (isNaN(stopRank) || typeof stopRank !== 'number') {
|
|
235
|
+
throw new Error('Stop Rank must be provided and must be a number.')
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (options !== undefined) {
|
|
239
|
+
if (!Utils.isObject(options)) {
|
|
240
|
+
throw new Error('Options must be an object.')
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const { withScores, reverse } = options
|
|
244
|
+
|
|
245
|
+
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
246
|
+
throw new Error('With Scores argument must be a boolean.')
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
250
|
+
throw new Error('Reverse argument must be a boolean.')
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return this.app.request
|
|
255
|
+
.get({
|
|
256
|
+
url : `${this.getBaseURL()}/get-range-by-rank`,
|
|
257
|
+
query: { startRank, stopRank, ...options },
|
|
258
|
+
})
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
getRangeByScore(options) {
|
|
262
|
+
if (options !== undefined) {
|
|
263
|
+
if (!Utils.isObject(options)) {
|
|
264
|
+
throw new Error('Options must be an object.')
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const { minScore, maxScore, minBound, maxBound, offset, count, withScores, reverse } = options
|
|
268
|
+
|
|
269
|
+
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
270
|
+
throw new Error('Minimal Score must be a number.')
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
274
|
+
throw new Error('Maximal Score must be a number.')
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
278
|
+
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.')
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
282
|
+
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.')
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (offset !== undefined && (typeof offset !== 'number' || isNaN(offset))) {
|
|
286
|
+
throw new Error('Offset must be a number.')
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (count !== undefined && (typeof count !== 'number' || isNaN(count))) {
|
|
290
|
+
throw new Error('Count must be a number.')
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (withScores !== undefined && typeof withScores !== 'boolean') {
|
|
294
|
+
throw new Error('With Scores argument must be a boolean.')
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
298
|
+
throw new Error('Reverse argument must be a boolean.')
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return this.app.request
|
|
303
|
+
.get({
|
|
304
|
+
url : `${this.getBaseURL()}/get-range-by-score`,
|
|
305
|
+
query: { ...options },
|
|
306
|
+
})
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
deleteValues(values) {
|
|
310
|
+
if (!values || !(typeof values === 'string' || Array.isArray(values))) {
|
|
311
|
+
throw new Error('Value(s) must be provided and must be a string or list of strings.')
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return this.app.request
|
|
315
|
+
.delete({
|
|
316
|
+
url : `${this.getBaseURL()}/values`,
|
|
317
|
+
data: Utils.castArray(values)
|
|
318
|
+
})
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
deleteValuesByRank(startRank, stopRank) {
|
|
322
|
+
if (isNaN(startRank) || typeof startRank !== 'number') {
|
|
323
|
+
throw new Error('Start Rank must be provided and must be a number.')
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (isNaN(stopRank) || typeof stopRank !== 'number') {
|
|
327
|
+
throw new Error('Stop Rank must be provided and must be a number.')
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return this.app.request
|
|
331
|
+
.delete({
|
|
332
|
+
url : `${this.getBaseURL()}/delete-by-rank`,
|
|
333
|
+
query: { startRank, stopRank },
|
|
334
|
+
})
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
deleteValuesByScore(options) {
|
|
338
|
+
if (options !== undefined) {
|
|
339
|
+
if (!Utils.isObject(options)) {
|
|
340
|
+
throw new Error('Options must be an object.')
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
const { minScore, maxScore, minBound, maxBound } = options
|
|
344
|
+
|
|
345
|
+
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
346
|
+
throw new Error('Minimal Score must be a number.')
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
350
|
+
throw new Error('Maximal Score must be a number.')
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
354
|
+
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.')
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
358
|
+
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.')
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return this.app.request
|
|
363
|
+
.delete({
|
|
364
|
+
url : `${this.getBaseURL()}/delete-by-score`,
|
|
365
|
+
query: { ...options },
|
|
366
|
+
})
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
length() {
|
|
370
|
+
return this.app.request
|
|
371
|
+
.get({
|
|
372
|
+
url: `${this.getBaseURL()}/length`,
|
|
373
|
+
})
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
countBetweenScores(options) {
|
|
377
|
+
if (options !== undefined) {
|
|
378
|
+
if (!Utils.isObject(options)) {
|
|
379
|
+
throw new Error('Options must be an object.')
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const { minScore, maxScore, minBound, maxBound } = options
|
|
383
|
+
|
|
384
|
+
if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
|
|
385
|
+
throw new Error('Minimal Score must be a number.')
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if (maxScore !== undefined && (isNaN(maxScore) || typeof maxScore !== 'number')) {
|
|
389
|
+
throw new Error('Maximal Score must be a number.')
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
if (minBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(minBound)) {
|
|
393
|
+
throw new Error('Minimal bound must be one of this values: Include, Exclude, Infinity.')
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
if (maxBound !== undefined && !['Include', 'Exclude', 'Infinity'].includes(maxBound)) {
|
|
397
|
+
throw new Error('Maximal bound must be one of this values: Include, Exclude, Infinity.')
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
return this.app.request
|
|
402
|
+
.get({
|
|
403
|
+
url : `${this.getBaseURL()}/count`,
|
|
404
|
+
query: { ...options },
|
|
405
|
+
})
|
|
406
|
+
}
|
|
407
|
+
}
|
package/src/index.js
CHANGED
|
@@ -79,6 +79,7 @@ const SERVICES = {
|
|
|
79
79
|
'Users' : () => require('./users').default,
|
|
80
80
|
'BL' : () => require('./bl').default,
|
|
81
81
|
'Data' : () => require('./data').default,
|
|
82
|
+
'Hive' : () => require('./hive').default,
|
|
82
83
|
'Messaging' : () => require('./messaging').default,
|
|
83
84
|
'Files' : () => require('./files').default,
|
|
84
85
|
'RT' : () => require('./rt').default,
|
|
@@ -393,6 +394,10 @@ class Backendless {
|
|
|
393
394
|
return this.__getService('Data')
|
|
394
395
|
}
|
|
395
396
|
|
|
397
|
+
get Hive() {
|
|
398
|
+
return this.__getService('Hive')
|
|
399
|
+
}
|
|
400
|
+
|
|
396
401
|
get Messaging() {
|
|
397
402
|
return this.__getService('Messaging')
|
|
398
403
|
}
|
package/src/urls.js
CHANGED
|
@@ -165,7 +165,17 @@ export default class Urls {
|
|
|
165
165
|
return `${this.root()}/transaction/unit-of-work`
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
dataHives() {
|
|
169
|
+
return `${this.root()}/hive`
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
dataHive(name) {
|
|
173
|
+
return `${this.dataHives()}/${name}`
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
hiveStore(name, storeType) {
|
|
177
|
+
return `${this.dataHive(name)}/${storeType}`
|
|
178
|
+
}
|
|
169
179
|
|
|
170
180
|
messaging() {
|
|
171
181
|
return `${this.root()}/messaging`
|