backendless 6.7.0 → 6.7.1-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/backendless.d.ts +5 -0
  2. package/dist/backendless.js +20966 -23929
  3. package/dist/backendless.js.map +1 -1
  4. package/dist/backendless.min.js +2 -2
  5. package/es/bl/constants.js +0 -2
  6. package/es/bl/custom-services.js +40 -65
  7. package/es/bl/events.js +30 -52
  8. package/es/bl/index.js +3 -9
  9. package/es/cache/index.js +125 -189
  10. package/es/commerce/index.js +78 -119
  11. package/es/counters/counter.js +0 -8
  12. package/es/counters/index.js +171 -258
  13. package/es/data/data-query-builder.js +2 -39
  14. package/es/data/geo/geo-constructor.js +5 -26
  15. package/es/data/geo/geo-json-parser.js +0 -7
  16. package/es/data/geo/geometry.js +4 -13
  17. package/es/data/geo/linestring.js +4 -21
  18. package/es/data/geo/point.js +4 -22
  19. package/es/data/geo/polygon.js +4 -30
  20. package/es/data/geo/spatial-reference-system.js +1 -7
  21. package/es/data/geo/wkt-parser.js +0 -10
  22. package/es/data/geo/wkt-to-geojson.js +4 -44
  23. package/es/data/group-query-builder.js +0 -23
  24. package/es/data/index.js +17 -54
  25. package/es/data/json-update-builder.js +0 -18
  26. package/es/data/load-relations-query-builder.js +0 -16
  27. package/es/data/persmission.js +0 -16
  28. package/es/data/rt-handlers.js +1 -46
  29. package/es/data/store.js +316 -518
  30. package/es/decorators/deprecated.js +2 -5
  31. package/es/decorators/index.js +0 -2
  32. package/es/device/index.js +3 -8
  33. package/es/expression.js +29 -0
  34. package/es/files/index.js +354 -493
  35. package/es/files/persmission.js +0 -15
  36. package/es/files/utils.js +32 -55
  37. package/es/hive/index.js +1 -13
  38. package/es/hive/stores/base-store.js +14 -50
  39. package/es/hive/stores/index.js +0 -10
  40. package/es/hive/stores/key-value.js +4 -37
  41. package/es/hive/stores/list.js +0 -32
  42. package/es/hive/stores/map.js +0 -34
  43. package/es/hive/stores/set.js +0 -29
  44. package/es/hive/stores/sorted-set.js +19 -94
  45. package/es/hive/utils.js +0 -2
  46. package/es/index.js +51 -71
  47. package/es/local-cache/index.js +0 -10
  48. package/es/local-cache/local-storage.js +1 -9
  49. package/es/local-cache/virtual-storage.js +0 -6
  50. package/es/logging/index.js +21 -46
  51. package/es/logging/logger.js +0 -6
  52. package/es/management/data.js +0 -8
  53. package/es/management/index.js +3 -7
  54. package/es/messaging/channel/index.js +0 -27
  55. package/es/messaging/helpers/body-parts.js +3 -6
  56. package/es/messaging/helpers/delivery-options.js +3 -6
  57. package/es/messaging/helpers/email-envelope.js +13 -25
  58. package/es/messaging/helpers/index.js +10 -16
  59. package/es/messaging/helpers/publish-options.js +3 -6
  60. package/es/messaging/index.js +213 -317
  61. package/es/persmission.js +7 -16
  62. package/es/request/index.js +2 -16
  63. package/es/rso/connection.js +3 -34
  64. package/es/rso/index.js +0 -7
  65. package/es/rt.js +21 -52
  66. package/es/unit-of-work/constants.js +1 -1
  67. package/es/unit-of-work/index.js +27 -145
  68. package/es/unit-of-work/json-adapter.js +14 -35
  69. package/es/unit-of-work/op-result-value-reference.js +1 -11
  70. package/es/unit-of-work/op-result.js +2 -13
  71. package/es/urls.js +18 -15
  72. package/es/user-agent.js +0 -7
  73. package/es/users/index.js +345 -552
  74. package/es/users/roles.js +79 -128
  75. package/es/users/social/container.js +0 -16
  76. package/es/users/social/index.js +166 -250
  77. package/es/users/user.js +2 -9
  78. package/es/users/utils.js +0 -3
  79. package/es/utils.js +0 -17
  80. package/lib/bl/constants.js +0 -2
  81. package/lib/bl/custom-services.js +40 -65
  82. package/lib/bl/events.js +30 -52
  83. package/lib/bl/index.js +3 -9
  84. package/lib/cache/index.js +125 -189
  85. package/lib/commerce/index.js +78 -119
  86. package/lib/counters/counter.js +0 -8
  87. package/lib/counters/index.js +171 -258
  88. package/lib/data/data-query-builder.js +2 -39
  89. package/lib/data/geo/geo-constructor.js +5 -26
  90. package/lib/data/geo/geo-json-parser.js +0 -7
  91. package/lib/data/geo/geometry.js +4 -13
  92. package/lib/data/geo/linestring.js +4 -21
  93. package/lib/data/geo/point.js +4 -22
  94. package/lib/data/geo/polygon.js +4 -30
  95. package/lib/data/geo/spatial-reference-system.js +1 -7
  96. package/lib/data/geo/wkt-parser.js +0 -10
  97. package/lib/data/geo/wkt-to-geojson.js +4 -44
  98. package/lib/data/group-query-builder.js +0 -23
  99. package/lib/data/index.js +17 -54
  100. package/lib/data/json-update-builder.js +0 -18
  101. package/lib/data/load-relations-query-builder.js +0 -16
  102. package/lib/data/persmission.js +0 -16
  103. package/lib/data/rt-handlers.js +1 -46
  104. package/lib/data/store.js +316 -518
  105. package/lib/decorators/deprecated.js +2 -5
  106. package/lib/decorators/index.js +0 -2
  107. package/lib/device/index.js +3 -8
  108. package/lib/expression.js +29 -0
  109. package/lib/files/index.js +354 -493
  110. package/lib/files/persmission.js +0 -15
  111. package/lib/files/utils.js +32 -55
  112. package/lib/hive/index.js +1 -13
  113. package/lib/hive/stores/base-store.js +14 -50
  114. package/lib/hive/stores/index.js +0 -10
  115. package/lib/hive/stores/key-value.js +4 -37
  116. package/lib/hive/stores/list.js +0 -32
  117. package/lib/hive/stores/map.js +0 -34
  118. package/lib/hive/stores/set.js +0 -29
  119. package/lib/hive/stores/sorted-set.js +19 -94
  120. package/lib/hive/utils.js +0 -2
  121. package/lib/index.js +51 -71
  122. package/lib/local-cache/index.js +0 -10
  123. package/lib/local-cache/local-storage.js +1 -9
  124. package/lib/local-cache/virtual-storage.js +0 -6
  125. package/lib/logging/index.js +21 -46
  126. package/lib/logging/logger.js +0 -6
  127. package/lib/management/data.js +0 -8
  128. package/lib/management/index.js +3 -7
  129. package/lib/messaging/channel/index.js +0 -27
  130. package/lib/messaging/helpers/body-parts.js +3 -6
  131. package/lib/messaging/helpers/delivery-options.js +3 -6
  132. package/lib/messaging/helpers/email-envelope.js +13 -25
  133. package/lib/messaging/helpers/index.js +10 -16
  134. package/lib/messaging/helpers/publish-options.js +3 -6
  135. package/lib/messaging/index.js +213 -317
  136. package/lib/persmission.js +7 -16
  137. package/lib/request/index.js +2 -16
  138. package/lib/rso/connection.js +3 -34
  139. package/lib/rso/index.js +0 -7
  140. package/lib/rt.js +21 -52
  141. package/lib/unit-of-work/constants.js +1 -1
  142. package/lib/unit-of-work/index.js +27 -145
  143. package/lib/unit-of-work/json-adapter.js +14 -35
  144. package/lib/unit-of-work/op-result-value-reference.js +1 -11
  145. package/lib/unit-of-work/op-result.js +2 -13
  146. package/lib/urls.js +18 -15
  147. package/lib/user-agent.js +0 -7
  148. package/lib/users/index.js +345 -552
  149. package/lib/users/roles.js +79 -128
  150. package/lib/users/social/container.js +0 -16
  151. package/lib/users/social/index.js +166 -250
  152. package/lib/users/user.js +2 -9
  153. package/lib/users/utils.js +0 -3
  154. package/lib/utils.js +0 -17
  155. package/package.json +16 -16
  156. package/src/data/store.js +3 -1
  157. package/src/expression.js +16 -0
  158. package/src/files/utils.js +1 -1
  159. package/src/index.js +5 -0
