backendless 6.5.0 → 6.5.1
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 +51 -47
- package/dist/backendless.js +174 -54
- 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 +41 -17
- 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 +41 -17
- 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 +39 -15
- 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
417
|
set(values: Array<string>): Promise<number>;
|
|
416
418
|
|
|
417
419
|
set(value: string, 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>>;
|
|
508
510
|
|
|
509
|
-
getRandom(count?: number): Promise<Array<
|
|
511
|
+
getRandom(count?: number): Promise<Array<JSONValue>>;
|
|
510
512
|
|
|
511
|
-
getRandomAndDelete(count?: number): Promise<Array<
|
|
513
|
+
getRandomAndDelete(count?: number): Promise<Array<JSONValue>>;
|
|
512
514
|
|
|
513
|
-
|
|
515
|
+
setValue(value: JSONValue): Promise<number>;
|
|
514
516
|
|
|
515
|
-
|
|
517
|
+
setValues(values: Array<JSONValue>): Promise<number>;
|
|
518
|
+
|
|
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.1
|
|
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
|
|
|
@@ -19285,12 +19291,12 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19285
19291
|
}, {
|
|
19286
19292
|
key: "insert",
|
|
19287
19293
|
value: function insert(valueToInsert, anchorValue, before) {
|
|
19288
|
-
if (!
|
|
19289
|
-
throw new Error('ValueToInsert must be provided and must be
|
|
19294
|
+
if (!(0, _utils.isHiveValueValid)(valueToInsert)) {
|
|
19295
|
+
throw new Error('ValueToInsert must be provided and must be on of types: string, number, boolean, object, array.');
|
|
19290
19296
|
}
|
|
19291
19297
|
|
|
19292
|
-
if (!
|
|
19293
|
-
throw new Error('AnchorValue must be provided and must be
|
|
19298
|
+
if (!(0, _utils.isHiveValueValid)(anchorValue)) {
|
|
19299
|
+
throw new Error('AnchorValue must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19294
19300
|
}
|
|
19295
19301
|
|
|
19296
19302
|
return this.app.request.put({
|
|
@@ -19304,8 +19310,8 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19304
19310
|
}, {
|
|
19305
19311
|
key: "deleteValue",
|
|
19306
19312
|
value: function deleteValue(value, count) {
|
|
19307
|
-
if (!
|
|
19308
|
-
throw new Error('Value must be provided and must be
|
|
19313
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19314
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19309
19315
|
}
|
|
19310
19316
|
|
|
19311
19317
|
if (count !== undefined && (isNaN(count) || typeof count !== 'number')) {
|
|
@@ -19321,27 +19327,51 @@ var ListStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19321
19327
|
});
|
|
19322
19328
|
}
|
|
19323
19329
|
}, {
|
|
19324
|
-
key: "
|
|
19325
|
-
value: function
|
|
19326
|
-
if (!
|
|
19327
|
-
throw new Error('Value
|
|
19330
|
+
key: "addFirstValue",
|
|
19331
|
+
value: function addFirstValue(value) {
|
|
19332
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19333
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19334
|
+
}
|
|
19335
|
+
|
|
19336
|
+
return this.app.request.put({
|
|
19337
|
+
url: "".concat(this.getBaseURL(), "/add-first"),
|
|
19338
|
+
data: [value]
|
|
19339
|
+
});
|
|
19340
|
+
}
|
|
19341
|
+
}, {
|
|
19342
|
+
key: "addFirstValues",
|
|
19343
|
+
value: function addFirstValues(values) {
|
|
19344
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19345
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19328
19346
|
}
|
|
19329
19347
|
|
|
19330
19348
|
return this.app.request.put({
|
|
19331
19349
|
url: "".concat(this.getBaseURL(), "/add-first"),
|
|
19332
|
-
data:
|
|
19350
|
+
data: values
|
|
19351
|
+
});
|
|
19352
|
+
}
|
|
19353
|
+
}, {
|
|
19354
|
+
key: "addLastValue",
|
|
19355
|
+
value: function addLastValue(value) {
|
|
19356
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19357
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19358
|
+
}
|
|
19359
|
+
|
|
19360
|
+
return this.app.request.put({
|
|
19361
|
+
url: "".concat(this.getBaseURL(), "/add-last"),
|
|
19362
|
+
data: [value]
|
|
19333
19363
|
});
|
|
19334
19364
|
}
|
|
19335
19365
|
}, {
|
|
19336
|
-
key: "
|
|
19337
|
-
value: function
|
|
19338
|
-
if (!
|
|
19339
|
-
throw new Error('Value
|
|
19366
|
+
key: "addLastValues",
|
|
19367
|
+
value: function addLastValues(values) {
|
|
19368
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19369
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19340
19370
|
}
|
|
19341
19371
|
|
|
19342
19372
|
return this.app.request.put({
|
|
19343
19373
|
url: "".concat(this.getBaseURL(), "/add-last"),
|
|
19344
|
-
data:
|
|
19374
|
+
data: values
|
|
19345
19375
|
});
|
|
19346
19376
|
}
|
|
19347
19377
|
}, {
|
|
@@ -19416,6 +19446,8 @@ var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base
|
|
|
19416
19446
|
|
|
19417
19447
|
var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./src/utils.js"));
|
|
19418
19448
|
|
|
19449
|
+
var _utils2 = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19450
|
+
|
|
19419
19451
|
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
19452
|
|
|
19421
19453
|
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 +19539,8 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19507
19539
|
throw new Error('Key must be a string.');
|
|
19508
19540
|
}
|
|
19509
19541
|
|
|
19510
|
-
if (!
|
|
19511
|
-
throw new Error('Value must be provided and must be
|
|
19542
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
19543
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19512
19544
|
}
|
|
19513
19545
|
|
|
19514
19546
|
return this.app.request.put({
|
|
@@ -19525,8 +19557,8 @@ var MapStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19525
19557
|
throw new Error('Key must be provided and must be a string.');
|
|
19526
19558
|
}
|
|
19527
19559
|
|
|
19528
|
-
if (!
|
|
19529
|
-
throw new Error('Value must be provided and must be
|
|
19560
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
19561
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19530
19562
|
}
|
|
19531
19563
|
|
|
19532
19564
|
if (overwrite !== undefined && typeof overwrite !== 'boolean') {
|
|
@@ -19649,7 +19681,7 @@ var _baseStore = __webpack_require__(/*! ./base-store */ "./src/hive/stores/base
|
|
|
19649
19681
|
|
|
19650
19682
|
var _constants = __webpack_require__(/*! ../constants */ "./src/hive/constants.js");
|
|
19651
19683
|
|
|
19652
|
-
var _utils =
|
|
19684
|
+
var _utils = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19653
19685
|
|
|
19654
19686
|
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
19687
|
|
|
@@ -19701,55 +19733,99 @@ var SetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19701
19733
|
});
|
|
19702
19734
|
}
|
|
19703
19735
|
}, {
|
|
19704
|
-
key: "
|
|
19705
|
-
value: function
|
|
19706
|
-
if (!
|
|
19707
|
-
throw new Error('Value
|
|
19736
|
+
key: "setValue",
|
|
19737
|
+
value: function setValue(value) {
|
|
19738
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19739
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19708
19740
|
}
|
|
19709
19741
|
|
|
19710
19742
|
return this.app.request.put({
|
|
19711
19743
|
url: this.getBaseURL(),
|
|
19712
|
-
data:
|
|
19744
|
+
data: [value]
|
|
19713
19745
|
});
|
|
19714
19746
|
}
|
|
19715
19747
|
}, {
|
|
19716
|
-
key: "
|
|
19717
|
-
value: function
|
|
19718
|
-
if (!values || !(
|
|
19719
|
-
throw new Error('Value
|
|
19748
|
+
key: "setValues",
|
|
19749
|
+
value: function setValues(values) {
|
|
19750
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19751
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19752
|
+
}
|
|
19753
|
+
|
|
19754
|
+
return this.app.request.put({
|
|
19755
|
+
url: this.getBaseURL(),
|
|
19756
|
+
data: values
|
|
19757
|
+
});
|
|
19758
|
+
}
|
|
19759
|
+
}, {
|
|
19760
|
+
key: "addValue",
|
|
19761
|
+
value: function addValue(value) {
|
|
19762
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19763
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19764
|
+
}
|
|
19765
|
+
|
|
19766
|
+
return this.app.request.put({
|
|
19767
|
+
url: "".concat(this.getBaseURL(), "/add"),
|
|
19768
|
+
data: [value]
|
|
19769
|
+
});
|
|
19770
|
+
}
|
|
19771
|
+
}, {
|
|
19772
|
+
key: "addValues",
|
|
19773
|
+
value: function addValues(values) {
|
|
19774
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19775
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19720
19776
|
}
|
|
19721
19777
|
|
|
19722
19778
|
return this.app.request.put({
|
|
19723
19779
|
url: "".concat(this.getBaseURL(), "/add"),
|
|
19724
|
-
data:
|
|
19780
|
+
data: values
|
|
19781
|
+
});
|
|
19782
|
+
}
|
|
19783
|
+
}, {
|
|
19784
|
+
key: "deleteValue",
|
|
19785
|
+
value: function deleteValue(value) {
|
|
19786
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19787
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19788
|
+
}
|
|
19789
|
+
|
|
19790
|
+
return this.app.request["delete"]({
|
|
19791
|
+
url: "".concat(this.getBaseURL(), "/values"),
|
|
19792
|
+
data: [value]
|
|
19725
19793
|
});
|
|
19726
19794
|
}
|
|
19727
19795
|
}, {
|
|
19728
19796
|
key: "deleteValues",
|
|
19729
19797
|
value: function deleteValues(values) {
|
|
19730
|
-
if (!values || !(
|
|
19731
|
-
throw new Error('Value
|
|
19798
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19799
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19732
19800
|
}
|
|
19733
19801
|
|
|
19734
19802
|
return this.app.request["delete"]({
|
|
19735
19803
|
url: "".concat(this.getBaseURL(), "/values"),
|
|
19736
|
-
data:
|
|
19804
|
+
data: values
|
|
19737
19805
|
});
|
|
19738
19806
|
}
|
|
19739
19807
|
}, {
|
|
19740
|
-
key: "
|
|
19741
|
-
value: function
|
|
19742
|
-
if (
|
|
19743
|
-
|
|
19808
|
+
key: "isValueMember",
|
|
19809
|
+
value: function isValueMember(value) {
|
|
19810
|
+
if (!(0, _utils.isHiveValueValid)(value)) {
|
|
19811
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19744
19812
|
}
|
|
19745
19813
|
|
|
19746
|
-
|
|
19747
|
-
|
|
19814
|
+
return this.app.request.post({
|
|
19815
|
+
url: "".concat(this.getBaseURL(), "/contains"),
|
|
19816
|
+
data: [value]
|
|
19817
|
+
});
|
|
19818
|
+
}
|
|
19819
|
+
}, {
|
|
19820
|
+
key: "isValuesMembers",
|
|
19821
|
+
value: function isValuesMembers(values) {
|
|
19822
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils.isHiveValueValid)(values)) {
|
|
19823
|
+
throw new Error('Value must be provided and must be a list of valid JSON items.');
|
|
19748
19824
|
}
|
|
19749
19825
|
|
|
19750
19826
|
return this.app.request.post({
|
|
19751
19827
|
url: "".concat(this.getBaseURL(), "/contains"),
|
|
19752
|
-
data:
|
|
19828
|
+
data: values
|
|
19753
19829
|
});
|
|
19754
19830
|
}
|
|
19755
19831
|
}, {
|
|
@@ -19844,6 +19920,8 @@ var _utils = _interopRequireDefault(__webpack_require__(/*! ../../utils */ "./sr
|
|
|
19844
19920
|
|
|
19845
19921
|
var _set = __webpack_require__(/*! ./set */ "./src/hive/stores/set.js");
|
|
19846
19922
|
|
|
19923
|
+
var _utils2 = __webpack_require__(/*! ../utils */ "./src/hive/utils.js");
|
|
19924
|
+
|
|
19847
19925
|
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
19926
|
|
|
19849
19927
|
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 +20016,8 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19938
20016
|
}, {
|
|
19939
20017
|
key: "incrementScore",
|
|
19940
20018
|
value: function incrementScore(value, scoreValue) {
|
|
19941
|
-
if (!
|
|
19942
|
-
throw new Error('Value must be provided and must be
|
|
20019
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20020
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19943
20021
|
}
|
|
19944
20022
|
|
|
19945
20023
|
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
@@ -19957,8 +20035,8 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
19957
20035
|
}, {
|
|
19958
20036
|
key: "decrementScore",
|
|
19959
20037
|
value: function decrementScore(value, scoreValue) {
|
|
19960
|
-
if (!
|
|
19961
|
-
throw new Error('Value must be provided and must be
|
|
20038
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20039
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
19962
20040
|
}
|
|
19963
20041
|
|
|
19964
20042
|
if (isNaN(scoreValue) || typeof scoreValue !== 'number') {
|
|
@@ -20029,8 +20107,8 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
20029
20107
|
}, {
|
|
20030
20108
|
key: "getScore",
|
|
20031
20109
|
value: function getScore(value) {
|
|
20032
|
-
if (!
|
|
20033
|
-
throw new Error('Value must be provided and must be
|
|
20110
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20111
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20034
20112
|
}
|
|
20035
20113
|
|
|
20036
20114
|
return this.app.request.post({
|
|
@@ -20043,8 +20121,8 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
20043
20121
|
}, {
|
|
20044
20122
|
key: "getRank",
|
|
20045
20123
|
value: function getRank(value, reverse) {
|
|
20046
|
-
if (!
|
|
20047
|
-
throw new Error('Value must be provided and must be
|
|
20124
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20125
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20048
20126
|
}
|
|
20049
20127
|
|
|
20050
20128
|
if (reverse !== undefined && typeof reverse !== 'boolean') {
|
|
@@ -20150,16 +20228,28 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
|
|
|
20150
20228
|
query: _objectSpread({}, options)
|
|
20151
20229
|
});
|
|
20152
20230
|
}
|
|
20231
|
+
}, {
|
|
20232
|
+
key: "deleteValue",
|
|
20233
|
+
value: function deleteValue(value) {
|
|
20234
|
+
if (!(0, _utils2.isHiveValueValid)(value)) {
|
|
20235
|
+
throw new Error('Value must be provided and must be one of types: string, number, boolean, object, array.');
|
|
20236
|
+
}
|
|
20237
|
+
|
|
20238
|
+
return this.app.request["delete"]({
|
|
20239
|
+
url: "".concat(this.getBaseURL(), "/values"),
|
|
20240
|
+
data: [value]
|
|
20241
|
+
});
|
|
20242
|
+
}
|
|
20153
20243
|
}, {
|
|
20154
20244
|
key: "deleteValues",
|
|
20155
20245
|
value: function deleteValues(values) {
|
|
20156
|
-
if (!values || !(
|
|
20157
|
-
throw new Error('Value
|
|
20246
|
+
if (!values || !Array.isArray(values) || !values.length || !(0, _utils2.isHiveValueValid)(values)) {
|
|
20247
|
+
throw new Error('Value must be provided and must be a list of JSON items.');
|
|
20158
20248
|
}
|
|
20159
20249
|
|
|
20160
20250
|
return this.app.request["delete"]({
|
|
20161
20251
|
url: "".concat(this.getBaseURL(), "/values"),
|
|
20162
|
-
data:
|
|
20252
|
+
data: values
|
|
20163
20253
|
});
|
|
20164
20254
|
}
|
|
20165
20255
|
}, {
|
|
@@ -20293,6 +20383,36 @@ exports.SortedSetStore = SortedSetStore;
|
|
|
20293
20383
|
|
|
20294
20384
|
/***/ }),
|
|
20295
20385
|
|
|
20386
|
+
/***/ "./src/hive/utils.js":
|
|
20387
|
+
/*!***************************!*\
|
|
20388
|
+
!*** ./src/hive/utils.js ***!
|
|
20389
|
+
\***************************/
|
|
20390
|
+
/*! no static exports found */
|
|
20391
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
20392
|
+
|
|
20393
|
+
"use strict";
|
|
20394
|
+
|
|
20395
|
+
|
|
20396
|
+
Object.defineProperty(exports, "__esModule", {
|
|
20397
|
+
value: true
|
|
20398
|
+
});
|
|
20399
|
+
exports.isHiveValueValid = isHiveValueValid;
|
|
20400
|
+
|
|
20401
|
+
function isHiveValueValid(value) {
|
|
20402
|
+
if (value == null) {
|
|
20403
|
+
return false;
|
|
20404
|
+
}
|
|
20405
|
+
|
|
20406
|
+
try {
|
|
20407
|
+
var json = JSON.stringify(value);
|
|
20408
|
+
return !!json;
|
|
20409
|
+
} catch (_unused) {
|
|
20410
|
+
return false;
|
|
20411
|
+
}
|
|
20412
|
+
}
|
|
20413
|
+
|
|
20414
|
+
/***/ }),
|
|
20415
|
+
|
|
20296
20416
|
/***/ "./src/index.js":
|
|
20297
20417
|
/*!**********************!*\
|
|
20298
20418
|
!*** ./src/index.js ***!
|