backendless 6.3.3 → 6.3.7
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 +19 -4
- package/dist/backendless.js +306 -76
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +3 -3
- package/es/data/index.js +26 -0
- package/es/files/index.js +235 -71
- package/es/files/utils.js +23 -2
- package/es/local-cache/index.js +1 -1
- package/es/logging/index.js +4 -0
- package/es/urls.js +15 -0
- package/lib/data/index.js +26 -0
- package/lib/files/index.js +235 -71
- package/lib/files/utils.js +23 -2
- package/lib/local-cache/index.js +1 -1
- package/lib/logging/index.js +4 -0
- package/lib/urls.js +15 -0
- package/package.json +2 -2
- package/src/data/index.js +6 -0
- package/src/files/index.js +95 -7
- package/src/files/utils.js +25 -2
- package/src/local-cache/index.js +3 -1
- package/src/logging/index.js +4 -0
- package/src/urls.js +12 -0
package/lib/data/index.js
CHANGED
|
@@ -102,6 +102,32 @@ var Data = /*#__PURE__*/function () {
|
|
|
102
102
|
|
|
103
103
|
return describe;
|
|
104
104
|
}()
|
|
105
|
+
}, {
|
|
106
|
+
key: "getTableNameById",
|
|
107
|
+
value: function () {
|
|
108
|
+
var _getTableNameById = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(tableId) {
|
|
109
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
110
|
+
while (1) {
|
|
111
|
+
switch (_context2.prev = _context2.next) {
|
|
112
|
+
case 0:
|
|
113
|
+
return _context2.abrupt("return", this.app.request.get({
|
|
114
|
+
url: this.app.urls.dataTableNameById(tableId)
|
|
115
|
+
}));
|
|
116
|
+
|
|
117
|
+
case 1:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context2.stop();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, _callee2, this);
|
|
123
|
+
}));
|
|
124
|
+
|
|
125
|
+
function getTableNameById(_x2) {
|
|
126
|
+
return _getTableNameById.apply(this, arguments);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return getTableNameById;
|
|
130
|
+
}()
|
|
105
131
|
}, {
|
|
106
132
|
key: "mapTableToClass",
|
|
107
133
|
value: function mapTableToClass(tableName, clientClass) {
|
package/lib/files/index.js
CHANGED
|
@@ -66,7 +66,7 @@ var Files = /*#__PURE__*/function () {
|
|
|
66
66
|
query.overwrite = overwrite;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
filePath = _utils["default"].
|
|
69
|
+
filePath = _utils["default"].trimSlashesInPath(filePath);
|
|
70
70
|
fileName = _utils["default"].sanitizeFileName(fileName);
|
|
71
71
|
return _context.abrupt("return", this.app.request.put({
|
|
72
72
|
url: "".concat(this.app.urls.fileBinaryPath(filePath), "/").concat(fileName),
|
|
@@ -106,7 +106,7 @@ var Files = /*#__PURE__*/function () {
|
|
|
106
106
|
query.overwrite = overwrite;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
filePath = _utils["default"].
|
|
109
|
+
filePath = _utils["default"].trimSlashesInPath(filePath);
|
|
110
110
|
pathTokens = _utils["default"].parseFilePath(filePath);
|
|
111
111
|
|
|
112
112
|
if (pathTokens.fileName) {
|
|
@@ -125,7 +125,7 @@ var Files = /*#__PURE__*/function () {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
return _context2.abrupt("return", this.app.request.post({
|
|
128
|
-
url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName
|
|
128
|
+
url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName),
|
|
129
129
|
query: query,
|
|
130
130
|
data: {
|
|
131
131
|
url: file
|
|
@@ -169,25 +169,189 @@ var Files = /*#__PURE__*/function () {
|
|
|
169
169
|
return upload;
|
|
170
170
|
}()
|
|
171
171
|
}, {
|
|
172
|
-
key: "
|
|
172
|
+
key: "append",
|
|
173
173
|
value: function () {
|
|
174
|
-
var
|
|
175
|
-
var
|
|
174
|
+
var _append = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(filePath, fileName, fileContent) {
|
|
175
|
+
var pathTokens,
|
|
176
|
+
_args3 = arguments;
|
|
176
177
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
177
178
|
while (1) {
|
|
178
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;
|
|
228
|
+
}
|
|
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
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}, _callee3, this);
|
|
257
|
+
}));
|
|
258
|
+
|
|
259
|
+
function append(_x8, _x9, _x10) {
|
|
260
|
+
return _append.apply(this, arguments);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return append;
|
|
264
|
+
}()
|
|
265
|
+
}, {
|
|
266
|
+
key: "appendText",
|
|
267
|
+
value: function () {
|
|
268
|
+
var _appendText = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(filePath, fileName, textContent) {
|
|
269
|
+
var pathTokens,
|
|
270
|
+
_args4 = arguments;
|
|
271
|
+
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;
|
|
307
|
+
}
|
|
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
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}, _callee4, this);
|
|
327
|
+
}));
|
|
328
|
+
|
|
329
|
+
function appendText(_x11, _x12, _x13) {
|
|
330
|
+
return _appendText.apply(this, arguments);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
return appendText;
|
|
334
|
+
}()
|
|
335
|
+
}, {
|
|
336
|
+
key: "listing",
|
|
337
|
+
value: function () {
|
|
338
|
+
var _listing = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(filePath, pattern, sub, pagesize, offset) {
|
|
339
|
+
var query;
|
|
340
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
341
|
+
while (1) {
|
|
342
|
+
switch (_context5.prev = _context5.next) {
|
|
179
343
|
case 0:
|
|
180
344
|
query = {};
|
|
181
345
|
|
|
182
346
|
if (!(!filePath || typeof filePath !== 'string')) {
|
|
183
|
-
|
|
347
|
+
_context5.next = 3;
|
|
184
348
|
break;
|
|
185
349
|
}
|
|
186
350
|
|
|
187
351
|
throw new Error('"filePath" must be provided and must be a string.');
|
|
188
352
|
|
|
189
353
|
case 3:
|
|
190
|
-
filePath = _utils["default"].
|
|
354
|
+
filePath = _utils["default"].trimSlashesInPath(filePath);
|
|
191
355
|
|
|
192
356
|
if (pattern && typeof pattern === 'string') {
|
|
193
357
|
query.pattern = pattern;
|
|
@@ -205,20 +369,20 @@ var Files = /*#__PURE__*/function () {
|
|
|
205
369
|
query.offset = offset;
|
|
206
370
|
}
|
|
207
371
|
|
|
208
|
-
return
|
|
372
|
+
return _context5.abrupt("return", this.app.request.get({
|
|
209
373
|
url: this.app.urls.filePath(filePath),
|
|
210
374
|
query: query
|
|
211
375
|
}));
|
|
212
376
|
|
|
213
377
|
case 9:
|
|
214
378
|
case "end":
|
|
215
|
-
return
|
|
379
|
+
return _context5.stop();
|
|
216
380
|
}
|
|
217
381
|
}
|
|
218
|
-
},
|
|
382
|
+
}, _callee5, this);
|
|
219
383
|
}));
|
|
220
384
|
|
|
221
|
-
function listing(
|
|
385
|
+
function listing(_x14, _x15, _x16, _x17, _x18) {
|
|
222
386
|
return _listing.apply(this, arguments);
|
|
223
387
|
}
|
|
224
388
|
|
|
@@ -227,13 +391,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
227
391
|
}, {
|
|
228
392
|
key: "renameFile",
|
|
229
393
|
value: function () {
|
|
230
|
-
var _renameFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
231
|
-
return _regenerator["default"].wrap(function
|
|
394
|
+
var _renameFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(oldPathName, newName) {
|
|
395
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
232
396
|
while (1) {
|
|
233
|
-
switch (
|
|
397
|
+
switch (_context6.prev = _context6.next) {
|
|
234
398
|
case 0:
|
|
235
399
|
if (!(!oldPathName || typeof oldPathName !== 'string')) {
|
|
236
|
-
|
|
400
|
+
_context6.next = 2;
|
|
237
401
|
break;
|
|
238
402
|
}
|
|
239
403
|
|
|
@@ -241,14 +405,14 @@ var Files = /*#__PURE__*/function () {
|
|
|
241
405
|
|
|
242
406
|
case 2:
|
|
243
407
|
if (!(!newName || typeof newName !== 'string')) {
|
|
244
|
-
|
|
408
|
+
_context6.next = 4;
|
|
245
409
|
break;
|
|
246
410
|
}
|
|
247
411
|
|
|
248
412
|
throw new Error('New File Name must be provided and must be a string.');
|
|
249
413
|
|
|
250
414
|
case 4:
|
|
251
|
-
return
|
|
415
|
+
return _context6.abrupt("return", this.app.request.put({
|
|
252
416
|
url: this.app.urls.fileRename(),
|
|
253
417
|
data: {
|
|
254
418
|
oldPathName: _utils["default"].ensureSlashInPath(oldPathName),
|
|
@@ -258,13 +422,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
258
422
|
|
|
259
423
|
case 5:
|
|
260
424
|
case "end":
|
|
261
|
-
return
|
|
425
|
+
return _context6.stop();
|
|
262
426
|
}
|
|
263
427
|
}
|
|
264
|
-
},
|
|
428
|
+
}, _callee6, this);
|
|
265
429
|
}));
|
|
266
430
|
|
|
267
|
-
function renameFile(
|
|
431
|
+
function renameFile(_x19, _x20) {
|
|
268
432
|
return _renameFile.apply(this, arguments);
|
|
269
433
|
}
|
|
270
434
|
|
|
@@ -273,12 +437,12 @@ var Files = /*#__PURE__*/function () {
|
|
|
273
437
|
}, {
|
|
274
438
|
key: "moveFile",
|
|
275
439
|
value: function () {
|
|
276
|
-
var _moveFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
277
|
-
return _regenerator["default"].wrap(function
|
|
440
|
+
var _moveFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(sourcePath, targetPath) {
|
|
441
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
278
442
|
while (1) {
|
|
279
|
-
switch (
|
|
443
|
+
switch (_context7.prev = _context7.next) {
|
|
280
444
|
case 0:
|
|
281
|
-
return
|
|
445
|
+
return _context7.abrupt("return", this.app.request.put({
|
|
282
446
|
url: this.app.urls.fileMove(),
|
|
283
447
|
data: {
|
|
284
448
|
sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
|
|
@@ -288,13 +452,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
288
452
|
|
|
289
453
|
case 1:
|
|
290
454
|
case "end":
|
|
291
|
-
return
|
|
455
|
+
return _context7.stop();
|
|
292
456
|
}
|
|
293
457
|
}
|
|
294
|
-
},
|
|
458
|
+
}, _callee7, this);
|
|
295
459
|
}));
|
|
296
460
|
|
|
297
|
-
function moveFile(
|
|
461
|
+
function moveFile(_x21, _x22) {
|
|
298
462
|
return _moveFile.apply(this, arguments);
|
|
299
463
|
}
|
|
300
464
|
|
|
@@ -303,12 +467,12 @@ var Files = /*#__PURE__*/function () {
|
|
|
303
467
|
}, {
|
|
304
468
|
key: "copyFile",
|
|
305
469
|
value: function () {
|
|
306
|
-
var _copyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
307
|
-
return _regenerator["default"].wrap(function
|
|
470
|
+
var _copyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(sourcePath, targetPath) {
|
|
471
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
308
472
|
while (1) {
|
|
309
|
-
switch (
|
|
473
|
+
switch (_context8.prev = _context8.next) {
|
|
310
474
|
case 0:
|
|
311
|
-
return
|
|
475
|
+
return _context8.abrupt("return", this.app.request.put({
|
|
312
476
|
url: this.app.urls.fileCopy(),
|
|
313
477
|
data: {
|
|
314
478
|
sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
|
|
@@ -318,13 +482,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
318
482
|
|
|
319
483
|
case 1:
|
|
320
484
|
case "end":
|
|
321
|
-
return
|
|
485
|
+
return _context8.stop();
|
|
322
486
|
}
|
|
323
487
|
}
|
|
324
|
-
},
|
|
488
|
+
}, _callee8, this);
|
|
325
489
|
}));
|
|
326
490
|
|
|
327
|
-
function copyFile(
|
|
491
|
+
function copyFile(_x23, _x24) {
|
|
328
492
|
return _copyFile.apply(this, arguments);
|
|
329
493
|
}
|
|
330
494
|
|
|
@@ -333,13 +497,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
333
497
|
}, {
|
|
334
498
|
key: "remove",
|
|
335
499
|
value: function () {
|
|
336
|
-
var _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
337
|
-
return _regenerator["default"].wrap(function
|
|
500
|
+
var _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(filePath) {
|
|
501
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
338
502
|
while (1) {
|
|
339
|
-
switch (
|
|
503
|
+
switch (_context9.prev = _context9.next) {
|
|
340
504
|
case 0:
|
|
341
505
|
if (!(!filePath || typeof filePath !== 'string')) {
|
|
342
|
-
|
|
506
|
+
_context9.next = 2;
|
|
343
507
|
break;
|
|
344
508
|
}
|
|
345
509
|
|
|
@@ -350,19 +514,19 @@ var Files = /*#__PURE__*/function () {
|
|
|
350
514
|
filePath = this.app.urls.filePath(filePath);
|
|
351
515
|
}
|
|
352
516
|
|
|
353
|
-
return
|
|
517
|
+
return _context9.abrupt("return", this.app.request["delete"]({
|
|
354
518
|
url: filePath
|
|
355
519
|
}));
|
|
356
520
|
|
|
357
521
|
case 4:
|
|
358
522
|
case "end":
|
|
359
|
-
return
|
|
523
|
+
return _context9.stop();
|
|
360
524
|
}
|
|
361
525
|
}
|
|
362
|
-
},
|
|
526
|
+
}, _callee9, this);
|
|
363
527
|
}));
|
|
364
528
|
|
|
365
|
-
function remove(
|
|
529
|
+
function remove(_x25) {
|
|
366
530
|
return _remove.apply(this, arguments);
|
|
367
531
|
}
|
|
368
532
|
|
|
@@ -371,21 +535,21 @@ var Files = /*#__PURE__*/function () {
|
|
|
371
535
|
}, {
|
|
372
536
|
key: "exists",
|
|
373
537
|
value: function () {
|
|
374
|
-
var _exists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
375
|
-
return _regenerator["default"].wrap(function
|
|
538
|
+
var _exists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(filePath) {
|
|
539
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
376
540
|
while (1) {
|
|
377
|
-
switch (
|
|
541
|
+
switch (_context10.prev = _context10.next) {
|
|
378
542
|
case 0:
|
|
379
543
|
if (!(!filePath || typeof filePath !== 'string')) {
|
|
380
|
-
|
|
544
|
+
_context10.next = 2;
|
|
381
545
|
break;
|
|
382
546
|
}
|
|
383
547
|
|
|
384
548
|
throw new Error('"filePath" must be provided and must be a string.');
|
|
385
549
|
|
|
386
550
|
case 2:
|
|
387
|
-
filePath = _utils["default"].
|
|
388
|
-
return
|
|
551
|
+
filePath = _utils["default"].trimSlashesInPath(filePath);
|
|
552
|
+
return _context10.abrupt("return", this.app.request.get({
|
|
389
553
|
url: this.app.urls.filePath(filePath),
|
|
390
554
|
query: {
|
|
391
555
|
action: 'exists'
|
|
@@ -394,13 +558,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
394
558
|
|
|
395
559
|
case 4:
|
|
396
560
|
case "end":
|
|
397
|
-
return
|
|
561
|
+
return _context10.stop();
|
|
398
562
|
}
|
|
399
563
|
}
|
|
400
|
-
},
|
|
564
|
+
}, _callee10, this);
|
|
401
565
|
}));
|
|
402
566
|
|
|
403
|
-
function exists(
|
|
567
|
+
function exists(_x26) {
|
|
404
568
|
return _exists.apply(this, arguments);
|
|
405
569
|
}
|
|
406
570
|
|
|
@@ -409,33 +573,33 @@ var Files = /*#__PURE__*/function () {
|
|
|
409
573
|
}, {
|
|
410
574
|
key: "removeDirectory",
|
|
411
575
|
value: function () {
|
|
412
|
-
var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
413
|
-
return _regenerator["default"].wrap(function
|
|
576
|
+
var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(directoryPath) {
|
|
577
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
414
578
|
while (1) {
|
|
415
|
-
switch (
|
|
579
|
+
switch (_context11.prev = _context11.next) {
|
|
416
580
|
case 0:
|
|
417
581
|
if (!(!directoryPath || typeof directoryPath !== 'string')) {
|
|
418
|
-
|
|
582
|
+
_context11.next = 2;
|
|
419
583
|
break;
|
|
420
584
|
}
|
|
421
585
|
|
|
422
586
|
throw new Error('Directory "path" must be provided and must be a string.');
|
|
423
587
|
|
|
424
588
|
case 2:
|
|
425
|
-
directoryPath = _utils["default"].
|
|
426
|
-
return
|
|
589
|
+
directoryPath = _utils["default"].trimSlashesInPath(directoryPath);
|
|
590
|
+
return _context11.abrupt("return", this.app.request["delete"]({
|
|
427
591
|
url: this.app.urls.filePath(directoryPath)
|
|
428
592
|
}));
|
|
429
593
|
|
|
430
594
|
case 4:
|
|
431
595
|
case "end":
|
|
432
|
-
return
|
|
596
|
+
return _context11.stop();
|
|
433
597
|
}
|
|
434
598
|
}
|
|
435
|
-
},
|
|
599
|
+
}, _callee11, this);
|
|
436
600
|
}));
|
|
437
601
|
|
|
438
|
-
function removeDirectory(
|
|
602
|
+
function removeDirectory(_x27) {
|
|
439
603
|
return _removeDirectory.apply(this, arguments);
|
|
440
604
|
}
|
|
441
605
|
|
|
@@ -444,13 +608,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
444
608
|
}, {
|
|
445
609
|
key: "getFileCount",
|
|
446
610
|
value: function () {
|
|
447
|
-
var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
448
|
-
return _regenerator["default"].wrap(function
|
|
611
|
+
var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(filesPath, pattern, sub, countDirectories) {
|
|
612
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
449
613
|
while (1) {
|
|
450
|
-
switch (
|
|
614
|
+
switch (_context12.prev = _context12.next) {
|
|
451
615
|
case 0:
|
|
452
616
|
if (!(!filesPath || typeof filesPath !== 'string')) {
|
|
453
|
-
|
|
617
|
+
_context12.next = 2;
|
|
454
618
|
break;
|
|
455
619
|
}
|
|
456
620
|
|
|
@@ -458,15 +622,15 @@ var Files = /*#__PURE__*/function () {
|
|
|
458
622
|
|
|
459
623
|
case 2:
|
|
460
624
|
if (!(pattern && typeof pattern !== 'string')) {
|
|
461
|
-
|
|
625
|
+
_context12.next = 4;
|
|
462
626
|
break;
|
|
463
627
|
}
|
|
464
628
|
|
|
465
629
|
throw new Error('Files Pattern must be provided and must be a string.');
|
|
466
630
|
|
|
467
631
|
case 4:
|
|
468
|
-
filesPath = _utils["default"].
|
|
469
|
-
return
|
|
632
|
+
filesPath = _utils["default"].trimSlashesInPath(filesPath);
|
|
633
|
+
return _context12.abrupt("return", this.app.request.get({
|
|
470
634
|
url: this.app.urls.filePath(filesPath),
|
|
471
635
|
query: {
|
|
472
636
|
action: 'count',
|
|
@@ -478,13 +642,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
478
642
|
|
|
479
643
|
case 6:
|
|
480
644
|
case "end":
|
|
481
|
-
return
|
|
645
|
+
return _context12.stop();
|
|
482
646
|
}
|
|
483
647
|
}
|
|
484
|
-
},
|
|
648
|
+
}, _callee12, this);
|
|
485
649
|
}));
|
|
486
650
|
|
|
487
|
-
function getFileCount(
|
|
651
|
+
function getFileCount(_x28, _x29, _x30, _x31) {
|
|
488
652
|
return _getFileCount.apply(this, arguments);
|
|
489
653
|
}
|
|
490
654
|
|
package/lib/files/utils.js
CHANGED
|
@@ -12,11 +12,32 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
13
|
|
|
14
14
|
var FilesUtils = {
|
|
15
|
+
isBytesArray: function isBytesArray(data) {
|
|
16
|
+
if (typeof Buffer !== 'undefined' && data instanceof Buffer) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return Array.isArray(data);
|
|
25
|
+
},
|
|
15
26
|
ensureSlashInPath: function ensureSlashInPath(path) {
|
|
16
27
|
return !path.startsWith('/') ? "/".concat(path) : path;
|
|
17
28
|
},
|
|
18
|
-
|
|
19
|
-
|
|
29
|
+
trimSlashesInPath: function trimSlashesInPath(path) {
|
|
30
|
+
if (path) {
|
|
31
|
+
if (path.startsWith('/')) {
|
|
32
|
+
path = path.slice(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (path.endsWith('/')) {
|
|
36
|
+
path = path.slice(0, path.length - 1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return path;
|
|
20
41
|
},
|
|
21
42
|
parseFilePath: function parseFilePath(path) {
|
|
22
43
|
var result = {
|
package/lib/local-cache/index.js
CHANGED
|
@@ -23,7 +23,7 @@ var LocalCache = /*#__PURE__*/function () {
|
|
|
23
23
|
function LocalCache(app) {
|
|
24
24
|
(0, _classCallCheck2["default"])(this, LocalCache);
|
|
25
25
|
this.app = app;
|
|
26
|
-
this.storageName = "".concat(STORAGE_KEY_NAMESPACE, "_").concat(this.app.appId);
|
|
26
|
+
this.storageName = this.app.appId ? "".concat(STORAGE_KEY_NAMESPACE, "_").concat(this.app.appId) : STORAGE_KEY_NAMESPACE;
|
|
27
27
|
var Storage = _utils["default"].isLocalStorageSupported ? _localStorage["default"] : _virtualStorage["default"];
|
|
28
28
|
this.setStorage(Storage);
|
|
29
29
|
this.Keys = {
|
package/lib/logging/index.js
CHANGED
|
@@ -85,6 +85,10 @@ var Logging = /*#__PURE__*/function () {
|
|
|
85
85
|
}, {
|
|
86
86
|
key: "push",
|
|
87
87
|
value: function push(logger, logLevel, message, exception) {
|
|
88
|
+
if (typeof message !== 'string') {
|
|
89
|
+
throw new Error('"message" must be a string');
|
|
90
|
+
}
|
|
91
|
+
|
|
88
92
|
this.pool.push({
|
|
89
93
|
logger: logger,
|
|
90
94
|
message: message,
|
package/lib/urls.js
CHANGED
|
@@ -202,6 +202,11 @@ var Urls = /*#__PURE__*/function () {
|
|
|
202
202
|
value: function dataObjectPermission(tableName, permissionType, objectId) {
|
|
203
203
|
return "".concat(this.dataTable(tableName), "/permissions/").concat(permissionType, "/").concat(objectId);
|
|
204
204
|
}
|
|
205
|
+
}, {
|
|
206
|
+
key: "dataTableNameById",
|
|
207
|
+
value: function dataTableNameById(tableId) {
|
|
208
|
+
return "".concat(this.data(), "/").concat(tableId, "/table-name");
|
|
209
|
+
}
|
|
205
210
|
}, {
|
|
206
211
|
key: "transactions",
|
|
207
212
|
value: function transactions() {
|
|
@@ -324,6 +329,16 @@ var Urls = /*#__PURE__*/function () {
|
|
|
324
329
|
key: "fileBinaryPath",
|
|
325
330
|
value: function fileBinaryPath(path) {
|
|
326
331
|
return "".concat(this.files(), "/binary/").concat(path);
|
|
332
|
+
}
|
|
333
|
+
}, {
|
|
334
|
+
key: "fileAppendPath",
|
|
335
|
+
value: function fileAppendPath(path) {
|
|
336
|
+
return "".concat(this.files(), "/append/").concat(path);
|
|
337
|
+
}
|
|
338
|
+
}, {
|
|
339
|
+
key: "fileAppendBinaryPath",
|
|
340
|
+
value: function fileAppendBinaryPath(path) {
|
|
341
|
+
return "".concat(this.files(), "/append/binary/").concat(path);
|
|
327
342
|
} //users
|
|
328
343
|
|
|
329
344
|
}, {
|