package/es/files/index.js CHANGED
@@ -1,24 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports["default"] = void 0;
9
-
10
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
10
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
11
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
12
  var _utils = _interopRequireDefault(require("./utils"));
19
-
20
13
  var _persmission = _interopRequireDefault(require("./persmission"));
21
-
22
14
  var Files = /*#__PURE__*/function () {
23
15
  function Files(app) {
24
16
  (0, _classCallCheck2["default"])(this, Files);
@@ -29,66 +21,53 @@ var Files = /*#__PURE__*/function () {
29
21
  WRITE: new _persmission["default"]('WRITE', app)
30
22
  };
31
23
  }
32
-
33
24
  (0, _createClass2["default"])(Files, [{
34
25
  key: "saveFile",
35
26
  value: function () {
36
27
  var _saveFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(filePath, fileName, fileContent, overwrite) {
37
28
  var query;
38
29
  return _regenerator["default"].wrap(function _callee$(_context) {
39
- while (1) {
40
- switch (_context.prev = _context.next) {
41
- case 0:
42
- if (!(!filePath || typeof filePath !== 'string')) {
43
- _context.next = 2;
44
- break;
45
- }
46
-
47
- throw new Error('"filePath" must be provided and must be a string.');
48
-
49
- case 2:
50
- if (!(!fileName || typeof fileName !== 'string')) {
51
- _context.next = 4;
52
- break;
53
- }
54
-
55
- throw new Error('File Name must be provided and must be a string.');
56
-
57
- case 4:
58
- _context.next = 6;
59
- return _utils["default"].toBase64(fileContent);
60
-
61
- case 6:
62
- fileContent = _context.sent;
63
- query = {};
64
-
65
- if (typeof overwrite === 'boolean') {
66
- query.overwrite = overwrite;
67
- }
68
-
69
- filePath = _utils["default"].trimSlashesInPath(filePath);
70
- fileName = _utils["default"].sanitizeFileName(fileName);
71
- return _context.abrupt("return", this.app.request.put({
72
- url: "".concat(this.app.urls.fileBinaryPath(filePath), "/").concat(fileName),
73
- headers: {
74
- 'Content-Type': 'text/plain'
75
- },
76
- query: query,
77
- data: fileContent
78
- }));
79
-
80
- case 12:
81
- case "end":
82
- return _context.stop();
83
- }
30
+ while (1) switch (_context.prev = _context.next) {
31
+ case 0:
32
+ if (!(!filePath || typeof filePath !== 'string')) {
33
+ _context.next = 2;
34
+ break;
35
+ }
36
+ throw new Error('"filePath" must be provided and must be a string.');
37
+ case 2:
38
+ if (!(!fileName || typeof fileName !== 'string')) {
39
+ _context.next = 4;
40
+ break;
41
+ }
42
+ throw new Error('File Name must be provided and must be a string.');
43
+ case 4:
44
+ _context.next = 6;
45
+ return _utils["default"].toBase64(fileContent);
46
+ case 6:
47
+ fileContent = _context.sent;
48
+ query = {};
49
+ if (typeof overwrite === 'boolean') {
50
+ query.overwrite = overwrite;
51
+ }
52
+ filePath = _utils["default"].trimSlashesInPath(filePath);
53
+ fileName = _utils["default"].sanitizeFileName(fileName);
54
+ return _context.abrupt("return", this.app.request.put({
55
+ url: "".concat(this.app.urls.fileBinaryPath(filePath), "/").concat(fileName),
56
+ headers: {
57
+ 'Content-Type': 'text/plain'
58
+ },
59
+ query: query,
60
+ data: fileContent
61
+ }));
62
+ case 12:
63
+ case "end":
64
+ return _context.stop();
84
65
  }
85
66
  }, _callee, this);
86
67
  }));
87
-
88
68
  function saveFile(_x, _x2, _x3, _x4) {
89
69
  return _saveFile.apply(this, arguments);
90
70
  }
91
-
92
71
  return saveFile;
93
72
  }()
94
73
  }, {
@@ -97,75 +76,60 @@ var Files = /*#__PURE__*/function () {
97
76
  var _upload = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(file, filePath, overwrite) {
98
77
  var query, pathTokens, fileName, sourcePathTokens;
99
78
  return _regenerator["default"].wrap(function _callee2$(_context2) {
100
- while (1) {
101
- switch (_context2.prev = _context2.next) {
102
- case 0:
103
- query = {};
104
-
105
- if (typeof overwrite === 'boolean') {
106
- query.overwrite = overwrite;
107
- }
108
-
109
- filePath = _utils["default"].trimSlashesInPath(filePath);
110
- pathTokens = _utils["default"].parseFilePath(filePath);
111
-
112
- if (pathTokens.fileName) {
113
- filePath = pathTokens.filePath;
114
- fileName = pathTokens.fileName;
115
- }
116
-
117
- if (!(typeof file === 'string')) {
118
- _context2.next = 8;
119
- break;
120
- }
121
-
122
- if (!fileName) {
123
- sourcePathTokens = _utils["default"].parseFilePath(file);
124
- fileName = sourcePathTokens.fileName;
125
- }
126
-
127
- return _context2.abrupt("return", this.app.request.post({
128
- url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName),
129
- query: query,
130
- data: {
131
- url: file
132
- }
133
- }));
134
-
135
- case 8:
136
- if (!fileName) {
137
- fileName = _utils["default"].getFileName(file);
138
- }
139
-
140
- if (fileName) {
141
- _context2.next = 11;
142
- break;
143
- }
144
-
145
- throw new Error('Wrong type of the file source object. Can not get file name');
146
-
147
- case 11:
148
- fileName = _utils["default"].sanitizeFileName(fileName);
149
- return _context2.abrupt("return", this.app.request.post({
150
- url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName),
151
- query: query,
152
- form: {
153
- file: file
154
- }
155
- }));
156
-
157
- case 13:
158
- case "end":
159
- return _context2.stop();
160
- }
79
+ while (1) switch (_context2.prev = _context2.next) {
80
+ case 0:
81
+ query = {};
82
+ if (typeof overwrite === 'boolean') {
83
+ query.overwrite = overwrite;
84
+ }
85
+ filePath = _utils["default"].trimSlashesInPath(filePath);
86
+ pathTokens = _utils["default"].parseFilePath(filePath);
87
+ if (pathTokens.fileName) {
88
+ filePath = pathTokens.filePath;
89
+ fileName = pathTokens.fileName;
90
+ }
91
+ if (!(typeof file === 'string')) {
92
+ _context2.next = 8;
93
+ break;
94
+ }
95
+ if (!fileName) {
96
+ sourcePathTokens = _utils["default"].parseFilePath(file);
97
+ fileName = sourcePathTokens.fileName;
98
+ }
99
+ return _context2.abrupt("return", this.app.request.post({
100
+ url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName),
101
+ query: query,
102
+ data: {
103
+ url: file
104
+ }
105
+ }));
106
+ case 8:
107
+ if (!fileName) {
108
+ fileName = _utils["default"].getFileName(file);
109
+ }
110
+ if (fileName) {
111
+ _context2.next = 11;
112
+ break;
113
+ }
114
+ throw new Error('Wrong type of the file source object. Can not get file name');
115
+ case 11:
116
+ fileName = _utils["default"].sanitizeFileName(fileName);
117
+ return _context2.abrupt("return", this.app.request.post({
118
+ url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName),
119
+ query: query,
120
+ form: {
121
+ file: file
122
+ }
123
+ }));
124
+ case 13:
125
+ case "end":
126
+ return _context2.stop();
161
127
  }
162
128
  }, _callee2, this);
163
129
  }));
