backendless 6.3.3 → 6.3.4
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 +17 -4
- package/dist/backendless.js +269 -74
- package/dist/backendless.js.map +1 -1
- package/dist/backendless.min.js +2 -2
- package/es/files/index.js +235 -71
- package/es/files/utils.js +23 -2
- package/es/urls.js +10 -0
- package/lib/files/index.js +235 -71
- package/lib/files/utils.js +23 -2
- package/lib/urls.js +10 -0
- package/package.json +2 -2
- package/src/files/index.js +95 -7
- package/src/files/utils.js +25 -2
- package/src/urls.js +8 -0
package/backendless.d.ts
CHANGED
|
@@ -447,12 +447,25 @@ declare module Backendless {
|
|
|
447
447
|
|
|
448
448
|
let restUrl: string;
|
|
449
449
|
|
|
450
|
-
function saveFile(path: string, fileName: string, fileContent: Blob | string, overwrite?: boolean): Promise<
|
|
450
|
+
function saveFile(path: string, fileName: string, fileContent: Blob | Buffer | string, overwrite?: boolean): Promise<string>;
|
|
451
451
|
|
|
452
|
-
function upload(file: File, path: string, overwrite?: boolean): Promise<Object>;
|
|
453
|
-
function upload(fileURL: string, path: string, overwrite?: boolean): Promise<Object>;
|
|
454
452
|
// @ts-ignore - file has to be an instance of File in browser env and an instance of ReadStream in nodejs env
|
|
455
|
-
function upload(readStream: ReadStream, path: string, overwrite?: boolean): Promise<
|
|
453
|
+
function upload(readStream: ReadStream, path: string, overwrite?: boolean): Promise<{ fileURL: string }>;
|
|
454
|
+
function upload(file: File, path: string, overwrite?: boolean): Promise<{ fileURL: string }>;
|
|
455
|
+
function upload(fileURL: string, path: string, overwrite?: boolean): Promise<{ fileURL: string }>;
|
|
456
|
+
|
|
457
|
+
function append(filePath: string, fileURL: string): Promise<string>;
|
|
458
|
+
function append(filePath: string, fileContent: Blob | Buffer | ArrayBuffer | number[]): Promise<string>;
|
|
459
|
+
// @ts-ignore
|
|
460
|
+
function append(filePath: string, readStream: ReadStream): Promise<string>;
|
|
461
|
+
|
|
462
|
+
function append(directoryPath: string, fileName: string, fileURL: string): Promise<string>;
|
|
463
|
+
function append(directoryPath: string, fileName: string, fileContent: Blob | Buffer | ArrayBuffer | number[]): Promise<string>;
|
|
464
|
+
// @ts-ignore
|
|
465
|
+
function append(directoryPath: string, fileName: string, readStream: ReadStream): Promise<string>;
|
|
466
|
+
|
|
467
|
+
function appendText(directoryPath: string, fileName: string, fileContent: string): Promise<string>;
|
|
468
|
+
function appendText(filePath: string, fileContent: string): Promise<string>;
|
|
456
469
|
|
|
457
470
|
function listing(path: string, pattern?: string, sub?: boolean, pageSize?: number, offset?: number): Promise<Object>;
|
|
458
471
|
|
package/dist/backendless.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* ********************************************************************************************************************
|
|
3
|
-
* Backendless SDK for JavaScript. Version: 6.3.
|
|
3
|
+
* Backendless SDK for JavaScript. Version: 6.3.4
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2012-2021 BACKENDLESS.COM. All Rights Reserved.
|
|
6
6
|
*
|
|
@@ -16951,7 +16951,7 @@ var Files = /*#__PURE__*/function () {
|
|
|
16951
16951
|
query.overwrite = overwrite;
|
|
16952
16952
|
}
|
|
16953
16953
|
|
|
16954
|
-
filePath = _utils["default"].
|
|
16954
|
+
filePath = _utils["default"].trimSlashesInPath(filePath);
|
|
16955
16955
|
fileName = _utils["default"].sanitizeFileName(fileName);
|
|
16956
16956
|
return _context.abrupt("return", this.app.request.put({
|
|
16957
16957
|
url: "".concat(this.app.urls.fileBinaryPath(filePath), "/").concat(fileName),
|
|
@@ -16991,7 +16991,7 @@ var Files = /*#__PURE__*/function () {
|
|
|
16991
16991
|
query.overwrite = overwrite;
|
|
16992
16992
|
}
|
|
16993
16993
|
|
|
16994
|
-
filePath = _utils["default"].
|
|
16994
|
+
filePath = _utils["default"].trimSlashesInPath(filePath);
|
|
16995
16995
|
pathTokens = _utils["default"].parseFilePath(filePath);
|
|
16996
16996
|
|
|
16997
16997
|
if (pathTokens.fileName) {
|
|
@@ -17010,7 +17010,7 @@ var Files = /*#__PURE__*/function () {
|
|
|
17010
17010
|
}
|
|
17011
17011
|
|
|
17012
17012
|
return _context2.abrupt("return", this.app.request.post({
|
|
17013
|
-
url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName
|
|
17013
|
+
url: "".concat(this.app.urls.filePath(filePath), "/").concat(fileName),
|
|
17014
17014
|
query: query,
|
|
17015
17015
|
data: {
|
|
17016
17016
|
url: file
|
|
@@ -17054,25 +17054,189 @@ var Files = /*#__PURE__*/function () {
|
|
|
17054
17054
|
return upload;
|
|
17055
17055
|
}()
|
|
17056
17056
|
}, {
|
|
17057
|
-
key: "
|
|
17057
|
+
key: "append",
|
|
17058
17058
|
value: function () {
|
|
17059
|
-
var
|
|
17060
|
-
var
|
|
17059
|
+
var _append = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(filePath, fileName, fileContent) {
|
|
17060
|
+
var pathTokens,
|
|
17061
|
+
_args3 = arguments;
|
|
17061
17062
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
17062
17063
|
while (1) {
|
|
17063
17064
|
switch (_context3.prev = _context3.next) {
|
|
17065
|
+
case 0:
|
|
17066
|
+
if (!(!filePath || typeof filePath !== 'string')) {
|
|
17067
|
+
_context3.next = 2;
|
|
17068
|
+
break;
|
|
17069
|
+
}
|
|
17070
|
+
|
|
17071
|
+
throw new Error('"filePath" must be provided and must be a string.');
|
|
17072
|
+
|
|
17073
|
+
case 2:
|
|
17074
|
+
filePath = _utils["default"].trimSlashesInPath(filePath);
|
|
17075
|
+
|
|
17076
|
+
if (_args3.length === 2) {
|
|
17077
|
+
fileContent = fileName;
|
|
17078
|
+
fileName = undefined;
|
|
17079
|
+
pathTokens = _utils["default"].parseFilePath(filePath);
|
|
17080
|
+
|
|
17081
|
+
if (pathTokens.fileName) {
|
|
17082
|
+
filePath = pathTokens.filePath;
|
|
17083
|
+
fileName = pathTokens.fileName;
|
|
17084
|
+
}
|
|
17085
|
+
}
|
|
17086
|
+
|
|
17087
|
+
if (fileName) {
|
|
17088
|
+
_context3.next = 6;
|
|
17089
|
+
break;
|
|
17090
|
+
}
|
|
17091
|
+
|
|
17092
|
+
throw new Error('Can not resolve target file name');
|
|
17093
|
+
|
|
17094
|
+
case 6:
|
|
17095
|
+
fileName = _utils["default"].sanitizeFileName(fileName);
|
|
17096
|
+
|
|
17097
|
+
if (!(typeof fileContent === 'string')) {
|
|
17098
|
+
_context3.next = 9;
|
|
17099
|
+
break;
|
|
17100
|
+
}
|
|
17101
|
+
|
|
17102
|
+
return _context3.abrupt("return", this.app.request.post({
|
|
17103
|
+
url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
|
|
17104
|
+
data: {
|
|
17105
|
+
url: fileContent
|
|
17106
|
+
}
|
|
17107
|
+
}));
|
|
17108
|
+
|
|
17109
|
+
case 9:
|
|
17110
|
+
if (!_utils["default"].isBytesArray(fileContent)) {
|
|
17111
|
+
_context3.next = 14;
|
|
17112
|
+
break;
|
|
17113
|
+
}
|
|
17114
|
+
|
|
17115
|
+
_context3.next = 12;
|
|
17116
|
+
return _utils["default"].toBase64(fileContent);
|
|
17117
|
+
|
|
17118
|
+
case 12:
|
|
17119
|
+
fileContent = _context3.sent;
|
|
17120
|
+
return _context3.abrupt("return", this.app.request.put({
|
|
17121
|
+
url: "".concat(this.app.urls.fileAppendBinaryPath(filePath), "/").concat(fileName),
|
|
17122
|
+
headers: {
|
|
17123
|
+
'Content-Type': 'text/plain'
|
|
17124
|
+
},
|
|
17125
|
+
data: fileContent
|
|
17126
|
+
}));
|
|
17127
|
+
|
|
17128
|
+
case 14:
|
|
17129
|
+
return _context3.abrupt("return", this.app.request.post({
|
|
17130
|
+
url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
|
|
17131
|
+
form: {
|
|
17132
|
+
file: fileContent
|
|
17133
|
+
}
|
|
17134
|
+
}));
|
|
17135
|
+
|
|
17136
|
+
case 15:
|
|
17137
|
+
case "end":
|
|
17138
|
+
return _context3.stop();
|
|
17139
|
+
}
|
|
17140
|
+
}
|
|
17141
|
+
}, _callee3, this);
|
|
17142
|
+
}));
|
|
17143
|
+
|
|
17144
|
+
function append(_x8, _x9, _x10) {
|
|
17145
|
+
return _append.apply(this, arguments);
|
|
17146
|
+
}
|
|
17147
|
+
|
|
17148
|
+
return append;
|
|
17149
|
+
}()
|
|
17150
|
+
}, {
|
|
17151
|
+
key: "appendText",
|
|
17152
|
+
value: function () {
|
|
17153
|
+
var _appendText = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(filePath, fileName, textContent) {
|
|
17154
|
+
var pathTokens,
|
|
17155
|
+
_args4 = arguments;
|
|
17156
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
17157
|
+
while (1) {
|
|
17158
|
+
switch (_context4.prev = _context4.next) {
|
|
17159
|
+
case 0:
|
|
17160
|
+
if (!(!filePath || typeof filePath !== 'string')) {
|
|
17161
|
+
_context4.next = 2;
|
|
17162
|
+
break;
|
|
17163
|
+
}
|
|
17164
|
+
|
|
17165
|
+
throw new Error('"filePath" must be provided and must be a string.');
|
|
17166
|
+
|
|
17167
|
+
case 2:
|
|
17168
|
+
filePath = _utils["default"].trimSlashesInPath(filePath);
|
|
17169
|
+
|
|
17170
|
+
if (_args4.length === 2) {
|
|
17171
|
+
textContent = fileName;
|
|
17172
|
+
fileName = undefined;
|
|
17173
|
+
pathTokens = _utils["default"].parseFilePath(filePath);
|
|
17174
|
+
|
|
17175
|
+
if (pathTokens.fileName) {
|
|
17176
|
+
filePath = pathTokens.filePath;
|
|
17177
|
+
fileName = pathTokens.fileName;
|
|
17178
|
+
}
|
|
17179
|
+
}
|
|
17180
|
+
|
|
17181
|
+
if (fileName) {
|
|
17182
|
+
_context4.next = 6;
|
|
17183
|
+
break;
|
|
17184
|
+
}
|
|
17185
|
+
|
|
17186
|
+
throw new Error('Can not resolve target file name');
|
|
17187
|
+
|
|
17188
|
+
case 6:
|
|
17189
|
+
if (!(typeof textContent !== 'string')) {
|
|
17190
|
+
_context4.next = 8;
|
|
17191
|
+
break;
|
|
17192
|
+
}
|
|
17193
|
+
|
|
17194
|
+
throw new Error('"textContent" must be a string');
|
|
17195
|
+
|
|
17196
|
+
case 8:
|
|
17197
|
+
fileName = _utils["default"].sanitizeFileName(fileName);
|
|
17198
|
+
return _context4.abrupt("return", this.app.request.put({
|
|
17199
|
+
url: "".concat(this.app.urls.fileAppendPath(filePath), "/").concat(fileName),
|
|
17200
|
+
headers: {
|
|
17201
|
+
'Content-Type': 'text/plain'
|
|
17202
|
+
},
|
|
17203
|
+
data: textContent
|
|
17204
|
+
}));
|
|
17205
|
+
|
|
17206
|
+
case 10:
|
|
17207
|
+
case "end":
|
|
17208
|
+
return _context4.stop();
|
|
17209
|
+
}
|
|
17210
|
+
}
|
|
17211
|
+
}, _callee4, this);
|
|
17212
|
+
}));
|
|
17213
|
+
|
|
17214
|
+
function appendText(_x11, _x12, _x13) {
|
|
17215
|
+
return _appendText.apply(this, arguments);
|
|
17216
|
+
}
|
|
17217
|
+
|
|
17218
|
+
return appendText;
|
|
17219
|
+
}()
|
|
17220
|
+
}, {
|
|
17221
|
+
key: "listing",
|
|
17222
|
+
value: function () {
|
|
17223
|
+
var _listing = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(filePath, pattern, sub, pagesize, offset) {
|
|
17224
|
+
var query;
|
|
17225
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
17226
|
+
while (1) {
|
|
17227
|
+
switch (_context5.prev = _context5.next) {
|
|
17064
17228
|
case 0:
|
|
17065
17229
|
query = {};
|
|
17066
17230
|
|
|
17067
17231
|
if (!(!filePath || typeof filePath !== 'string')) {
|
|
17068
|
-
|
|
17232
|
+
_context5.next = 3;
|
|
17069
17233
|
break;
|
|
17070
17234
|
}
|
|
17071
17235
|
|
|
17072
17236
|
throw new Error('"filePath" must be provided and must be a string.');
|
|
17073
17237
|
|
|
17074
17238
|
case 3:
|
|
17075
|
-
filePath = _utils["default"].
|
|
17239
|
+
filePath = _utils["default"].trimSlashesInPath(filePath);
|
|
17076
17240
|
|
|
17077
17241
|
if (pattern && typeof pattern === 'string') {
|
|
17078
17242
|
query.pattern = pattern;
|
|
@@ -17090,20 +17254,20 @@ var Files = /*#__PURE__*/function () {
|
|
|
17090
17254
|
query.offset = offset;
|
|
17091
17255
|
}
|
|
17092
17256
|
|
|
17093
|
-
return
|
|
17257
|
+
return _context5.abrupt("return", this.app.request.get({
|
|
17094
17258
|
url: this.app.urls.filePath(filePath),
|
|
17095
17259
|
query: query
|
|
17096
17260
|
}));
|
|
17097
17261
|
|
|
17098
17262
|
case 9:
|
|
17099
17263
|
case "end":
|
|
17100
|
-
return
|
|
17264
|
+
return _context5.stop();
|
|
17101
17265
|
}
|
|
17102
17266
|
}
|
|
17103
|
-
},
|
|
17267
|
+
}, _callee5, this);
|
|
17104
17268
|
}));
|
|
17105
17269
|
|
|
17106
|
-
function listing(
|
|
17270
|
+
function listing(_x14, _x15, _x16, _x17, _x18) {
|
|
17107
17271
|
return _listing.apply(this, arguments);
|
|
17108
17272
|
}
|
|
17109
17273
|
|
|
@@ -17112,13 +17276,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
17112
17276
|
}, {
|
|
17113
17277
|
key: "renameFile",
|
|
17114
17278
|
value: function () {
|
|
17115
|
-
var _renameFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
17116
|
-
return _regenerator["default"].wrap(function
|
|
17279
|
+
var _renameFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(oldPathName, newName) {
|
|
17280
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
17117
17281
|
while (1) {
|
|
17118
|
-
switch (
|
|
17282
|
+
switch (_context6.prev = _context6.next) {
|
|
17119
17283
|
case 0:
|
|
17120
17284
|
if (!(!oldPathName || typeof oldPathName !== 'string')) {
|
|
17121
|
-
|
|
17285
|
+
_context6.next = 2;
|
|
17122
17286
|
break;
|
|
17123
17287
|
}
|
|
17124
17288
|
|
|
@@ -17126,14 +17290,14 @@ var Files = /*#__PURE__*/function () {
|
|
|
17126
17290
|
|
|
17127
17291
|
case 2:
|
|
17128
17292
|
if (!(!newName || typeof newName !== 'string')) {
|
|
17129
|
-
|
|
17293
|
+
_context6.next = 4;
|
|
17130
17294
|
break;
|
|
17131
17295
|
}
|
|
17132
17296
|
|
|
17133
17297
|
throw new Error('New File Name must be provided and must be a string.');
|
|
17134
17298
|
|
|
17135
17299
|
case 4:
|
|
17136
|
-
return
|
|
17300
|
+
return _context6.abrupt("return", this.app.request.put({
|
|
17137
17301
|
url: this.app.urls.fileRename(),
|
|
17138
17302
|
data: {
|
|
17139
17303
|
oldPathName: _utils["default"].ensureSlashInPath(oldPathName),
|
|
@@ -17143,13 +17307,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
17143
17307
|
|
|
17144
17308
|
case 5:
|
|
17145
17309
|
case "end":
|
|
17146
|
-
return
|
|
17310
|
+
return _context6.stop();
|
|
17147
17311
|
}
|
|
17148
17312
|
}
|
|
17149
|
-
},
|
|
17313
|
+
}, _callee6, this);
|
|
17150
17314
|
}));
|
|
17151
17315
|
|
|
17152
|
-
function renameFile(
|
|
17316
|
+
function renameFile(_x19, _x20) {
|
|
17153
17317
|
return _renameFile.apply(this, arguments);
|
|
17154
17318
|
}
|
|
17155
17319
|
|
|
@@ -17158,12 +17322,12 @@ var Files = /*#__PURE__*/function () {
|
|
|
17158
17322
|
}, {
|
|
17159
17323
|
key: "moveFile",
|
|
17160
17324
|
value: function () {
|
|
17161
|
-
var _moveFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
17162
|
-
return _regenerator["default"].wrap(function
|
|
17325
|
+
var _moveFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(sourcePath, targetPath) {
|
|
17326
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
17163
17327
|
while (1) {
|
|
17164
|
-
switch (
|
|
17328
|
+
switch (_context7.prev = _context7.next) {
|
|
17165
17329
|
case 0:
|
|
17166
|
-
return
|
|
17330
|
+
return _context7.abrupt("return", this.app.request.put({
|
|
17167
17331
|
url: this.app.urls.fileMove(),
|
|
17168
17332
|
data: {
|
|
17169
17333
|
sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
|
|
@@ -17173,13 +17337,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
17173
17337
|
|
|
17174
17338
|
case 1:
|
|
17175
17339
|
case "end":
|
|
17176
|
-
return
|
|
17340
|
+
return _context7.stop();
|
|
17177
17341
|
}
|
|
17178
17342
|
}
|
|
17179
|
-
},
|
|
17343
|
+
}, _callee7, this);
|
|
17180
17344
|
}));
|
|
17181
17345
|
|
|
17182
|
-
function moveFile(
|
|
17346
|
+
function moveFile(_x21, _x22) {
|
|
17183
17347
|
return _moveFile.apply(this, arguments);
|
|
17184
17348
|
}
|
|
17185
17349
|
|
|
@@ -17188,12 +17352,12 @@ var Files = /*#__PURE__*/function () {
|
|
|
17188
17352
|
}, {
|
|
17189
17353
|
key: "copyFile",
|
|
17190
17354
|
value: function () {
|
|
17191
|
-
var _copyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
17192
|
-
return _regenerator["default"].wrap(function
|
|
17355
|
+
var _copyFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(sourcePath, targetPath) {
|
|
17356
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
17193
17357
|
while (1) {
|
|
17194
|
-
switch (
|
|
17358
|
+
switch (_context8.prev = _context8.next) {
|
|
17195
17359
|
case 0:
|
|
17196
|
-
return
|
|
17360
|
+
return _context8.abrupt("return", this.app.request.put({
|
|
17197
17361
|
url: this.app.urls.fileCopy(),
|
|
17198
17362
|
data: {
|
|
17199
17363
|
sourcePath: _utils["default"].ensureSlashInPath(sourcePath),
|
|
@@ -17203,13 +17367,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
17203
17367
|
|
|
17204
17368
|
case 1:
|
|
17205
17369
|
case "end":
|
|
17206
|
-
return
|
|
17370
|
+
return _context8.stop();
|
|
17207
17371
|
}
|
|
17208
17372
|
}
|
|
17209
|
-
},
|
|
17373
|
+
}, _callee8, this);
|
|
17210
17374
|
}));
|
|
17211
17375
|
|
|
17212
|
-
function copyFile(
|
|
17376
|
+
function copyFile(_x23, _x24) {
|
|
17213
17377
|
return _copyFile.apply(this, arguments);
|
|
17214
17378
|
}
|
|
17215
17379
|
|
|
@@ -17218,13 +17382,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
17218
17382
|
}, {
|
|
17219
17383
|
key: "remove",
|
|
17220
17384
|
value: function () {
|
|
17221
|
-
var _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
17222
|
-
return _regenerator["default"].wrap(function
|
|
17385
|
+
var _remove = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(filePath) {
|
|
17386
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
17223
17387
|
while (1) {
|
|
17224
|
-
switch (
|
|
17388
|
+
switch (_context9.prev = _context9.next) {
|
|
17225
17389
|
case 0:
|
|
17226
17390
|
if (!(!filePath || typeof filePath !== 'string')) {
|
|
17227
|
-
|
|
17391
|
+
_context9.next = 2;
|
|
17228
17392
|
break;
|
|
17229
17393
|
}
|
|
17230
17394
|
|
|
@@ -17235,19 +17399,19 @@ var Files = /*#__PURE__*/function () {
|
|
|
17235
17399
|
filePath = this.app.urls.filePath(filePath);
|
|
17236
17400
|
}
|
|
17237
17401
|
|
|
17238
|
-
return
|
|
17402
|
+
return _context9.abrupt("return", this.app.request["delete"]({
|
|
17239
17403
|
url: filePath
|
|
17240
17404
|
}));
|
|
17241
17405
|
|
|
17242
17406
|
case 4:
|
|
17243
17407
|
case "end":
|
|
17244
|
-
return
|
|
17408
|
+
return _context9.stop();
|
|
17245
17409
|
}
|
|
17246
17410
|
}
|
|
17247
|
-
},
|
|
17411
|
+
}, _callee9, this);
|
|
17248
17412
|
}));
|
|
17249
17413
|
|
|
17250
|
-
function remove(
|
|
17414
|
+
function remove(_x25) {
|
|
17251
17415
|
return _remove.apply(this, arguments);
|
|
17252
17416
|
}
|
|
17253
17417
|
|
|
@@ -17256,21 +17420,21 @@ var Files = /*#__PURE__*/function () {
|
|
|
17256
17420
|
}, {
|
|
17257
17421
|
key: "exists",
|
|
17258
17422
|
value: function () {
|
|
17259
|
-
var _exists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
17260
|
-
return _regenerator["default"].wrap(function
|
|
17423
|
+
var _exists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(filePath) {
|
|
17424
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
17261
17425
|
while (1) {
|
|
17262
|
-
switch (
|
|
17426
|
+
switch (_context10.prev = _context10.next) {
|
|
17263
17427
|
case 0:
|
|
17264
17428
|
if (!(!filePath || typeof filePath !== 'string')) {
|
|
17265
|
-
|
|
17429
|
+
_context10.next = 2;
|
|
17266
17430
|
break;
|
|
17267
17431
|
}
|
|
17268
17432
|
|
|
17269
17433
|
throw new Error('"filePath" must be provided and must be a string.');
|
|
17270
17434
|
|
|
17271
17435
|
case 2:
|
|
17272
|
-
filePath = _utils["default"].
|
|
17273
|
-
return
|
|
17436
|
+
filePath = _utils["default"].trimSlashesInPath(filePath);
|
|
17437
|
+
return _context10.abrupt("return", this.app.request.get({
|
|
17274
17438
|
url: this.app.urls.filePath(filePath),
|
|
17275
17439
|
query: {
|
|
17276
17440
|
action: 'exists'
|
|
@@ -17279,13 +17443,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
17279
17443
|
|
|
17280
17444
|
case 4:
|
|
17281
17445
|
case "end":
|
|
17282
|
-
return
|
|
17446
|
+
return _context10.stop();
|
|
17283
17447
|
}
|
|
17284
17448
|
}
|
|
17285
|
-
},
|
|
17449
|
+
}, _callee10, this);
|
|
17286
17450
|
}));
|
|
17287
17451
|
|
|
17288
|
-
function exists(
|
|
17452
|
+
function exists(_x26) {
|
|
17289
17453
|
return _exists.apply(this, arguments);
|
|
17290
17454
|
}
|
|
17291
17455
|
|
|
@@ -17294,33 +17458,33 @@ var Files = /*#__PURE__*/function () {
|
|
|
17294
17458
|
}, {
|
|
17295
17459
|
key: "removeDirectory",
|
|
17296
17460
|
value: function () {
|
|
17297
|
-
var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
17298
|
-
return _regenerator["default"].wrap(function
|
|
17461
|
+
var _removeDirectory = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11(directoryPath) {
|
|
17462
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
17299
17463
|
while (1) {
|
|
17300
|
-
switch (
|
|
17464
|
+
switch (_context11.prev = _context11.next) {
|
|
17301
17465
|
case 0:
|
|
17302
17466
|
if (!(!directoryPath || typeof directoryPath !== 'string')) {
|
|
17303
|
-
|
|
17467
|
+
_context11.next = 2;
|
|
17304
17468
|
break;
|
|
17305
17469
|
}
|
|
17306
17470
|
|
|
17307
17471
|
throw new Error('Directory "path" must be provided and must be a string.');
|
|
17308
17472
|
|
|
17309
17473
|
case 2:
|
|
17310
|
-
directoryPath = _utils["default"].
|
|
17311
|
-
return
|
|
17474
|
+
directoryPath = _utils["default"].trimSlashesInPath(directoryPath);
|
|
17475
|
+
return _context11.abrupt("return", this.app.request["delete"]({
|
|
17312
17476
|
url: this.app.urls.filePath(directoryPath)
|
|
17313
17477
|
}));
|
|
17314
17478
|
|
|
17315
17479
|
case 4:
|
|
17316
17480
|
case "end":
|
|
17317
|
-
return
|
|
17481
|
+
return _context11.stop();
|
|
17318
17482
|
}
|
|
17319
17483
|
}
|
|
17320
|
-
},
|
|
17484
|
+
}, _callee11, this);
|
|
17321
17485
|
}));
|
|
17322
17486
|
|
|
17323
|
-
function removeDirectory(
|
|
17487
|
+
function removeDirectory(_x27) {
|
|
17324
17488
|
return _removeDirectory.apply(this, arguments);
|
|
17325
17489
|
}
|
|
17326
17490
|
|
|
@@ -17329,13 +17493,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
17329
17493
|
}, {
|
|
17330
17494
|
key: "getFileCount",
|
|
17331
17495
|
value: function () {
|
|
17332
|
-
var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
17333
|
-
return _regenerator["default"].wrap(function
|
|
17496
|
+
var _getFileCount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12(filesPath, pattern, sub, countDirectories) {
|
|
17497
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
17334
17498
|
while (1) {
|
|
17335
|
-
switch (
|
|
17499
|
+
switch (_context12.prev = _context12.next) {
|
|
17336
17500
|
case 0:
|
|
17337
17501
|
if (!(!filesPath || typeof filesPath !== 'string')) {
|
|
17338
|
-
|
|
17502
|
+
_context12.next = 2;
|
|
17339
17503
|
break;
|
|
17340
17504
|
}
|
|
17341
17505
|
|
|
@@ -17343,15 +17507,15 @@ var Files = /*#__PURE__*/function () {
|
|
|
17343
17507
|
|
|
17344
17508
|
case 2:
|
|
17345
17509
|
if (!(pattern && typeof pattern !== 'string')) {
|
|
17346
|
-
|
|
17510
|
+
_context12.next = 4;
|
|
17347
17511
|
break;
|
|
17348
17512
|
}
|
|
17349
17513
|
|
|
17350
17514
|
throw new Error('Files Pattern must be provided and must be a string.');
|
|
17351
17515
|
|
|
17352
17516
|
case 4:
|
|
17353
|
-
filesPath = _utils["default"].
|
|
17354
|
-
return
|
|
17517
|
+
filesPath = _utils["default"].trimSlashesInPath(filesPath);
|
|
17518
|
+
return _context12.abrupt("return", this.app.request.get({
|
|
17355
17519
|
url: this.app.urls.filePath(filesPath),
|
|
17356
17520
|
query: {
|
|
17357
17521
|
action: 'count',
|
|
@@ -17363,13 +17527,13 @@ var Files = /*#__PURE__*/function () {
|
|
|
17363
17527
|
|
|
17364
17528
|
case 6:
|
|
17365
17529
|
case "end":
|
|
17366
|
-
return
|
|
17530
|
+
return _context12.stop();
|
|
17367
17531
|
}
|
|
17368
17532
|
}
|
|
17369
|
-
},
|
|
17533
|
+
}, _callee12, this);
|
|
17370
17534
|
}));
|
|
17371
17535
|
|
|
17372
|
-
function getFileCount(
|
|
17536
|
+
function getFileCount(_x28, _x29, _x30, _x31) {
|
|
17373
17537
|
return _getFileCount.apply(this, arguments);
|
|
17374
17538
|
}
|
|
17375
17539
|
|
|
@@ -17464,11 +17628,32 @@ var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime
|
|
|
17464
17628
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
17465
17629
|
|
|
17466
17630
|
var FilesUtils = {
|
|
17631
|
+
isBytesArray: function isBytesArray(data) {
|
|
17632
|
+
if (typeof Buffer !== 'undefined' && data instanceof Buffer) {
|
|
17633
|
+
return true;
|
|
17634
|
+
}
|
|
17635
|
+
|
|
17636
|
+
if (typeof ArrayBuffer !== 'undefined' && data instanceof ArrayBuffer) {
|
|
17637
|
+
return true;
|
|
17638
|
+
}
|
|
17639
|
+
|
|
17640
|
+
return Array.isArray(data);
|
|
17641
|
+
},
|
|
17467
17642
|
ensureSlashInPath: function ensureSlashInPath(path) {
|
|
17468
17643
|
return !path.startsWith('/') ? "/".concat(path) : path;
|
|
17469
17644
|
},
|
|
17470
|
-
|
|
17471
|
-
|
|
17645
|
+
trimSlashesInPath: function trimSlashesInPath(path) {
|
|
17646
|
+
if (path) {
|
|
17647
|
+
if (path.startsWith('/')) {
|
|
17648
|
+
path = path.slice(1);
|
|
17649
|
+
}
|
|
17650
|
+
|
|
17651
|
+
if (path.endsWith('/')) {
|
|
17652
|
+
path = path.slice(0, path.length - 1);
|
|
17653
|
+
}
|
|
17654
|
+
}
|
|
17655
|
+
|
|
17656
|
+
return path;
|
|
17472
17657
|
},
|
|
17473
17658
|
parseFilePath: function parseFilePath(path) {
|
|
17474
17659
|
var result = {
|
|
@@ -21964,6 +22149,16 @@ var Urls = /*#__PURE__*/function () {
|
|
|
21964
22149
|
key: "fileBinaryPath",
|
|
21965
22150
|
value: function fileBinaryPath(path) {
|
|
21966
22151
|
return "".concat(this.files(), "/binary/").concat(path);
|
|
22152
|
+
}
|
|
22153
|
+
}, {
|
|
22154
|
+
key: "fileAppendPath",
|
|
22155
|
+
value: function fileAppendPath(path) {
|
|
22156
|
+
return "".concat(this.files(), "/append/").concat(path);
|
|
22157
|
+
}
|
|
22158
|
+
}, {
|
|
22159
|
+
key: "fileAppendBinaryPath",
|
|
22160
|
+
value: function fileAppendBinaryPath(path) {
|
|
22161
|
+
return "".concat(this.files(), "/append/binary/").concat(path);
|
|
21967
22162
|
} //users
|
|
21968
22163
|
|
|
21969
22164
|
}, {
|