files.com 1.0.213 → 1.0.215

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.
@@ -359,24 +359,22 @@ var ApiKey = /*#__PURE__*/(0, _createClass2.default)(function ApiKey() {
359
359
  return ApiKey.list(params, options);
360
360
  });
361
361
  (0, _defineProperty2.default)(ApiKey, "findCurrent", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
362
- var params,
363
- options,
362
+ var options,
364
363
  response,
365
364
  _args4 = arguments;
366
365
  return _regenerator.default.wrap(function _callee4$(_context4) {
367
366
  while (1) {
368
367
  switch (_context4.prev = _context4.next) {
369
368
  case 0:
370
- params = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
371
- options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
372
- _context4.next = 4;
373
- return _Api.default.sendRequest("/api_key", 'GET', options);
369
+ options = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
370
+ _context4.next = 3;
371
+ return _Api.default.sendRequest("/api_key", 'GET', {}, options);
374
372
 
375
- case 4:
373
+ case 3:
376
374
  response = _context4.sent;
377
375
  return _context4.abrupt("return", new ApiKey(response === null || response === void 0 ? void 0 : response.data, options));
378
376
 
379
- case 6:
377
+ case 5:
380
378
  case "end":
381
379
  return _context4.stop();
382
380
  }
@@ -563,24 +561,22 @@ var ApiKey = /*#__PURE__*/(0, _createClass2.default)(function ApiKey() {
563
561
  }, _callee7);
564
562
  })));
565
563
  (0, _defineProperty2.default)(ApiKey, "deleteCurrent", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
566
- var params,
567
- options,
564
+ var options,
568
565
  response,
569
566
  _args8 = arguments;
570
567
  return _regenerator.default.wrap(function _callee8$(_context8) {
571
568
  while (1) {
572
569
  switch (_context8.prev = _context8.next) {
573
570
  case 0:
574
- params = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
575
- options = _args8.length > 1 && _args8[1] !== undefined ? _args8[1] : {};
576
- _context8.next = 4;
577
- return _Api.default.sendRequest("/api_key", 'DELETE', options);
571
+ options = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
572
+ _context8.next = 3;
573
+ return _Api.default.sendRequest("/api_key", 'DELETE', {}, options);
578
574
 
579
- case 4:
575
+ case 3:
580
576
  response = _context8.sent;
581
577
  return _context8.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
582
578
 
583
- case 6:
579
+ case 5:
584
580
  case "end":
585
581
  return _context8.stop();
586
582
  }
@@ -50,7 +50,9 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
50
50
  var _this = this;
51
51
 
52
52
  var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
53
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
53
+
54
+ var _options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
55
+
54
56
  (0, _classCallCheck2.default)(this, File);
55
57
  (0, _defineProperty2.default)(this, "attributes", {});
56
58
  (0, _defineProperty2.default)(this, "options", {});
@@ -140,7 +142,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
140
142
  };
141
143
  }());
142
144
  (0, _defineProperty2.default)(this, "copyTo", /*#__PURE__*/function () {
143
- var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(destinationFilePath) {
145
+ var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(destinationFilePath, options) {
144
146
  var params;
145
147
  return _regenerator.default.wrap(function _callee3$(_context3) {
146
148
  while (1) {
@@ -149,7 +151,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
149
151
  params = {
150
152
  destination: destinationFilePath
151
153
  };
152
- return _context3.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params));
154
+ return _context3.abrupt("return", _Api.default.sendRequest("/file_actions/copy/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
153
155
 
154
156
  case 2:
155
157
  case "end":
@@ -159,12 +161,12 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
159
161
  }, _callee3);
160
162
  }));
161
163
 
162
- return function (_x3) {
164
+ return function (_x3, _x4) {
163
165
  return _ref3.apply(this, arguments);
164
166
  };
165
167
  }());
166
168
  (0, _defineProperty2.default)(this, "moveTo", /*#__PURE__*/function () {
167
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(destinationFilePath) {
169
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(destinationFilePath, options) {
168
170
  var params;
169
171
  return _regenerator.default.wrap(function _callee4$(_context4) {
170
172
  while (1) {
@@ -173,7 +175,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
173
175
  params = {
174
176
  destination: destinationFilePath
175
177
  };
176
- return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params));
178
+ return _context4.abrupt("return", _Api.default.sendRequest("/file_actions/move/".concat(encodeURIComponent(_this.path)), 'POST', params, options));
177
179
 
178
180
  case 2:
179
181
  case "end":
@@ -183,7 +185,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
183
185
  }, _callee4);
184
186
  }));
185
187
 
186
- return function (_x4) {
188
+ return function (_x5, _x6) {
187
189
  return _ref4.apply(this, arguments);
188
190
  };
189
191
  }());
@@ -897,10 +899,10 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
897
899
  writable: false
898
900
  });