164
-
165
130
  function upload(_x5, _x6, _x7) {
166
131
  return _upload.apply(this, arguments);
167
132
  }
168
-
169
133
  return upload;
170
134
  }()
171
135
  }, {
@@ -173,93 +137,75 @@ var Files = /*#__PURE__*/function () {
173
137
  value: function () {
174
138
  var _append = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(filePath, fileName, fileContent) {
175
139
  var pathTokens,
176
- _args3 = arguments;
140
+ _args3 = arguments;
177
141
  return _regenerator["default"].wrap(function _callee3$(_context3) {
178
- while (1) {
179
- switch (_context3.prev = _context3.next) {
180
- case 0:
181
- if (!(!filePath || typeof filePath !== 'string')) {
182
- _context3.next = 2;
183
- break;
184
- }
185
-
186
- throw new Error('"filePath" must be provided and must be a string.');
187
-
188
- case 2:
189
- filePath = _utils["default"].trimSlashesInPath(filePath);
190
-
191
- if (_args3.length === 2) {
192
- fileContent = fileName;
193
- fileName = undefined;
194
- pathTokens = _utils["default"].parseFilePath(filePath);
195
-
196
- if (pathTokens.fileName) {
197
- filePath = pathTokens.filePath;
198
- fileName = pathTokens.fileName;
199
- }
200
- }
201
-
202
- if (fileName) {
203
- _context3.next = 6;
204
- break;
205
- }
206
-
207
- throw new Error('Can not resolve target file name');
208
-
209
- case 6:
210
- fileName = _utils["default"].sanitizeFileName(fileName);
211
-
212
- if (!(typeof fileContent === 'string')) {
213
- _context3.next = 9;
214
- break;
215
- }
216
-
217
- return _context3.abrupt("return", this.app.request.post({
218
- url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
219
- data: {
220
- url: fileContent
221
- }
222
- }));
223
-
224
- case 9:
225
- if (!_utils["default"].isBytesArray(fileContent)) {
226
- _context3.next = 14;
227
- break;
142
+ while (1) switch (_context3.prev = _context3.next) {
143
+ case 0:
144
+ if (!(!filePath || typeof filePath !== 'string')) {
145
+ _context3.next = 2;
146
+ break;
147
+ }
148
+ throw new Error('"filePath" must be provided and must be a string.');
149
+ case 2:
150
+ filePath = _utils["default"].trimSlashesInPath(filePath);
151
+ if (_args3.length === 2) {
152
+ fileContent = fileName;
153
+ fileName = undefined;
154
+ pathTokens = _utils["default"].parseFilePath(filePath);
155
+ if (pathTokens.fileName) {
156
+ filePath = pathTokens.filePath;
157
+ fileName = pathTokens.fileName;
228
158
  }
229
-
230
- _context3.next = 12;
231
- return _utils["default"].toBase64(fileContent);
232
-
233
- case 12:
234
- fileContent = _context3.sent;
235
- return _context3.abrupt("return", this.app.request.put({
236
- url: "".concat(this.app.urls.fileAppendBinaryPath(filePath), "/").concat(fileName),
237
- headers: {
238
- 'Content-Type': 'text/plain'
239
- },
240
- data: fileContent
241
- }));
242
-
243
- case 14:
244
- return _context3.abrupt("return", this.app.request.post({
245
- url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
246
- form: {
247
- file: fileContent
248
- }
249
- }));
250
-
251
- case 15:
252
- case "end":
253
- return _context3.stop();
254
- }
159
+ }
160
+ if (fileName) {
161
+ _context3.next = 6;
162
+ break;
163
+ }
164
+ throw new Error('Can not resolve target file name');
165
+ case 6:
166
+ fileName = _utils["default"].sanitizeFileName(fileName);
167
+ if (!(typeof fileContent === 'string')) {
168
+ _context3.next = 9;
169
+ break;
170
+ }
171
+ return _context3.abrupt("return", this.app.request.post({
172
+ url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
173
+ data: {
174
+ url: fileContent
175
+ }
176
+ }));
177
+ case 9:
178
+ if (!_utils["default"].isBytesArray(fileContent)) {
179
+ _context3.next = 14;
180
+ break;
181
+ }
182
+ _context3.next = 12;
183
+ return _utils["default"].toBase64(fileContent);
184
+ case 12:
185
+ fileContent = _context3.sent;
186
+ return _context3.abrupt("return", this.app.request.put({
187
+ url: "".concat(this.app.urls.fileAppendBinaryPath(filePath), "/").concat(fileName),
188
+ headers: {
189
+ 'Content-Type': 'text/plain'
190
+ },
191
+ data: fileContent
192
+ }));
193
+ case 14:
194
+ return _context3.abrupt("return", this.app.request.post({
195
+ url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
196
+ form: {
197
+ file: fileContent
198
+ }
199
+ }));
200
+ case 15:
201
+ case "end":
202
+ return _context3.stop();
255
203
  }
256
204
  }, _callee3, this);
257
205
  }));
258
-
259
206
  function append(_x8, _x9, _x10) {
260
207
  return _append.apply(this, arguments);
261
208
  }
262
-
263
209
  return append;
264
210
  }()
265
211
  }, {
@@ -267,69 +213,55 @@ var Files = /*#__PURE__*/function () {
267
213
  value: function () {
268
214
  var _appendText = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(filePath, fileName, textContent) {
269
215
  var pathTokens,
270
- _args4 = arguments;
216
+ _args4 = arguments;
271
217
  return _regenerator["default"].wrap(function _callee4$(_context4) {
272
- while (1) {
273
- switch (_context4.prev = _context4.next) {
274
- case 0:
275
- if (!(!filePath || typeof filePath !== 'string')) {
276
- _context4.next = 2;
277
- break;
278
- }
279
-
280
- throw new Error('"filePath" must be provided and must be a string.');
281
-
282
- case 2:
283
- filePath = _utils["default"].trimSlashesInPath(filePath);
284
-
285
- if (_args4.length === 2) {
286
- textContent = fileName;
287
- fileName = undefined;
288
- pathTokens = _utils["default"].parseFilePath(filePath);
289
-
290
- if (pathTokens.fileName) {
291
- filePath = pathTokens.filePath;
292
- fileName = pathTokens.fileName;
293
- }
294
- }
295
-
296
- if (fileName) {
297
- _context4.next = 6;
298
- break;
299
- }
300
-
301
- throw new Error('Can not resolve target file name');
302
-
303
- case 6:
304
- if (!(typeof textContent !== 'string')) {
305
- _context4.next = 8;
306
- break;
218
+ while (1) switch (_context4.prev = _context4.next) {
219
+ case 0:
220
+ if (!(!filePath || typeof filePath !== 'string')) {
221
+ _context4.next = 2;
222
+ break;
223
+ }
224
+ throw new Error('"filePath" must be provided and must be a string.');
225
+ case 2:
226
+ filePath = _utils["default"].trimSlashesInPath(filePath);
227
+ if (_args4.length === 2) {
228
+ textContent = fileName;
229
+ fileName = undefined;
230
+ pathTokens = _utils["default"].parseFilePath(filePath);
231
+ if (pathTokens.fileName) {
232
+ filePath = pathTokens.filePath;
233
+ fileName = pathTokens.fileName;
307
234
  }
308
-
309
- throw new Error('"textContent" must be a string');
310
-
311
- case 8:
312
- fileName = _utils["default"].sanitizeFileName(fileName);
313
- return _context4.abrupt("return", this.app.request.put({
314
- url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
315
- headers: {
316
- 'Content-Type': 'text/plain'
317
- },
318
- data: textContent
319
- }));
320
-
321
- case 10:
322
- case "end":
323
- return _context4.stop();
324
- }
235
+ }
236
+ if (fileName) {
237
+ _context4.next = 6;
238
+ break;
239
+ }
240
+ throw new Error('Can not resolve target file name');
241
+ case 6:
242
+ if (!(typeof textContent !== 'string')) {
243
+ _context4.next = 8;
244
+ break;
245
+ }
246
+ throw new Error('"textContent" must be a string');
247
+ case 8:
248
+ fileName = _utils["default"].sanitizeFileName(fileName);
249
+ return _context4.abrupt("return", this.app.request.put({
250
+ url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
251
+ headers: {
252
+ 'Content-Type': 'text/plain'
253
+ },
254
+ data: textContent
255
+ }));
256
+ case 10:
257
+ case "end":
258
+ return _context4.stop();
325
259
  }
326
260
  }, _callee4, this);
327
261
  }));
328
-
329
262
  function appendText(_x11, _x12, _x13) {
330
263
  return _appendText.apply(this, arguments);
331
264
  }
332
-
333
265
  return appendText;
334
266
  }()
335
267
  }, {
@@ -338,54 +270,41 @@ var Files = /*#__PURE__*/function () {
338
270
  var _listing = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(filePath, pattern, sub, pagesize, offset) {
339
271
  var query;
340
272
  return _regenerator["default"].wrap(function _callee5$(_context5) {
341
- while (1) {
342
- switch (_context5.prev = _context5.next) {
343
- case 0:
344
- query = {};
345
-
346
- if (!(!filePath || typeof filePath !== 'string')) {
347
- _context5.next = 3;
348
- break;
349
- }
350
-
351
- throw new Error('"filePath" must be provided and must be a string.');
352
-
353
- case 3:
354
- filePath = _utils["default"].trimSlashesInPath(filePath);
355
-
356
- if (pattern && typeof pattern === 'string') {
357
- query.pattern = pattern;
358
- }
359
-
360
- if (typeof sub === 'boolean') {
361
- query.sub = sub;
362
- }
363
-
364
- if (typeof pagesize === 'number' && pagesize >= 0) {
365
- query.pagesize = pagesize;
366
- }
367
-
368
- if (typeof offset === 'number' && offset >= 0) {
369
- query.offset = offset;
370
- }
371
-
372
- return _context5.abrupt("return", this.app.request.get({
373
- url: this.app.urls.filePath(filePath),
374
- query: query
375
- }));
376
-
377
- case 9:
378
- case "end":
379
- return _context5.stop();
380
- }
273
+ while (1) switch (_context5.prev = _context5.next) {
274
+ case 0:
275
+ query = {};
276
+ if (!(!filePath || typeof filePath !== 'string')) {
277
+ _context5.next = 3;
278
+ break;
279
+ }
280
+ throw new Error('"filePath" must be provided and must be a string.');
281
+ case 3:
282
+ filePath = _utils["default"].trimSlashesInPath(filePath);
283
+ if (pattern && typeof pattern === 'string') {
284
+ query.pattern = pattern;
285
+ }
286
+ if (typeof sub === 'boolean') {
287
+ query.sub = sub;
288
+ }
289
+ if (typeof pagesize === 'number' && pagesize >= 0) {
290
+ query.pagesize = pagesize;
291
+ }
292
+ if (typeof offset === 'number' && offset >= 0) {
293
+ query.offset = offset;
294
+ }
295
+ return _context5.abrupt("return", this.app.request.get({
296
+ url: this.app.urls.filePath(filePath),
297
+ query: query
298
+ }));
299
+ case 9:
300
+ case "end":
301
+ return _context5.stop();
381
302
  }
382
303
  }, _callee5, this);
383
304
  }));
384
-
385
305
  function listing(_x14, _x15, _x16, _x17, _x18) {
386
306
  return _listing.apply(this, arguments);
387
307
  }
388
-
389
308
  return listing;
390
309
  }()
391
310
  }, {
@@ -393,45 +312,36 @@ var Files = /*#__PURE__*/function () {
393
312
  value: function () {
394
313
  var _renameFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(oldPathName, newName) {
395
314
  return _regenerator["default"].wrap(function _callee6$(_context6) {
396
- while (1) {
397
- switch (_context6.prev = _context6.next) {
398
- case 0:
399
- if (!(!oldPathName || typeof oldPathName !== 'string')) {
400
- _context6.next = 2;
401
- break;
402
- }
403
-
404
- throw new Error('"oldPathName" must be provided and must be a string.');
405
-
406
- case 2:
407
- if (!(!newName || typeof newName !== 'string')) {
408
- _context6.next = 4;
409
- break;
410
- }
411
-
412
- throw new Error('New File Name must be provided and must be a string.');
413
-
414
- case 4:
415
- return _context6.abrupt("return", this.app.request.put({
416
- url: this.app.urls.fileRename(),
417
- data: {
418
- oldPathName: _utils["default"].ensureSlashInPath(oldPathName),
419
- newName: newName
420
- }
421
- }));
422
-
423
- case 5:
424
- case "end":
425
- return _context6.stop();
426
- }
315
+ while (1) switch (_context6.prev = _context6.next) {
316
+ case 0:
317
+ if (!(!oldPathName || typeof oldPathName !== 'string')) {
318
+ _context6.next = 2;
319
+ break;
320
+ }
321
+ throw new Error('"oldPathName" must be provided and must be a string.');
322
+ case 2:
323
+ if (!(!newName || typeof newName !== 'string')) {
324
+ _context6.next = 4;
325
+ break;
326
+ }
327
+ throw new Error('New File Name must be provided and must be a string.');
328
+ case 4:
329
+ return _context6.abrupt("return", this.app.request.put({
330
+ url: this.app.urls.fileRename(),
331
+ data: {
332
+ oldPathName: _utils["default"].ensureSlashInPath(oldPathName),
333
+ newName: newName
334
+ }
335
+ }));
336
+ case 5:
337
+ case "end":
338
+ return _context6.stop();
427
339
  }
428
340
  }, _callee6, this);
429
341
  }));
430
-
431
342
  function renameFile(_x19, _x20) {
432
343
  return _renameFile.apply(this, arguments);
433
344
  }
434
-
435
345
  return renameFile;
436
346
  }()
437
347
  }, {
@@ -439,29 +349,24 @@ var Files = /*#__PURE__*/function () {
439
349
  value: function () {
440
350
  var _moveFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(sourcePath, targetPath) {
441
351
  return _regenerator["default"].wrap(function _callee7$(_context7) {
442
- while (1) {
443
- switch (_context7.prev = _context7.next) {
444
- case 0:
445
- return _context7.abrupt("return", this.app.request.put({
446
- url: this.app.urls.fileMove(),
447
- data: {
448
- sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
449
- targetPath: _utils["default"].ensureSlashInPath(targetPath)
450
- }
451
- }));
452
-
453
- case 1:
454
- case "end":
455
- return _context7.stop();
456
- }
352
+ while (1) switch (_context7.prev = _context7.next) {
353
+ case 0:
354
+ return _context7.abrupt("return", this.app.request.put({
355
+ url: this.app.urls.fileMove(),
356
+ data: {
357
+ sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
358
+ targetPath: _utils["default"].ensureSlashInPath(targetPath)
359
+ }
360
+ }));
361
+ case 1:
362
+ case "end":
363
+ return _context7.stop();
457
364
  }
458
365
  }, _callee7, this);
459
366
  }));
460
-
461
367
  function moveFile(_x21, _x22) {
462
368
  return _moveFile.apply(this, arguments);
463
369
  }
464
-
465
370
  return moveFile;
466
371
  }()
467
372
  }, {
@@ -469,29 +374,24 @@ var Files = /*#__PURE__*/function () {
469
374
  value: function () {
470
375
  var _copyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(sourcePath, targetPath) {
471
376
  return _regenerator["default"].wrap(function _callee8$(_context8) {
472
- while (1) {
473
- switch (_context8.prev = _context8.next) {
474
- case 0:
475
- return _context8.abrupt("return", this.app.request.put({
476
- url: this.app.urls.fileCopy(),
477
- data: {
478
- sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
479
- targetPath: _utils["default"].ensureSlashInPath(targetPath)
480
- }
481
- }));
482
-
483
- case 1:
484
- case "end":
485
- return _context8.stop();
486
- }
377
+ while (1) switch (_context8.prev = _context8.next) {
378
+ case 0:
379
+ return _context8.abrupt("return", this.app.request.put({
380
+ url: this.app.urls.fileCopy(),
381
+ data: {
382
+ sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
383
+ targetPath: _utils["default"].ensureSlashInPath(targetPath)
384
+ }
385
+ }));
386
+ case 1:
387
+ case "end":
388
+ return _context8.stop();
487
389
  }
488
390
  }, _callee8, this);
489
391
  }));
490
-
491
392
  function copyFile(_x23, _x24) {
492
393
  return _copyFile.apply(this, arguments);
493
394
  }
494
-
495
395
  return copyFile;
496
396
  }()
497
397
  }, {
@@ -499,37 +399,29 @@ var Files = /*#__PURE__*/function () {
499
399
  value: function () {
500
400
  var _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(filePath) {
501
401
  return _regenerator["default"].wrap(function _callee9$(_context9) {
502
- while (1) {
503
- switch (_context9.prev = _context9.next) {
504
- case 0:
505
- if (!(!filePath || typeof filePath !== 'string')) {
506
- _context9.next = 2;
507
- break;
508
- }
509
-
510
- throw new Error('"filePath" must be provided and must be a string.');
511
-
512
- case 2:
513
- if (!filePath.startsWith('http://') && !filePath.startsWith('https://')) {
514
- filePath = this.app.urls.filePath(filePath);
515
- }
516
-
517
- return _context9.abrupt("return", this.app.request["delete"]({
518
- url: filePath
519
- }));
520
-
521
- case 4:
522
- case "end":
523
- return _context9.stop();
524
- }
402
+ while (1) switch (_context9.prev = _context9.next) {
403
+ case 0:
404
+ if (!(!filePath || typeof filePath !== 'string')) {
405
+ _context9.next = 2;
406
+ break;
407
+ }
408
+ throw new Error('"filePath" must be provided and must be a string.');
409
+ case 2:
410
+ if (!filePath.startsWith('http://') && !filePath.startsWith('https://')) {
411
+ filePath = this.app.urls.filePath(filePath);
412
+ }
413
+ return _context9.abrupt("return", this.app.request["delete"]({
414
+ url: filePath
415
+ }));
416
+ case 4:
417
+ case "end":
418
+ return _context9.stop();
525
419
  }
526
420
  }, _callee9, this);
527
421
  }));
528
-
529
422
  function remove(_x25) {
530
423
  return _remove.apply(this, arguments);
531
424
  }
532
-
533
425
  return remove;
534
426
  }()
535
427
  }, {
@@ -537,37 +429,30 @@ var Files = /*#__PURE__*/function () {
537
429
  value: function () {
538
430
  var _exists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(filePath) {
539
431
  return _regenerator["default"].wrap(function _callee10$(_context10) {
540
- while (1) {
541
- switch (_context10.prev = _context10.next) {
542
- case 0:
543
- if (!(!filePath || typeof filePath !== 'string')) {
544
- _context10.next = 2;
545
- break;
546
- }
547
-
548
- throw new Error('"filePath" must be provided and must be a string.');
549
-
550
- case 2:
551
- filePath = _utils["default"].trimSlashesInPath(filePath);
552
- return _context10.abrupt("return", this.app.request.get({
553
- url: this.app.urls.filePath(filePath),
554
- query: {
555
- action: 'exists'
556
- }
557
- }));
558
-
559
- case 4:
560
- case "end":
561
- return _context10.stop();
562
- }
432
+ while (1) switch (_context10.prev = _context10.next) {
433
+ case 0:
434
+ if (!(!filePath || typeof filePath !== 'string')) {
435
+ _context10.next = 2;
436
+ break;
437
+ }
438
+ throw new Error('"filePath" must be provided and must be a string.');
439
+ case 2:
440
+ filePath = _utils["default"].trimSlashesInPath(filePath);
441
+ return _context10.abrupt("return", this.app.request.get({
442
+ url: this.app.urls.filePath(filePath),
443
+ query: {
444
+ action: 'exists'
445
+ }
446
+ }));
447
+ case 4:
448
+ case "end":
449
+ return _context10.stop();
563
450
  }
564
451
  }, _callee10, this);
565
452
  }));
566
-
567
453
  function exists(_x26) {
568
454
  return _exists.apply(this, arguments);
569
455
  }
570
-
571
456
  return exists;
572
457
  }()
573
458
  }, {
@@ -575,48 +460,39 @@ var Files = /*#__PURE__*/function () {
575
460
  value: function () {
576
461
  var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(filesPath, pattern, sub, countDirectories) {
577
462
  return _regenerator["default"].wrap(function _callee11$(_context11) {
578
- while (1) {
579
- switch (_context11.prev = _context11.next) {
580
- case 0:
581
- if (!(!filesPath || typeof filesPath !== 'string')) {
582
- _context11.next = 2;
583
- break;
584
- }
585
-
586
- throw new Error('"filesPath" must be provided and must be a string.');
587
-
588
- case 2:
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.');
595
-
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:
609
- case "end":
610
- return _context11.stop();
611
- }
463
+ while (1) switch (_context11.prev = _context11.next) {
464
+ case 0:
465
+ if (!(!filesPath || typeof filesPath !== 'string')) {
466
+ _context11.next = 2;
467
+ break;
468
+ }
469
+ throw new Error('"filesPath" must be provided and must be a string.');
470
+ case 2:
471
+ if (!(pattern && typeof pattern !== 'string')) {
472
+ _context11.next = 4;
473
+ break;
474
+ }
475
+ throw new Error('Files Pattern must be provided and must be a string.');
476
+ case 4:
477
+ filesPath = _utils["default"].trimSlashesInPath(filesPath);
478
+ return _context11.abrupt("return", this.app.request.get({
479
+ url: this.app.urls.filePath(filesPath),
480
+ query: {
481
+ action: 'count',
482
+ pattern: pattern || '*',
483
+ sub: !!sub,
484
+ countDirectories: !!countDirectories
485
+ }
486
+ }));
487
+ case 6:
488
+ case "end":
489
+ return _context11.stop();
612
490
  }
613
491
  }, _callee11, this);
614
492
  }));
615
-
616
493
  function getFileCount(_x27, _x28, _x29, _x30) {
617
494
  return _getFileCount.apply(this, arguments);
618
495
  }
619
-
620
496
  return getFileCount;
621
497
  }()
622
498
  }, {
@@ -624,34 +500,27 @@ var Files = /*#__PURE__*/function () {
624
500
  value: function () {
625
501
  var _createDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(directoryPath) {
626
502
  return _regenerator["default"].wrap(function _callee12$(_context12) {
627
- while (1) {
628
- switch (_context12.prev = _context12.next) {
629
- case 0:
630
- if (!(!directoryPath || typeof directoryPath !== 'string')) {
631
- _context12.next = 2;
632
- break;
633
- }
634
-
635
- throw new Error('Directory "path" must be provided and must be a string.');
636
-
637
- case 2:
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
- }
503
+ while (1) switch (_context12.prev = _context12.next) {
504
+ case 0:
505
+ if (!(!directoryPath || typeof directoryPath !== 'string')) {
506
+ _context12.next = 2;
507
+ break;
508
+ }
509
+ throw new Error('Directory "path" must be provided and must be a string.');
510
+ case 2:
511
+ directoryPath = _utils["default"].trimSlashesInPath(directoryPath);
512
+ return _context12.abrupt("return", this.app.request.post({
513
+ url: this.app.urls.directoryPath(directoryPath)
514
+ }));
515
+ case 4:
516
+ case "end":
517
+ return _context12.stop();
647
518
  }
648
519
  }, _callee12, this);
649
520
  }));
650
-
651
521
  function createDirectory(_x31) {
652
522
  return _createDirectory.apply(this, arguments);
653
523
  }
654
-
655
524
  return createDirectory;
656
525
  }()
657
526
  }, {
@@ -659,38 +528,30 @@ var Files = /*#__PURE__*/function () {
659
528
  value: function () {
660
529
  var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13(directoryPath) {
661
530
  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;
667
- break;
668
- }
669
-
670
- throw new Error('Directory "path" must be provided and must be a string.');
671
-
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)
676
- }));
677
-
678
- case 4:
679
- case "end":
680
- return _context13.stop();
681
- }
531
+ while (1) switch (_context13.prev = _context13.next) {
532
+ case 0:
533
+ if (!(!directoryPath || typeof directoryPath !== 'string')) {
534
+ _context13.next = 2;
535
+ break;
536
+ }
537
+ throw new Error('Directory "path" must be provided and must be a string.');
538
+ case 2:
539
+ directoryPath = _utils["default"].trimSlashesInPath(directoryPath);
540
+ return _context13.abrupt("return", this.app.request["delete"]({
541
+ url: this.app.urls.filePath(directoryPath)
542
+ }));
543
+ case 4:
544
+ case "end":
545
+ return _context13.stop();
682
546
  }
683
547
  }, _callee13, this);
684
548
  }));
685
-
686
549
  function removeDirectory(_x32) {
687
550
  return _removeDirectory.apply(this, arguments);
688
551
  }
689
-
690
552
  return removeDirectory;
691
553
  }()
692
554
  }]);
693
555
  return Files;
694
556
  }();
695
-
696
557
  exports["default"] = Files;