backendless 6.5.8 → 6.6.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.
@@ -571,27 +571,41 @@ var Files = /*#__PURE__*/function () {
571
571
  return exists;
572
572
  }()
573
573
  }, {
574
- key: "removeDirectory",
574
+ key: "getFileCount",
575
575
  value: function () {
576
- var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(directoryPath) {
576
+ var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(filesPath, pattern, sub, countDirectories) {
577
577
  return _regenerator["default"].wrap(function _callee11$(_context11) {
578
578
  while (1) {
579
579
  switch (_context11.prev = _context11.next) {
580
580
  case 0:
581
- if (!(!directoryPath || typeof directoryPath !== 'string')) {
581
+ if (!(!filesPath || typeof filesPath !== 'string')) {
582
582
  _context11.next = 2;
583
583
  break;
584
584
  }
585
585
 
586
- throw new Error('Directory "path" must be provided and must be a string.');
586
+ throw new Error('"filesPath" must be provided and must be a string.');
587
587
 
588
588
  case 2:
589
- directoryPath = _utils["default"].trimSlashesInPath(directoryPath);
590
- return _context11.abrupt("return", this.app.request["delete"]({
591
- url: this.app.urls.filePath(directoryPath)
592
- }));
589
+ if (!(pattern && typeof pattern !== 'string')) {
590
+ _context11.next = 4;
591
+ break;
592
+ }
593
+
594
+ throw new Error('Files Pattern must be provided and must be a string.');
593
595
 
594
596
  case 4:
597
+ filesPath = _utils["default"].trimSlashesInPath(filesPath);
598
+ return _context11.abrupt("return", this.app.request.get({
599
+ url: this.app.urls.filePath(filesPath),
600
+ query: {
601
+ action: 'count',
602
+ pattern: pattern || '*',
603
+ sub: !!sub,
604
+ countDirectories: !!countDirectories
605
+ }
606
+ }));
607
+
608
+ case 6:
595
609
  case "end":
596
610
  return _context11.stop();
597
611
  }
@@ -599,60 +613,81 @@ var Files = /*#__PURE__*/function () {
599
613
  }, _callee11, this);
600
614
  }));
601
615
 
602
- function removeDirectory(_x27) {
603
- return _removeDirectory.apply(this, arguments);
616
+ function getFileCount(_x27, _x28, _x29, _x30) {
617
+ return _getFileCount.apply(this, arguments);
604
618
  }
605
619
 
606
- return removeDirectory;
620
+ return getFileCount;
607
621
  }()
608
622
  }, {
609
- key: "getFileCount",
623
+ key: "createDirectory",
610
624
  value: function () {
611
- var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(filesPath, pattern, sub, countDirectories) {
625
+ var _createDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(directoryPath) {
612
626
  return _regenerator["default"].wrap(function _callee12$(_context12) {
613
627
  while (1) {
614
628
  switch (_context12.prev = _context12.next) {
615
629
  case 0:
616
- if (!(!filesPath || typeof filesPath !== 'string')) {
630
+ if (!(!directoryPath || typeof directoryPath !== 'string')) {
617
631
  _context12.next = 2;
618
632
  break;
619
633
  }
620
634
 
621
- throw new Error('"filesPath" must be provided and must be a string.');
635
+ throw new Error('Directory "path" must be provided and must be a string.');
622
636
 
623
637
  case 2:
624
- if (!(pattern && typeof pattern !== 'string')) {
625
- _context12.next = 4;
638
+ directoryPath = _utils["default"].trimSlashesInPath(directoryPath);
639
+ return _context12.abrupt("return", this.app.request.post({
640
+ url: this.app.urls.directoryPath(directoryPath)
641
+ }));
642
+
643
+ case 4:
644
+ case "end":
645
+ return _context12.stop();
646
+ }
647
+ }
648
+ }, _callee12, this);
649
+ }));
650
+
651
+ function createDirectory(_x31) {
652
+ return _createDirectory.apply(this, arguments);
653
+ }
654
+
655
+ return createDirectory;
656
+ }()
657
+ }, {
658
+ key: "removeDirectory",
659
+ value: function () {
660
+ var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(directoryPath) {
661
+ return _regenerator["default"].wrap(function _callee13$(_context13) {
662
+ while (1) {
663
+ switch (_context13.prev = _context13.next) {
664
+ case 0:
665
+ if (!(!directoryPath || typeof directoryPath !== 'string')) {
666
+ _context13.next = 2;
626
667
  break;
627
668
  }
628
669
 
629
- throw new Error('Files Pattern must be provided and must be a string.');
670
+ throw new Error('Directory "path" must be provided and must be a string.');
630
671
 
631
- case 4:
632
- filesPath = _utils["default"].trimSlashesInPath(filesPath);
633
- return _context12.abrupt("return", this.app.request.get({
634
- url: this.app.urls.filePath(filesPath),
635
- query: {
636
- action: 'count',
637
- pattern: pattern || '*',
638
- sub: !!sub,
639
- countDirectories: !!countDirectories
640
- }
672
+ case 2:
673
+ directoryPath = _utils["default"].trimSlashesInPath(directoryPath);
674
+ return _context13.abrupt("return", this.app.request["delete"]({
675
+ url: this.app.urls.filePath(directoryPath)
641
676
  }));
642
677
 
643
- case 6:
678
+ case 4:
644
679
  case "end":
645
- return _context12.stop();
680
+ return _context13.stop();
646
681
  }
647
682
  }
648
- }, _callee12, this);
683
+ }, _callee13, this);
649
684
  }));
650
685
 
651
- function getFileCount(_x28, _x29, _x30, _x31) {
652
- return _getFileCount.apply(this, arguments);
686
+ function removeDirectory(_x32) {
687
+ return _removeDirectory.apply(this, arguments);
653
688
  }
654
689
 
655
- return getFileCount;
690
+ return removeDirectory;
656
691
  }()
657
692
  }]);
658
693
  return Files;
@@ -258,7 +258,7 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
258
258
  minBound = options.minBound,
259
259
  maxBound = options.maxBound,
260
260
  offset = options.offset,
261
- count = options.count,
261
+ pageSize = options.pageSize,
262
262
  withScores = options.withScores,
263
263
  reverse = options.reverse;
264
264
 
@@ -282,8 +282,8 @@ var SortedSetStore = /*#__PURE__*/function (_HiveStore) {
282
282
  throw new Error('Offset must be a number.');
283
283
  }
284
284
 
285
- if (count !== undefined && (typeof count !== 'number' || isNaN(count))) {
286
- throw new Error('Count must be a number.');
285
+ if (pageSize !== undefined && (typeof pageSize !== 'number' || isNaN(pageSize))) {
286
+ throw new Error('Page Size must be a number.');
287
287
  }
288
288
 
289
289
  if (withScores !== undefined && typeof withScores !== 'boolean') {
package/lib/urls.js CHANGED
@@ -314,6 +314,11 @@ var Urls = /*#__PURE__*/function () {
314
314
  value: function filePath(path) {
315
315
  return "".concat(this.files(), "/").concat(path);
316
316
  }
317
+ }, {
318
+ key: "directoryPath",
319
+ value: function directoryPath(path) {
320
+ return "".concat(this.files(), "/").concat(path, "/");
321
+ }
317
322
  }, {
318
323
  key: "fileCopy",
319
324
  value: function fileCopy() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "backendless",
3
- "version": "6.5.8",
3
+ "version": "6.6.0",
4
4
  "description": "Backendless JavaScript SDK for Node.js and the browser",
5
5
  "browser": "dist/backendless.js",
6
6
  "main": "lib/index.js",
@@ -279,18 +279,6 @@ export default class Files {
279
279
  })
280
280
  }
281
281
 
282
- async removeDirectory(directoryPath) {
283
- if (!directoryPath || typeof directoryPath !== 'string') {
284
- throw new Error('Directory "path" must be provided and must be a string.')
285
- }
286
-
287
- directoryPath = FilesUtils.trimSlashesInPath(directoryPath)
288
-
289
- return this.app.request.delete({
290
- url: this.app.urls.filePath(directoryPath),
291
- })
292
- }
293
-
294
282
  async getFileCount(filesPath, pattern, sub, countDirectories) {
295
283
  if (!filesPath || typeof filesPath !== 'string') {
296
284
  throw new Error('"filesPath" must be provided and must be a string.')
@@ -313,5 +301,28 @@ export default class Files {
313
301
  })
314
302
  }
315
303
 
304
+ async createDirectory(directoryPath) {
305
+ if (!directoryPath || typeof directoryPath !== 'string') {
306
+ throw new Error('Directory "path" must be provided and must be a string.')
307
+ }
308
+
309
+ directoryPath = FilesUtils.trimSlashesInPath(directoryPath)
310
+
311
+ return this.app.request.post({
312
+ url: this.app.urls.directoryPath(directoryPath)
313
+ })
314
+ }
315
+
316
+ async removeDirectory(directoryPath) {
317
+ if (!directoryPath || typeof directoryPath !== 'string') {
318
+ throw new Error('Directory "path" must be provided and must be a string.')
319
+ }
320
+
321
+ directoryPath = FilesUtils.trimSlashesInPath(directoryPath)
322
+
323
+ return this.app.request.delete({
324
+ url: this.app.urls.filePath(directoryPath),
325
+ })
326
+ }
316
327
  }
317
328
 
@@ -228,7 +228,7 @@ export class SortedSetStore extends HiveStore {
228
228
  throw new Error('Options must be an object.')
229
229
  }
230
230
 
231
- const { minScore, maxScore, minBound, maxBound, offset, count, withScores, reverse } = options
231
+ const { minScore, maxScore, minBound, maxBound, offset, pageSize, withScores, reverse } = options
232
232
 
233
233
  if (minScore !== undefined && (isNaN(minScore) || typeof minScore !== 'number')) {
234
234
  throw new Error('Minimal Score must be a number.')
@@ -250,8 +250,8 @@ export class SortedSetStore extends HiveStore {
250
250
  throw new Error('Offset must be a number.')
251
251
  }
252
252
 
253
- if (count !== undefined && (typeof count !== 'number' || isNaN(count))) {
254
- throw new Error('Count must be a number.')
253
+ if (pageSize !== undefined && (typeof pageSize !== 'number' || isNaN(pageSize))) {
254
+ throw new Error('Page Size must be a number.')
255
255
  }
256
256
 
257
257
  if (withScores !== undefined && typeof withScores !== 'boolean') {
package/src/urls.js CHANGED
@@ -247,6 +247,10 @@ export default class Urls {
247
247
  return `${this.files()}/${path}`
248
248
  }
249
249
 
250
+ directoryPath(path) {
251
+ return `${this.files()}/${path}/`
252
+ }
253
+
250
254
  fileCopy() {
251
255
  return `${this.files()}/copy`
252
256
  }