899
901
  });
900
- this.options = _objectSpread({}, options);
902
+ this.options = _objectSpread({}, _options);
901
903
  });
902
904
  (0, _defineProperty2.default)(File, "_openUpload", /*#__PURE__*/function () {
903
- var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(path, paramsRaw) {
905
+ var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(path, paramsRaw, options) {
904
906
  var params, response, partData;
905
907
  return _regenerator.default.wrap(function _callee11$(_context11) {
906
908
  while (1) {
@@ -910,7 +912,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
910
912
  action: 'put'
911
913
  });
912
914
  _context11.next = 3;
913
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params);
915
+ return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
914
916
 
915
917
  case 3:
916
918
  response = _context11.sent;
@@ -937,12 +939,12 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
937
939
  }, _callee11);
938
940
  }));
939
941
 
940
- return function (_x5, _x6) {
942
+ return function (_x7, _x8, _x9) {
941
943
  return _ref13.apply(this, arguments);
942
944
  };
943
945
  }());
944
946
  (0, _defineProperty2.default)(File, "_continueUpload", /*#__PURE__*/function () {
945
- var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(path, partNumber, firstFileUploadPart) {
947
+ var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(path, partNumber, firstFileUploadPart, options) {
946
948
  var params, response, partData;
947
949
  return _regenerator.default.wrap(function _callee12$(_context12) {
948
950
  while (1) {
@@ -954,7 +956,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
954
956
  ref: firstFileUploadPart.ref
955
957
  };
956
958
  _context12.next = 3;
957
- return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params);
959
+ return _Api.default.sendRequest("/files/".concat(encodeURIComponent(path)), 'POST', params, options);
958
960
 
959
961
  case 3:
960
962
  response = _context12.sent;
@@ -981,12 +983,12 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
981
983
  }, _callee12);
982
984
  }));
983
985
 
984
- return function (_x7, _x8, _x9) {
986
+ return function (_x10, _x11, _x12, _x13) {
985
987
  return _ref14.apply(this, arguments);
986
988
  };
987
989
  }());
988
990
  (0, _defineProperty2.default)(File, "_completeUpload", /*#__PURE__*/function () {
989
- var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(firstFileUploadPart) {
991
+ var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(firstFileUploadPart, options) {
990
992
  var params;
991
993
  return _regenerator.default.wrap(function _callee13$(_context13) {
992
994
  while (1) {
@@ -996,7 +998,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
996
998
  action: 'end',
997
999
  ref: firstFileUploadPart.ref
998
1000
  };
999
- return _context13.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params));
1001
+ return _context13.abrupt("return", _Api.default.sendRequest("/files/".concat(encodeURIComponent(firstFileUploadPart.path)), 'POST', params, options));
1000
1002
 
1001
1003
  case 2:
1002
1004
  case "end":
@@ -1006,19 +1008,19 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1006
1008
  }, _callee13);
1007
1009
  }));
1008
1010
 
1009
- return function (_x10) {
1011
+ return function (_x14, _x15) {
1010
1012
  return _ref15.apply(this, arguments);
1011
1013
  };
1012
1014
  }());
