backendless 6.5.0 → 6.5.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 +53 -49
- package/dist/backendless.js +184 -56
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/hive/stores/key-value.js +6 -0
- package/es/hive/stores/list.js +51 -19
- package/es/hive/stores/map.js +6 -4
- package/es/hive/stores/set.js +65 -21
- package/es/hive/stores/sorted-set.js +25 -11
- package/es/hive/utils.js +19 -0
- package/lib/hive/stores/key-value.js +6 -0
- package/lib/hive/stores/list.js +51 -19
- package/lib/hive/stores/map.js +6 -4
- package/lib/hive/stores/set.js +65 -21
- package/lib/hive/stores/sorted-set.js +25 -11
- package/lib/hive/utils.js +19 -0
- package/package.json +1 -1
- package/src/hive/stores/key-value.js +5 -0
- package/src/hive/stores/list.js +51 -17
- package/src/hive/stores/map.js +5 -4
- package/src/hive/stores/set.js +62 -18
- package/src/hive/stores/sorted-set.js +24 -12
- package/src/hive/utils.js +13 -0
package/backendless.d.ts
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* @namespace Backendless
|
|
4
4
|
*/
|
|
5
5
|
declare module Backendless {
|
|
6
|
+
type JSONValue = string | number | boolean | { [x: string]: JSONValue } | Array<JSONValue>
|
|
7
|
+
|
|
6
8
|
let debugMode: boolean;
|
|
7
9
|
let useTableClassesFromGlobalScope: boolean;
|
|
8
10
|
let serverURL: string;
|
|
@@ -377,7 +379,7 @@ declare module Backendless {
|
|
|
377
379
|
|
|
378
380
|
get(keys: Array<string>): Promise<object>;
|
|
379
381
|
|
|
380
|
-
set(key: string, value:
|
|
382
|
+
set(key: string, value: JSONValue, options?: KeyValueSetKeyOptionsI): Promise<boolean>;
|
|
381
383
|
|
|
382
384
|
set(keysMap: object): Promise<boolean>;
|
|
383
385
|
}
|
|
@@ -386,9 +388,9 @@ declare module Backendless {
|
|
|
386
388
|
* @public
|
|
387
389
|
*/
|
|
388
390
|
interface keyValueStore extends hiveStore {
|
|
389
|
-
get(): Promise<
|
|
391
|
+
get(): Promise<JSONValue | null>;
|
|
390
392
|
|
|
391
|
-
set(value:
|
|
393
|
+
set(value: JSONValue, options?: KeyValueSetKeyOptionsI): Promise<boolean>;
|
|
392
394
|
|
|
393
395
|
increment(value: number): Promise<number>;
|
|
394
396
|
|
|
@@ -406,39 +408,39 @@ declare module Backendless {
|
|
|
406
408
|
* @public
|
|
407
409
|
*/
|
|
408
410
|
interface listStore extends hiveStore {
|
|
409
|
-
get(): Promise<Array<
|
|
411
|
+
get(): Promise<Array<JSONValue>>
|
|
410
412
|
|
|
411
|
-
get(index: number): Promise<
|
|
413
|
+
get(index: number): Promise<JSONValue | null>
|
|
412
414
|
|
|
413
|
-
get(indexFrom: number, indexTo: number): Promise<Array<
|
|
415
|
+
get(indexFrom: number, indexTo: number): Promise<Array<JSONValue>>
|
|
414
416
|
|
|
415
|
-
set(values: Array<
|
|
417
|
+
set(values: Array<JSONValue>): Promise<number>;
|
|
416
418
|
|
|
417
|
-
set(value:
|
|
419
|
+
set(value: JSONValue, index: number): Promise<void>;
|
|
418
420
|
|
|
419
|
-
insertBefore(valueToInsert:
|
|
421
|
+
insertBefore(valueToInsert: JSONValue, anchorValue: JSONValue): Promise<number>;
|
|
420
422
|
|
|
421
|
-
insertAfter(valueToInsert:
|
|
423
|
+
insertAfter(valueToInsert: JSONValue, anchorValue: JSONValue): Promise<number>;
|
|
422
424
|
|
|
423
425
|
length(): Promise<number>;
|
|
424
426
|
|
|
425
|
-
|
|
427
|
+
addFirstValue(value: JSONValue): Promise<number>
|
|
426
428
|
|
|
427
|
-
|
|
429
|
+
addFirstValues(values: Array<JSONValue>): Promise<number>
|
|
428
430
|
|
|
429
|
-
|
|
431
|
+
addLastValue(value: JSONValue): Promise<number>
|
|
430
432
|
|
|
431
|
-
|
|
433
|
+
addLastValues(values: Array<JSONValue>): Promise<number>
|
|
432
434
|
|
|
433
|
-
deleteFirst(): Promise<
|
|
435
|
+
deleteFirst(): Promise<Array<JSONValue>>
|
|
434
436
|
|
|
435
|
-
deleteFirst(count: number): Promise<Array<
|
|
437
|
+
deleteFirst(count: number): Promise<Array<JSONValue>>
|
|
436
438
|
|
|
437
|
-
deleteLast(): Promise<
|
|
439
|
+
deleteLast(): Promise<Array<JSONValue>>
|
|
438
440
|
|
|
439
|
-
deleteLast(count: number): Promise<Array<
|
|
441
|
+
deleteLast(count: number): Promise<Array<JSONValue>>
|
|
440
442
|
|
|
441
|
-
deleteValue(value:
|
|
443
|
+
deleteValue(value: JSONValue, count?: number): Promise<number>
|
|
442
444
|
}
|
|
443
445
|
|
|
444
446
|
/**
|
|
@@ -459,7 +461,7 @@ declare module Backendless {
|
|
|
459
461
|
|
|
460
462
|
get(keys: Array<string>): Promise<object>;
|
|
461
463
|
|
|
462
|
-
getValue(key: string): Promise<
|
|
464
|
+
getValue(key: string): Promise<JSONValue | null>;
|
|
463
465
|
|
|
464
466
|
keyExists(key: string): Promise<boolean>;
|
|
465
467
|
|
|
@@ -467,13 +469,13 @@ declare module Backendless {
|
|
|
467
469
|
|
|
468
470
|
keys(): Promise<Array<string>>;
|
|
469
471
|
|
|
470
|
-
values(): Promise<Array<
|
|
472
|
+
values(): Promise<Array<JSONValue>>;
|
|
471
473
|
|
|
472
474
|
set(data: object): Promise<number>;
|
|
473
475
|
|
|
474
|
-
set(key: string, value:
|
|
476
|
+
set(key: string, value: JSONValue): Promise<boolean>;
|
|
475
477
|
|
|
476
|
-
setWithOverwrite(key: string, value:
|
|
478
|
+
setWithOverwrite(key: string, value: JSONValue, overwrite?: boolean): Promise<boolean>;
|
|
477
479
|
|
|
478
480
|
add(data: object): Promise<number>;
|
|
479
481
|
|
|
@@ -492,11 +494,11 @@ declare module Backendless {
|
|
|
492
494
|
interface SetStore extends HiveStore {
|
|
493
495
|
(keyName: string): setStore;
|
|
494
496
|
|
|
495
|
-
difference(storeKeys: Array<string>): Promise<Array<
|
|
497
|
+
difference(storeKeys: Array<string>): Promise<Array<JSONValue>>;
|
|
496
498
|
|
|
497
|
-
intersection(storeKeys: Array<string>): Promise<Array<
|
|
499
|
+
intersection(storeKeys: Array<string>): Promise<Array<JSONValue>>;
|
|
498
500
|
|
|
499
|
-
union(storeKeys: Array<string>): Promise<Array<
|
|
501
|
+
union(storeKeys: Array<string>): Promise<Array<JSONValue>>;
|
|
500
502
|
}
|
|
501
503
|
|
|
502
504
|
/**
|
|
@@ -504,30 +506,32 @@ declare module Backendless {
|
|
|
504
506
|
*/
|
|
505
507
|
interface setStore extends hiveStore {
|
|
506
508
|
|
|
507
|
-
get(): Promise<Array<
|
|
509
|
+
get(): Promise<Array<JSONValue>>;
|
|
510
|
+
|
|
511
|
+
getRandom(count?: number): Promise<Array<JSONValue>>;
|
|
508
512
|
|
|
509
|
-
|
|
513
|
+
getRandomAndDelete(count?: number): Promise<Array<JSONValue>>;
|
|
510
514
|
|
|
511
|
-
|
|
515
|
+
setValue(value: JSONValue): Promise<number>;
|
|
512
516
|
|
|
513
|
-
|
|
517
|
+
setValues(values: Array<JSONValue>): Promise<number>;
|
|
514
518
|
|
|
515
|
-
|
|
519
|
+
addValue(value: JSONValue): Promise<number>;
|
|
516
520
|
|
|
517
|
-
|
|
521
|
+
addValues(values: Array<JSONValue>): Promise<number>;
|
|
518
522
|
|
|
519
|
-
|
|
523
|
+
deleteValue(value: JSONValue): Promise<number>;
|
|
520
524
|
|
|
521
|
-
deleteValues(
|
|
525
|
+
deleteValues(values: Array<JSONValue>): Promise<number>;
|
|
522
526
|
|
|
523
|
-
|
|
527
|
+
isValueMember(value: JSONValue): Promise<Array<boolean>>;
|
|
524
528
|
|
|
525
|
-
|
|
529
|
+
isValuesMembers(values: Array<JSONValue>): Promise<Array<boolean>>;
|
|
526
530
|
|
|
527
531
|
length(): Promise<number>;
|
|
528
532
|
}
|
|
529
533
|
|
|
530
|
-
type SortedSetItem = [number,
|
|
534
|
+
type SortedSetItem = [number, JSONValue]
|
|
531
535
|
type SortedSetBound = 'Include' | 'Exclude' | 'Infinity'
|
|
532
536
|
|
|
533
537
|
interface SortedSetItemOptionsI {
|
|
@@ -549,11 +553,11 @@ declare module Backendless {
|
|
|
549
553
|
interface SortedSetStore extends HiveStore {
|
|
550
554
|
(keyName: string): sortedSetStore
|
|
551
555
|
|
|
552
|
-
difference(storeKeys: Array<string>): Promise<Array<
|
|
556
|
+
difference(storeKeys: Array<string>): Promise<Array<JSONValue>>;
|
|
553
557
|
|
|
554
|
-
intersection(storeKeys: Array<string>): Promise<Array<
|
|
558
|
+
intersection(storeKeys: Array<string>): Promise<Array<JSONValue>>;
|
|
555
559
|
|
|
556
|
-
union(storeKeys: Array<string>): Promise<Array<
|
|
560
|
+
union(storeKeys: Array<string>): Promise<Array<JSONValue>>;
|
|
557
561
|
}
|
|
558
562
|
|
|
559
563
|
/**
|
|
@@ -565,26 +569,26 @@ declare module Backendless {
|
|
|
565
569
|
|
|
566
570
|
set(items: Array<SortedSetItem>, options?: SortedSetItemOptionsI): Promise<number>
|
|
567
571
|
|
|
568
|
-
incrementScore(value:
|
|
572
|
+
incrementScore(value: JSONValue, scoreValue: number): Promise<number>
|
|
569
573
|
|
|
570
|
-
decrementScore(value:
|
|
574
|
+
decrementScore(value: JSONValue, scoreValue: number): Promise<number>
|
|
571
575
|
|
|
572
576
|
getAndDeleteMaxScore(count?: number): Promise<Array<SortedSetItem>>
|
|
573
577
|
|
|
574
578
|
getAndDeleteMinScore(count?: number): Promise<Array<SortedSetItem>>
|
|
575
579
|
|
|
576
|
-
getRandom<T = SortedSetItem |
|
|
580
|
+
getRandom<T = SortedSetItem | JSONValue>(options?: { count?: number, withScores?: boolean }): Promise<Array<T>>
|
|
577
581
|
|
|
578
|
-
getScore(value:
|
|
582
|
+
getScore(value: JSONValue): Promise<number | null>
|
|
579
583
|
|
|
580
|
-
getRank(value:
|
|
584
|
+
getRank(value: JSONValue, reverse?: boolean): Promise<number | null>
|
|
581
585
|
|
|
582
|
-
getRangeByRank<T = SortedSetItem |
|
|
586
|
+
getRangeByRank<T = SortedSetItem | JSONValue>(startRank: number, stopRank: number, options?: {
|
|
583
587
|
reverse?: boolean,
|
|
584
588
|
withScores?: boolean
|
|
585
589
|
}): Promise<Array<T>>
|
|
586
590
|
|
|
587
|
-
getRangeByScore<T = SortedSetItem |
|
|
591
|
+
getRangeByScore<T = SortedSetItem | JSONValue>(options?: {
|
|
588
592
|
minScore?: number,
|
|
589
593
|
maxScore?: number,
|
|
590
594
|
minBound?: SortedSetBound,
|
|
@@ -595,9 +599,9 @@ declare module Backendless {
|
|
|
595
599
|
withScores?: boolean
|
|
596
600
|
}): Promise<Array<T>>
|
|
597
601
|
|
|
598
|
-
|
|
602
|
+
deleteValue(value: JSONValue): Promise<number>;
|
|
599
603
|
|
|
600
|
-
deleteValues(values: Array<
|
|
604
|
+
deleteValues(values: Array<JSONValue>): Promise<number>;
|
|
601
605
|
|
|
602
606
|
deleteValuesByRank(startRank: number, stopRank: number): Promise<number>;
|
|
603
607
|
|
package/dist/backendless.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ********************************************************************************************************************
|
|
3
|
-
* Backendless SDK for JavaScript. Version: 6.5.
|
|
3
|
+
* Backendless SDK for JavaScript. Version: 6.5.2
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2012-2022 BACKENDLESS.COM. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -19033,6 +19033,8 @@ var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base
|
|
|
19033
19033
|
|
|
19034
19034
|
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
19035
19035
|
|
|
19036
|
+
var _utils2 = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19037
|
+
|
|
19036
19038
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19037
19039
|
|
|
19038
19040
|
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; }
|
|
@@ -19143,6 +19145,10 @@ var KeyValueStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19143
19145
|
}
|
|
19144
19146
|
}
|
|
19145
19147
|
|
|
19148
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
19149
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19150
|
+
}
|
|
19151
|
+
|
|
19146
19152
|
return this.app.request.put({
|
|
19147
19153
|
url: "".concat(this.app.urls.hiveStore(this.hiveName, this.TYPE), "/").concat(key),
|
|
19148
19154
|
data: _objectSpread({
|
|
@@ -19193,7 +19199,7 @@ var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.j
|
|
|
19193
19199
|
|
|
19194
19200
|
var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base-store.js");
|
|
19195
19201
|
|
|
19196
|
-
var _utils =
|
|
19202
|
+
var _utils = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19197
19203
|
|
|
19198
19204
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
19199
19205
|
|
|
@@ -19247,14 +19253,22 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19247
19253
|
}, {
|
|
19248
19254
|
key: "set",
|
|
19249
19255
|
value: function set(value, index) {
|
|
19250
|
-
if (
|
|
19256
|
+
if (typeof index === 'undefined') {
|
|
19257
|
+
if (!value || !Array.isArray(value) || !value.length || !(0, _utils.isHiveValueValid)(value)) {
|
|
19258
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19259
|
+
}
|
|
19260
|
+
|
|
19251
19261
|
return this.app.request.put({
|
|
19252
19262
|
url: this.getBaseURL(),
|
|
19253
19263
|
data: value
|
|
19254
19264
|
});
|
|
19255
19265
|
}
|
|
19256
19266
|
|
|
19257
|
-
if (
|
|
19267
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19268
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19269
|
+
}
|
|
19270
|
+
|
|
19271
|
+
if (typeof index !== 'number' || isNaN(index)) {
|
|
19258
19272
|
throw new Error('Index must be a number.');
|
|
19259
19273
|
}
|
|
19260
19274
|
|
|
@@ -19285,12 +19299,12 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19285
19299
|
}, {
|
|
19286
19300
|
key: "insert",
|
|
19287
19301
|
value: function insert(valueToInsert, anchorValue, before) {
|
|
19288
|
-
if (!
|
|
19289
|
-
throw new Error('ValueToInsert must be provided and must be
|
|
19302
|
+
if (!(0, _utils.isHiveValueValid)(valueToInsert)) {
|
|
19303
|
+
throw new Error('ValueToInsert must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19290
19304
|
}
|
|
19291
19305
|
|
|
19292
|
-
if (!
|
|
19293
|
-
throw new Error('AnchorValue must be provided and must be
|
|
19306
|
+
if (!(0, _utils.isHiveValueValid)(anchorValue)) {
|
|
19307
|
+
throw new Error('AnchorValue must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19294
19308
|
}
|
|
19295
19309
|
|
|
19296
19310
|
return this.app.request.put({
|
|
@@ -19304,8 +19318,8 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19304
19318
|
}, {
|
|
19305
19319
|
key: "deleteValue",
|
|
19306
19320
|
value: function deleteValue(value, count) {
|
|
19307
|
-
if (!
|
|
19308
|
-
throw new Error('Value must be provided and must be
|
|
19321
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19322
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19309
19323
|
}
|
|
19310
19324
|
|
|
19311
19325
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
@@ -19321,27 +19335,51 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19321
19335
|
});
|
|
19322
19336
|
}
|
|
19323
19337
|
}, {
|
|
19324
|
-
key: "
|
|
19325
|
-
value: function
|
|
19326
|
-
if (!
|
|
19327
|
-
throw new Error('Value
|
|
19338
|
+
key: "addFirstValue",
|
|
19339
|
+
value: function addFirstValue(value) {
|
|
19340
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19341
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19328
19342
|
}
|
|
19329
19343
|
|
|
19330
19344
|
return this.app.request.put({
|
|
19331
19345
|
url: "".concat(this.getBaseURL(), "/add-first"),
|
|
19332
|
-
data:
|
|
19346
|
+
data: [value]
|
|
19347
|
+
});
|
|
19348
|
+
}
|
|
19349
|
+
}, {
|
|
19350
|
+
key: "addFirstValues",
|
|
19351
|
+
value: function addFirstValues(values) {
|
|
19352
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19353
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19354
|
+
}
|
|
19355
|
+
|
|
19356
|
+
return this.app.request.put({
|
|
19357
|
+
url: "".concat(this.getBaseURL(), "/add-first"),
|
|
19358
|
+
data: values
|
|
19359
|
+
});
|
|
19360
|
+
}
|
|
19361
|
+
}, {
|
|
19362
|
+
key: "addLastValue",
|
|
19363
|
+
value: function addLastValue(value) {
|
|
19364
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19365
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19366
|
+
}
|
|
19367
|
+
|
|
19368
|
+
return this.app.request.put({
|
|
19369
|
+
url: "".concat(this.getBaseURL(), "/add-last"),
|
|
19370
|
+
data: [value]
|
|
19333
19371
|
});
|
|
19334
19372
|
}
|
|
19335
19373
|
}, {
|
|
19336
|
-
key: "
|
|
19337
|
-
value: function
|
|
19338
|
-
if (!
|
|
19339
|
-
throw new Error('Value
|
|
19374
|
+
key: "addLastValues",
|
|
19375
|
+
value: function addLastValues(values) {
|
|
19376
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19377
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19340
19378
|
}
|
|
19341
19379
|
|
|
19342
19380
|
return this.app.request.put({
|
|
19343
19381
|
url: "".concat(this.getBaseURL(), "/add-last"),
|
|
19344
|
-
data:
|
|
19382
|
+
data: values
|
|
19345
19383
|
});
|
|
19346
19384
|
}
|
|
19347
19385
|
}, {
|
|
@@ -19416,6 +19454,8 @@ var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base
|
|
|
19416
19454
|
|
|
19417
19455
|
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
19418
19456
|
|
|
19457
|
+
var _utils2 = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19458
|
+
|
|
19419
19459
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
19420
19460
|
|
|
19421
19461
|
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; } }
|
|
@@ -19507,8 +19547,8 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19507
19547
|
throw new Error('Key must be a string.');
|
|
19508
19548
|
}
|
|
19509
19549
|
|
|
19510
|
-
if (!
|
|
19511
|
-
throw new Error('Value must be provided and must be
|
|
19550
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
19551
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19512
19552
|
}
|
|
19513
19553
|
|
|
19514
19554
|
return this.app.request.put({
|
|
@@ -19525,8 +19565,8 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19525
19565
|
throw new Error('Key must be provided and must be a string.');
|
|
19526
19566
|
}
|
|
19527
19567
|
|
|
19528
|
-
if (!
|
|
19529
|
-
throw new Error('Value must be provided and must be
|
|
19568
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
19569
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19530
19570
|
}
|
|
19531
19571
|
|
|
19532
19572
|
if (overwrite !== undefined && typeof overwrite !== 'boolean') {
|
|
@@ -19649,7 +19689,7 @@ var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base
|
|
|
19649
19689
|
|
|
19650
19690
|
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19651
19691
|
|
|
19652
|
-
var _utils =
|
|
19692
|
+
var _utils = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19653
19693
|
|
|
19654
19694
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
19655
19695
|
|
|
@@ -19701,55 +19741,99 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19701
19741
|
});
|
|
19702
19742
|
}
|
|
19703
19743
|
}, {
|
|
19704
|
-
key: "
|
|
19705
|
-
value: function
|
|
19706
|
-
if (!
|
|
19707
|
-
throw new Error('Value
|
|
19744
|
+
key: "setValue",
|
|
19745
|
+
value: function setValue(value) {
|
|
19746
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19747
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19708
19748
|
}
|
|
19709
19749
|
|
|
19710
19750
|
return this.app.request.put({
|
|
19711
19751
|
url: this.getBaseURL(),
|
|
19712
|
-
data:
|
|
19752
|
+
data: [value]
|
|
19713
19753
|
});
|
|
19714
19754
|
}
|
|
19715
19755
|
}, {
|
|
19716
|
-
key: "
|
|
19717
|
-
value: function
|
|
19718
|
-
if (!values || !(
|
|
19719
|
-
throw new Error('Value
|
|
19756
|
+
key: "setValues",
|
|
19757
|
+
value: function setValues(values) {
|
|
19758
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19759
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19760
|
+
}
|
|
19761
|
+
|
|
19762
|
+
return this.app.request.put({
|
|
19763
|
+
url: this.getBaseURL(),
|
|
19764
|
+
data: values
|
|
19765
|
+
});
|
|
19766
|
+
}
|
|
19767
|
+
}, {
|
|
19768
|
+
key: "addValue",
|
|
19769
|
+
value: function addValue(value) {
|
|
19770
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19771
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19772
|
+
}
|
|
19773
|
+
|
|
19774
|
+
return this.app.request.put({
|
|
19775
|
+
url: "".concat(this.getBaseURL(), "/add"),
|
|
19776
|
+
data: [value]
|
|
19777
|
+
});
|
|
19778
|
+
}
|
|
19779
|
+
}, {
|
|
19780
|
+
key: "addValues",
|
|
19781
|
+
value: function addValues(values) {
|
|
19782
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19783
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19720
19784
|
}
|
|
19721
19785
|
|
|
19722
19786
|
return this.app.request.put({
|
|
19723
19787
|
url: "".concat(this.getBaseURL(), "/add"),
|
|
19724
|
-
data:
|
|
19788
|
+
data: values
|
|
19789
|
+
});
|
|
19790
|
+
}
|
|
19791
|
+
}, {
|
|
19792
|
+
key: "deleteValue",
|
|
19793
|
+
value: function deleteValue(value) {
|
|
19794
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19795
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19796
|
+
}
|
|
19797
|
+
|
|
19798
|
+
return this.app.request["delete"]({
|
|
19799
|
+
url: "".concat(this.getBaseURL(), "/values"),
|
|
19800
|
+
data: [value]
|
|
19725
19801
|
});
|
|
19726
19802
|
}
|
|
19727
19803
|
}, {
|
|
19728
19804
|
key: "deleteValues",
|
|
19729
19805
|
value: function deleteValues(values) {
|
|
19730
|
-
if (!values || !(
|
|
19731
|
-
throw new Error('Value
|
|
19806
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19807
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19732
19808
|
}
|
|
19733
19809
|
|
|
19734
19810
|
return this.app.request["delete"]({
|
|
19735
19811
|
url: "".concat(this.getBaseURL(), "/values"),
|
|
19736
|
-
data:
|
|
19812
|
+
data: values
|
|
19737
19813
|
});
|
|
19738
19814
|
}
|
|
19739
19815
|
}, {
|
|
19740
|
-
key: "
|
|
19741
|
-
value: function
|
|
19742
|
-
if (
|
|
19743
|
-
|
|
19816
|
+
key: "isValueMember",
|
|
19817
|
+
value: function isValueMember(value) {
|
|
19818
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19819
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19744
19820
|
}
|
|
19745
19821
|
|
|
19746
|
-
|
|
19747
|
-
|
|
19822
|
+
return this.app.request.post({
|
|
19823
|
+
url: "".concat(this.getBaseURL(), "/contains"),
|
|
19824
|
+
data: [value]
|
|
19825
|
+
});
|
|
19826
|
+
}
|
|
19827
|
+
}, {
|
|
19828
|
+
key: "isValuesMembers",
|
|
19829
|
+
value: function isValuesMembers(values) {
|
|
19830
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19831
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19748
19832
|
}
|
|
19749
19833
|
|
|
19750
19834
|
return this.app.request.post({
|
|
19751
19835
|
url: "".concat(this.getBaseURL(), "/contains"),
|
|
19752
|
-
data:
|
|
19836
|
+
data: values
|
|
19753
19837
|
});
|
|
19754
19838
|
}
|
|
19755
19839
|
}, {
|
|
@@ -19844,6 +19928,8 @@ var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./sr
|
|
|
19844
19928
|
|
|
19845
19929
|
var _set = __webpack_require__(/*! ./set */ "./src/hive/stores/set.js");
|
|
19846
19930
|
|
|
19931
|
+
var _utils2 = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19932
|
+
|
|
19847
19933
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
19848
19934
|
|
|
19849
19935
|
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; }
|
|
@@ -19938,8 +20024,8 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19938
20024
|
}, {
|
|
19939
20025
|
key: "incrementScore",
|
|
19940
20026
|
value: function incrementScore(value, scoreValue) {
|
|
19941
|
-
if (!
|
|
19942
|
-
throw new Error('Value must be provided and must be
|
|
20027
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20028
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19943
20029
|
}
|
|
19944
20030
|
|
|
19945
20031
|
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
@@ -19957,8 +20043,8 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19957
20043
|
}, {
|
|
19958
20044
|
key: "decrementScore",
|
|
19959
20045
|
value: function decrementScore(value, scoreValue) {
|
|
19960
|
-
if (!
|
|
19961
|
-
throw new Error('Value must be provided and must be
|
|
20046
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20047
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19962
20048
|
}
|
|
19963
20049
|
|
|
19964
20050
|
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
@@ -20029,8 +20115,8 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
20029
20115
|
}, {
|
|
20030
20116
|
key: "getScore",
|
|
20031
20117
|
value: function getScore(value) {
|
|
20032
|
-
if (!
|
|
20033
|
-
throw new Error('Value must be provided and must be
|
|
20118
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20119
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20034
20120
|
}
|
|
20035
20121
|
|
|
20036
20122
|
return this.app.request.post({
|
|
@@ -20043,8 +20129,8 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
20043
20129
|
}, {
|
|
20044
20130
|
key: "getRank",
|
|
20045
20131
|
value: function getRank(value, reverse) {
|
|
20046
|
-
if (!
|
|
20047
|
-
throw new Error('Value must be provided and must be
|
|
20132
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20133
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20048
20134
|
}
|
|
20049
20135
|
|
|
20050
20136
|
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
@@ -20150,16 +20236,28 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
20150
20236
|
query: _objectSpread({}, options)
|
|
20151
20237
|
});
|
|
20152
20238
|
}
|
|
20239
|
+
}, {
|
|
20240
|
+
key: "deleteValue",
|
|
20241
|
+
value: function deleteValue(value) {
|
|
20242
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20243
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20244
|
+
}
|
|
20245
|
+
|
|
20246
|
+
return this.app.request["delete"]({
|
|
20247
|
+
url: "".concat(this.getBaseURL(), "/values"),
|
|
20248
|
+
data: [value]
|
|
20249
|
+
});
|
|
20250
|
+
}
|
|
20153
20251
|
}, {
|
|
20154
20252
|
key: "deleteValues",
|
|
20155
20253
|
value: function deleteValues(values) {
|
|
20156
|
-
if (!values || !(
|
|
20157
|
-
throw new Error('Value
|
|
20254
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils2.isHiveValueValid)(values)) {
|
|
20255
|
+
throw new Error('Value must be provided and must be a list of JSON items.');
|
|
20158
20256
|
}
|
|
20159
20257
|
|
|
20160
20258
|
return this.app.request["delete"]({
|
|
20161
20259
|
url: "".concat(this.getBaseURL(), "/values"),
|
|
20162
|
-
data:
|
|
20260
|
+
data: values
|
|
20163
20261
|
});
|
|
20164
20262
|
}
|
|
20165
20263
|
}, {
|
|
@@ -20293,6 +20391,36 @@ exports.SortedSetStore = SortedSetStore;
|
|
|
20293
20391
|
|
|
20294
20392
|
/***/ }),
|
|
20295
20393
|
|
|
20394
|
+
/***/ "./src/hive/utils.js":
|
|
20395
|
+
/*!***************************!*\
|
|
20396
|
+
!*** ./src/hive/utils.js ***!
|
|
20397
|
+
\***************************/
|
|
20398
|
+
/*! no static exports found */
|
|
20399
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
20400
|
+
|
|
20401
|
+
"use strict";
|
|
20402
|
+
|
|
20403
|
+
|
|
20404
|
+
Object.defineProperty(exports, "__esModule", {
|
|
20405
|
+
value: true
|
|
20406
|
+
});
|
|
20407
|
+
exports.isHiveValueValid = isHiveValueValid;
|
|
20408
|
+
|
|
20409
|
+
function isHiveValueValid(value) {
|
|
20410
|
+
if (value == null) {
|
|
20411
|
+
return false;
|
|
20412
|
+
}
|
|
20413
|
+
|
|
20414
|
+
try {
|
|
20415
|
+
var json = JSON.stringify(value);
|
|
20416
|
+
return !!json;
|
|
20417
|
+
} catch (_unused) {
|
|
20418
|
+
return false;
|
|
20419
|
+
}
|
|
20420
|
+
}
|
|
20421
|
+
|
|
20422
|
+
/***/ }),
|
|
20423
|
+
|
|
20296
20424
|
/***/ "./src/index.js":
|
|
20297
20425
|
/*!**********************!*\
|
|
20298
20426
|
!*** ./src/index.js ***!
|