1013
1015
  (0, _defineProperty2.default)(File, "uploadStream", /*#__PURE__*/function () {
1014
- var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(destinationPath, readableStream, params) {
1016
+ var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(destinationPath, readableStream, params, options) {
1015
1017
  var firstFileUploadPart, file;
1016
1018
  return _regenerator.default.wrap(function _callee16$(_context16) {
1017
1019
  while (1) {
1018
1020
  switch (_context16.prev = _context16.next) {
1019
1021
  case 0:
1020
1022
  _context16.next = 2;
1021
- return File._openUpload(destinationPath, params);
1023
+ return File._openUpload(destinationPath, params, options);
1022
1024
 
1023
1025
  case 2:
1024
1026
  firstFileUploadPart = _context16.sent;
@@ -1064,7 +1066,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1064
1066
  chunks.push(lastChunkForPart);
1065
1067
  buffer = _safeBuffer.Buffer.concat(chunks);
1066
1068
  _context14.next = 12;
1067
- return File._continueUpload(destinationPath, ++part, firstFileUploadPart);
1069
+ return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
1068
1070
 
1069
1071
  case 12:
1070
1072
  nextFileUploadPart = _context14.sent;
@@ -1096,7 +1098,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1096
1098
  }, _callee14, null, [[0, 23]]);
1097
1099
  }));
1098
1100
 
1099
- return function (_x14) {
1101
+ return function (_x20) {
1100
1102
  return _ref17.apply(this, arguments);
1101
1103
  };
1102
1104
  }());
@@ -1115,7 +1117,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1115
1117
 
1116
1118
  buffer = _safeBuffer.Buffer.concat(chunks);
1117
1119
  _context15.next = 5;
1118
- return File._continueUpload(destinationPath, ++part, firstFileUploadPart);
1120
+ return File._continueUpload(destinationPath, ++part, firstFileUploadPart, options);
1119
1121
 
1120
1122
  case 5:
1121
1123
  nextFileUploadPart = _context15.sent;
@@ -1127,11 +1129,11 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1127
1129
 
1128
1130
  case 9:
1129
1131
  _context15.next = 11;
1130
- return File._completeUpload(firstFileUploadPart);
1132
+ return File._completeUpload(firstFileUploadPart, options);
1131
1133
 
1132
1134
  case 11:
1133
1135
  response = _context15.sent;
1134
- createdFile = new File(response.data);
1136
+ createdFile = new File(response.data, options);
1135
1137
  resolve(createdFile);
1136
1138
  _context15.next = 19;
1137
1139
  break;
@@ -1167,12 +1169,12 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1167
1169
  }, _callee16, null, [[5, 12]]);
1168
1170
  }));
1169
1171
 
1170
- return function (_x11, _x12, _x13) {
1172
+ return function (_x16, _x17, _x18, _x19) {
1171
1173
  return _ref16.apply(this, arguments);
1172
1174
  };
1173
1175
  }());
1174
1176
  (0, _defineProperty2.default)(File, "uploadData", /*#__PURE__*/function () {
1175
- var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, data, params) {
1177
+ var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(destinationPath, data, params, options) {
1176
1178
  return _regenerator.default.wrap(function _callee17$(_context17) {
1177
1179
  while (1) {
1178
1180
  switch (_context17.prev = _context17.next) {
@@ -1185,7 +1187,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1185
1187
  throw new errors.MissingParameterError('Upload data was not provided');
1186
1188
 
1187
1189
  case 2:
1188
- return _context17.abrupt("return", File.uploadStream(destinationPath, _readableStream.default.from(data), params));
1190
+ return _context17.abrupt("return", File.uploadStream(destinationPath, _readableStream.default.from(data), params, options));
1189
1191
 
1190
1192
  case 3:
1191
1193
  case "end":
@@ -1195,12 +1197,12 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1195
1197
  }, _callee17);
1196
1198
  }));
1197
1199
 
1198
- return function (_x15, _x16, _x17) {
1200
+ return function (_x21, _x22, _x23, _x24) {
1199
1201
  return _ref19.apply(this, arguments);
1200
1202
  };
1201
1203
  }());
1202
1204
  (0, _defineProperty2.default)(File, "uploadFile", /*#__PURE__*/function () {
1203
- var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, sourceFilePath, params) {
1205
+ var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(destinationPath, sourceFilePath, params, options) {
1204
1206
  var _require3, openDiskFileReadStream, stream;
1205
1207
 
1206
1208
  return _regenerator.default.wrap(function _callee18$(_context18) {
@@ -1217,7 +1219,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1217
1219
  case 2:
1218
1220
  _require3 = require('../isomorphic/File.node.js'), openDiskFileReadStream = _require3.openDiskFileReadStream;
1219
1221
  stream = openDiskFileReadStream(sourceFilePath);
1220
- return _context18.abrupt("return", File.uploadStream(destinationPath, stream, params));
1222
+ return _context18.abrupt("return", File.uploadStream(destinationPath, stream, params, options));
1221
1223
 
1222
1224
  case 5:
1223
1225
  case "end":
@@ -1227,7 +1229,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1227
1229
  }, _callee18);
1228
1230
  }));
1229
1231
 
1230
- return function (_x18, _x19, _x20) {
1232
+ return function (_x25, _x26, _x27, _x28) {
1231
1233
  return _ref20.apply(this, arguments);
1232
1234
  };
1233
1235
  }());
@@ -1357,7 +1359,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1357
1359
  }, _callee19);
1358
1360
  }));
1359
1361
 
1360
- return function (_x21) {
1362
+ return function (_x29) {
1361
1363
  return _ref21.apply(this, arguments);
1362
1364
  };
1363
1365
  }());
@@ -1423,7 +1425,7 @@ var File = /*#__PURE__*/(0, _createClass2.default)(function File() {
1423
1425
  }, _callee20);
1424
1426
  }));
1425
1427
 
1426
- return function (_x22) {
1428
+ return function (_x30) {
1427
1429
  return _ref22.apply(this, arguments);
1428
1430
  };
1429
1431
  }());
@@ -179,24 +179,22 @@ var Session = /*#__PURE__*/(0, _createClass2.default)(function Session() {
179
179
  }, _callee);
180
180
  })));
181
181
  (0, _defineProperty2.default)(Session, "delete", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
182
- var params,
183
- options,
182
+ var options,
184
183
  response,
185
184
  _args2 = arguments;
186
185
  return _regenerator.default.wrap(function _callee2$(_context2) {
187
186
  while (1) {
188
187
  switch (_context2.prev = _context2.next) {
189
188
  case 0:
190
- params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
191
- options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
192
- _context2.next = 4;
193
- return _Api.default.sendRequest("/sessions", 'DELETE', options);
189
+ options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
190
+ _context2.next = 3;
191
+ return _Api.default.sendRequest("/sessions", 'DELETE', {}, options);
194
192
 
195
- case 4:
193
+ case 3:
196
194
  response = _context2.sent;
197
195
  return _context2.abrupt("return", response === null || response === void 0 ? void 0 : response.data);
198
196
 
199
- case 6:
197
+ case 5:
200
198
  case "end":
201
199
  return _context2.stop();
202
200
  }
@@ -460,24 +460,22 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
460
460
  this.options = _objectSpread({}, options);
461
461
  });
462
462
  (0, _defineProperty2.default)(Site, "get", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
463
- var params,
464
- options,
463
+ var options,
465
464
  response,
466
465
  _args = arguments;
467
466
  return _regenerator.default.wrap(function _callee$(_context) {
468
467
  while (1) {
469
468
  switch (_context.prev = _context.next) {
470
469
  case 0:
471
- params = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
472
- options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
473
- _context.next = 4;
474
- return _Api.default.sendRequest("/site", 'GET', options);
470
+ options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
471
+ _context.next = 3;
472
+ return _Api.default.sendRequest("/site", 'GET', {}, options);
475
473
 
476
- case 4:
474
+ case 3:
477
475
  response = _context.sent;
478
476
  return _context.abrupt("return", new Site(response === null || response === void 0 ? void 0 : response.data, options));
479
477
 
480
- case 6:
478
+ case 5:
481
479
  case "end":
482
480
  return _context.stop();
483
481
  }
@@ -485,24 +483,22 @@ var Site = /*#__PURE__*/(0, _createClass2.default)(function Site() {
485
483
  }, _callee);
486
484
  })));
487
485
  (0, _defineProperty2.default)(Site, "getUsage", /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
488
- var params,
489
- options,
486
+ var options,
490
487
  response,
491
488
  _args2 = arguments;
492
489
  return _regenerator.default.wrap(function _callee2$(_context2) {
493
490
  while (1) {
494
491
  switch (_context2.prev = _context2.next) {
495
492
  case 0:
496
- params = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
497
- options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
498
- _context2.next = 4;
499
- return _Api.default.sendRequest("/site/usage", 'GET', options);
493
+ options = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {};
494
+ _context2.next = 3;
495
+ return _Api.default.sendRequest("/site/usage", 'GET', {}, options);
500
496
 
501
- case 4:
497
+ case 3:
502
498
  response = _context2.sent;
503
499
  return _context2.abrupt("return", new UsageSnapshot(response === null || response === void 0 ? void 0 : response.data, options));
504
500
 
505
- case 6:
501
+ case 5:
506
502
  case "end":
507
503
  return _context2.stop();
508
504
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "files.com",
3
- "version": "1.0.213",
3
+ "version": "1.0.215",
4
4
  "description": "Files.com SDK for JavaScript",
5
5
  "keywords": [
6
6
  "files.com",
package/src/Api.js CHANGED
@@ -37,7 +37,14 @@ class Api {
37
37
  : `${baseUrl}${Files.getEndpointPrefix()}${path}`
38
38
 
39
39
  Logger.debug(`Sending request: ${verb} ${url}`)
40
- Logger.debug('Sending options:', options)
40
+
41
+ Logger.debug('Sending options:', {
42
+ ...options,
43
+ headers: {
44
+ ...options.headers,
45
+ 'X-FilesAPI-Key': '<redacted>',
46
+ },
47
+ })
41
48
 
42
49
  Api._configureAutoRetry()
43
50
 
@@ -78,7 +85,7 @@ class Api {
78
85
  }
79
86
 
80
87
  static _autoPaginate = async (path, verb, params, options, response, metadata) => {
81
- if (Files.getAutoPaginate()) {
88
+ if (options.autoPaginate ?? Files.getAutoPaginate()) {
82
89
  const nextCursor = response?.headers?.['x-files-cursor']
83
90
 
84
91
  const {
package/src/Errors.js CHANGED
@@ -94,6 +94,7 @@ export class BadRequest_DestinationSameError extends BadRequestError { construct
94
94
  export class BadRequest_FolderMustNotBeAFileError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_FolderMustNotBeAFileError' } } errorClasses.BadRequest_FolderMustNotBeAFileError = BadRequest_FolderMustNotBeAFileError
95
95
  export class BadRequest_InvalidBodyError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidBodyError' } } errorClasses.BadRequest_InvalidBodyError = BadRequest_InvalidBodyError
96
96
  export class BadRequest_InvalidCursorError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidCursorError' } } errorClasses.BadRequest_InvalidCursorError = BadRequest_InvalidCursorError
97
+ export class BadRequest_InvalidCursorTypeForSortError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidCursorTypeForSortError' } } errorClasses.BadRequest_InvalidCursorTypeForSortError = BadRequest_InvalidCursorTypeForSortError
97
98
  export class BadRequest_InvalidEtagsError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidEtagsError' } } errorClasses.BadRequest_InvalidEtagsError = BadRequest_InvalidEtagsError
98
99
  export class BadRequest_InvalidFilterCombinationError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidFilterCombinationError' } } errorClasses.BadRequest_InvalidFilterCombinationError = BadRequest_InvalidFilterCombinationError
99
100
  export class BadRequest_InvalidFilterFieldError extends BadRequestError { constructor(message, code) { super(message, code); this.name = 'BadRequest_InvalidFilterFieldError' } } errorClasses.BadRequest_InvalidFilterFieldError = BadRequest_InvalidFilterFieldError
@@ -209,8 +209,8 @@ class ApiKey {
209
209
  static all = (params = {}, options = {}) =>
210
210
  ApiKey.list(params, options)
211
211
 
212
- static findCurrent = async (params = {}, options = {}) => {
213
- const response = await Api.sendRequest(`/api_key`, 'GET', options)
212
+ static findCurrent = async (options = {}) => {
213
+ const response = await Api.sendRequest(`/api_key`, 'GET', {}, options)
214
214
 
215
215
  return new ApiKey(response?.data, options)
216
216
  }
@@ -294,8 +294,8 @@ class ApiKey {
294
294
  return new ApiKey(response?.data, options)
295
295
  }
296
296
 
297
- static deleteCurrent = async (params = {}, options = {}) => {
298
- const response = await Api.sendRequest(`/api_key`, 'DELETE', options)
297
+ static deleteCurrent = async (options = {}) => {
298
+ const response = await Api.sendRequest(`/api_key`, 'DELETE', {}, options)
299
299
 
300
300
  return response?.data
301
301
  }
@@ -28,9 +28,9 @@ class File {
28
28
  }
29
29
 
30
30
  isLoaded = () => !!this.attributes.path
31
- static _openUpload = async (path, paramsRaw) => {
31
+ static _openUpload = async (path, paramsRaw, options) => {
32
32
  const params = { ...paramsRaw, action: 'put' }
33
- const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'POST', params)
33
+ const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'POST', params, options)
34
34
 
35
35
  if (!response) {
36
36
  return null
@@ -45,14 +45,14 @@ class File {
45
45
  return new FileUploadPart(partData)
46
46
  }
47
47
 
48
- static _continueUpload = async (path, partNumber, firstFileUploadPart) => {
48
+ static _continueUpload = async (path, partNumber, firstFileUploadPart, options) => {
49
49
  const params = {
50
50
  action: 'put',
51
51
  part: partNumber,
52
52
  ref: firstFileUploadPart.ref,
53
53
  }
54
54
 
55
- const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'POST', params)
55
+ const response = await Api.sendRequest(`/files/${encodeURIComponent(path)}`, 'POST', params, options)
56
56
 
57
57
  if (!response) {
58
58
  return null
@@ -67,20 +67,20 @@ class File {
67
67
  return new FileUploadPart(partData)
68
68
  }
69
69
 
70
- static _completeUpload = async firstFileUploadPart => {
70
+ static _completeUpload = async (firstFileUploadPart, options) => {
71
71
  const params = {
72
72
  action: 'end',
73
73
  ref: firstFileUploadPart.ref,
74
74
  }
75
75
 
76
- return Api.sendRequest(`/files/${encodeURIComponent(firstFileUploadPart.path)}`, 'POST', params)
76
+ return Api.sendRequest(`/files/${encodeURIComponent(firstFileUploadPart.path)}`, 'POST', params, options)
77
77
  }
78
78
 
79
79
  /**
80
80
  * @note see File.copy() for list of supported params
81
81
  */
82
- static uploadStream = async (destinationPath, readableStream, params) => {
83
- const firstFileUploadPart = await File._openUpload(destinationPath, params)
82
+ static uploadStream = async (destinationPath, readableStream, params, options) => {
83
+ const firstFileUploadPart = await File._openUpload(destinationPath, params, options)
84
84
 
85
85
  if (!firstFileUploadPart) {
86
86
  return
@@ -111,7 +111,7 @@ class File {
111
111
  chunks.push(lastChunkForPart)
112
112
 
113
113
  const buffer = Buffer.concat(chunks)
114
- const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart)
114
+ const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart, options)
115
115
 
116
116
  concurrentUploads.push(Api.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer))
117
117
 
@@ -132,15 +132,15 @@ class File {
132
132
  try {
133
133
  if (chunks.length > 0) {
134
134
  const buffer = Buffer.concat(chunks)
135
- const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart)
135
+ const nextFileUploadPart = await File._continueUpload(destinationPath, ++part, firstFileUploadPart, options)
136
136
 
137
137
  concurrentUploads.push(Api.sendFilePart(nextFileUploadPart.upload_uri, 'PUT', buffer))
138
138
  }
139
139
 
140
140
  await Promise.all(concurrentUploads)
141
141
 
142
- const response = await File._completeUpload(firstFileUploadPart)
143
- const createdFile = new File(response.data)
142
+ const response = await File._completeUpload(firstFileUploadPart, options)
143
+ const createdFile = new File(response.data, options)
144
144
 
145
145
  resolve(createdFile)
146
146
  } catch (error) {
@@ -159,18 +159,18 @@ class File {
159
159
  * data - string, Buffer, Stream, any object implementing Symbol.iterator or Symbol.asyncIterator
160
160
  * @note see File.copy() for list of supported params
161
161
  */
162
- static uploadData = async (destinationPath, data, params) => {
162
+ static uploadData = async (destinationPath, data, params, options) => {
163
163
  if (!data) {
164
164
  throw new errors.MissingParameterError('Upload data was not provided')
165
165
  }
166
166
 
167
- return File.uploadStream(destinationPath, Readable.from(data), params)
167
+ return File.uploadStream(destinationPath, Readable.from(data), params, options)
168
168
  }
169
169
 
170
170
  /**
171
171
  * @note see File.copy() for list of supported params
172
172
  */
173
- static uploadFile = async (destinationPath, sourceFilePath, params) => {
173
+ static uploadFile = async (destinationPath, sourceFilePath, params, options) => {
174
174
  if (isBrowser()) {
175
175
  throw new errors.NotImplementedError('Disk file uploads are only available in a NodeJS environment')
176
176
  }
@@ -178,7 +178,7 @@ class File {
178
178
  const { openDiskFileReadStream } = require('../isomorphic/File.node.js')
179
179
  const stream = openDiskFileReadStream(sourceFilePath)
180
180
 
181
- return File.uploadStream(destinationPath, stream, params)
181
+ return File.uploadStream(destinationPath, stream, params, options)
182
182
  }
183
183
 
184
184
  downloadToStream = async writableStream => {
@@ -211,14 +211,14 @@ class File {
211
211
  return saveUrlToFile(downloadUri, destinationPath)
212
212
  }
213
213
 
214
- copyTo = async destinationFilePath => {
214
+ copyTo = async (destinationFilePath, options) => {
215
215
  const params = { destination: destinationFilePath }
216
- return Api.sendRequest(`/file_actions/copy/${encodeURIComponent(this.path)}`, 'POST', params)
216
+ return Api.sendRequest(`/file_actions/copy/${encodeURIComponent(this.path)}`, 'POST', params, options)
217
217
  }
218
218
 
219
- moveTo = async destinationFilePath => {
219
+ moveTo = async (destinationFilePath, options) => {
220
220
  const params = { destination: destinationFilePath }
221
- return Api.sendRequest(`/file_actions/move/${encodeURIComponent(this.path)}`, 'POST', params)
221
+ return Api.sendRequest(`/file_actions/move/${encodeURIComponent(this.path)}`, 'POST', params, options)
222
222
  }
223
223
 
224
224
  // string # File/Folder path This must be slash-delimited, but it must neither start nor end with a slash. Maximum of 5000 characters.
@@ -117,8 +117,8 @@ class Session {
117
117
  return new Session(response?.data, options)
118
118
  }
119
119
 
120
- static delete = async (params = {}, options = {}) => {
121
- const response = await Api.sendRequest(`/sessions`, 'DELETE', options)
120
+ static delete = async (options = {}) => {
121
+ const response = await Api.sendRequest(`/sessions`, 'DELETE', {}, options)
122
122
 
123
123
  return response?.data
124
124
  }
@@ -420,14 +420,14 @@ class Site {
420
420
  getDisableUsersFromInactivityPeriodDays = () => this.attributes.disable_users_from_inactivity_period_days
421
421
 
422
422
 
423
- static get = async (params = {}, options = {}) => {
424
- const response = await Api.sendRequest(`/site`, 'GET', options)
423
+ static get = async (options = {}) => {
424
+ const response = await Api.sendRequest(`/site`, 'GET', {}, options)
425
425
 
426
426
  return new Site(response?.data, options)
427
427
  }
428
428
 
429
- static getUsage = async (params = {}, options = {}) => {
430
- const response = await Api.sendRequest(`/site/usage`, 'GET', options)
429
+ static getUsage = async (options = {}) => {
430
+ const response = await Api.sendRequest(`/site/usage`, 'GET', {}, options)
431
431
 
432
432
  return new UsageSnapshot(response?.data, options)
433
433
  }