@eluvio/elv-client-js 4.0.42 → 4.0.44

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.
@@ -991,7 +991,7 @@ exports.CreateFileDirectories = /*#__PURE__*/function () {
991
991
  }();
992
992
 
993
993
  /**
994
- * Delete the specified list of files/directories
994
+ * Move or rename the specified list of files/directories
995
995
  *
996
996
  * @memberof module:ElvClient/Files+Parts
997
997
  * @methodGroup Files
@@ -999,9 +999,9 @@ exports.CreateFileDirectories = /*#__PURE__*/function () {
999
999
  * @param {string} libraryId - ID of the library
1000
1000
  * @param {string} objectId - ID of the object
1001
1001
  * @param {string} writeToken - Write token of the draft
1002
- * @param {Array<string>} filePaths - List of file paths to delete
1002
+ * @param {Array<string>} filePaths - List of file paths to move. Format: ```[ { "path": "original/path", to: "new/path" } ]```
1003
1003
  */
1004
- exports.DeleteFiles = /*#__PURE__*/function () {
1004
+ exports.MoveFiles = /*#__PURE__*/function () {
1005
1005
  var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee13(_ref22) {
1006
1006
  var libraryId, objectId, writeToken, filePaths, ops;
1007
1007
  return _regeneratorRuntime.wrap(function _callee13$(_context14) {
@@ -1013,12 +1013,15 @@ exports.DeleteFiles = /*#__PURE__*/function () {
1013
1013
  objectId: objectId
1014
1014
  });
1015
1015
  ValidateWriteToken(writeToken);
1016
- this.Log("Deleting Files: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken));
1016
+ this.Log("Moving Files: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken));
1017
1017
  this.Log(filePaths);
1018
- ops = filePaths.map(function (path) {
1018
+ ops = filePaths.map(function (_ref24) {
1019
+ var path = _ref24.path,
1020
+ to = _ref24.to;
1019
1021
  return {
1020
- op: "del",
1021
- path: path
1022
+ op: "move",
1023
+ copy_move_source_path: path,
1024
+ path: to
1022
1025
  };
1023
1026
  });
1024
1027
  _context14.next = 8;
@@ -1039,6 +1042,55 @@ exports.DeleteFiles = /*#__PURE__*/function () {
1039
1042
  };
1040
1043
  }();
1041
1044
 
1045
+ /**
1046
+ * Delete the specified list of files/directories
1047
+ *
1048
+ * @memberof module:ElvClient/Files+Parts
1049
+ * @methodGroup Files
1050
+ * @namedParams
1051
+ * @param {string} libraryId - ID of the library
1052
+ * @param {string} objectId - ID of the object
1053
+ * @param {string} writeToken - Write token of the draft
1054
+ * @param {Array<string>} filePaths - List of file paths to delete
1055
+ */
1056
+ exports.DeleteFiles = /*#__PURE__*/function () {
1057
+ var _ref26 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref25) {
1058
+ var libraryId, objectId, writeToken, filePaths, ops;
1059
+ return _regeneratorRuntime.wrap(function _callee14$(_context15) {
1060
+ while (1) switch (_context15.prev = _context15.next) {
1061
+ case 0:
1062
+ libraryId = _ref25.libraryId, objectId = _ref25.objectId, writeToken = _ref25.writeToken, filePaths = _ref25.filePaths;
1063
+ ValidateParameters({
1064
+ libraryId: libraryId,
1065
+ objectId: objectId
1066
+ });
1067
+ ValidateWriteToken(writeToken);
1068
+ this.Log("Deleting Files: ".concat(libraryId, " ").concat(objectId, " ").concat(writeToken));
1069
+ this.Log(filePaths);
1070
+ ops = filePaths.map(function (path) {
1071
+ return {
1072
+ op: "del",
1073
+ path: path
1074
+ };
1075
+ });
1076
+ _context15.next = 8;
1077
+ return this.CreateFileUploadJob({
1078
+ libraryId: libraryId,
1079
+ objectId: objectId,
1080
+ writeToken: writeToken,
1081
+ ops: ops
1082
+ });
1083
+ case 8:
1084
+ case "end":
1085
+ return _context15.stop();
1086
+ }
1087
+ }, _callee14, this);
1088
+ }));
1089
+ return function (_x15) {
1090
+ return _ref26.apply(this, arguments);
1091
+ };
1092
+ }();
1093
+
1042
1094
  /**
1043
1095
  * Download a file from a content object
1044
1096
  *
@@ -1064,18 +1116,18 @@ exports.DeleteFiles = /*#__PURE__*/function () {
1064
1116
  * @returns {Promise<ArrayBuffer> | undefined} - No return if chunked is specified, file data in the requested format otherwise
1065
1117
  */
1066
1118
  exports.DownloadFile = /*#__PURE__*/function () {
1067
- var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee14(_ref24) {
1119
+ var _ref28 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref27) {
1068
1120
  var libraryId,
1069
1121
  objectId,
1070
1122
  versionHash,
1071
1123
  writeToken,
1072
1124
  filePath,
1073
- _ref24$format,
1125
+ _ref27$format,
1074
1126
  format,
1075
- _ref24$chunked,
1127
+ _ref27$chunked,
1076
1128
  chunked,
1077
1129
  chunkSize,
1078
- _ref24$clientSideDecr,
1130
+ _ref27$clientSideDecr,
1079
1131
  clientSideDecryption,
1080
1132
  callback,
1081
1133
  fileInfo,
@@ -1086,11 +1138,11 @@ exports.DownloadFile = /*#__PURE__*/function () {
1086
1138
  ownerCapKey,
1087
1139
  ownerCap,
1088
1140
  bytesTotal,
1089
- _args15 = arguments;
1090
- return _regeneratorRuntime.wrap(function _callee14$(_context15) {
1091
- while (1) switch (_context15.prev = _context15.next) {
1141
+ _args16 = arguments;
1142
+ return _regeneratorRuntime.wrap(function _callee15$(_context16) {
1143
+ while (1) switch (_context16.prev = _context16.next) {
1092
1144
  case 0:
1093
- libraryId = _ref24.libraryId, objectId = _ref24.objectId, versionHash = _ref24.versionHash, writeToken = _ref24.writeToken, filePath = _ref24.filePath, _ref24$format = _ref24.format, format = _ref24$format === void 0 ? "arrayBuffer" : _ref24$format, _ref24$chunked = _ref24.chunked, chunked = _ref24$chunked === void 0 ? false : _ref24$chunked, chunkSize = _ref24.chunkSize, _ref24$clientSideDecr = _ref24.clientSideDecryption, clientSideDecryption = _ref24$clientSideDecr === void 0 ? false : _ref24$clientSideDecr, callback = _ref24.callback;
1145
+ libraryId = _ref27.libraryId, objectId = _ref27.objectId, versionHash = _ref27.versionHash, writeToken = _ref27.writeToken, filePath = _ref27.filePath, _ref27$format = _ref27.format, format = _ref27$format === void 0 ? "arrayBuffer" : _ref27$format, _ref27$chunked = _ref27.chunked, chunked = _ref27$chunked === void 0 ? false : _ref27$chunked, chunkSize = _ref27.chunkSize, _ref27$clientSideDecr = _ref27.clientSideDecryption, clientSideDecryption = _ref27$clientSideDecr === void 0 ? false : _ref27$clientSideDecr, callback = _ref27.callback;
1094
1146
  ValidateParameters({
1095
1147
  libraryId: libraryId,
1096
1148
  objectId: objectId,
@@ -1100,7 +1152,7 @@ exports.DownloadFile = /*#__PURE__*/function () {
1100
1152
  if (versionHash) {
1101
1153
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1102
1154
  }
1103
- _context15.next = 6;
1155
+ _context16.next = 6;
1104
1156
  return this.ContentObjectMetadata({
1105
1157
  libraryId: libraryId,
1106
1158
  objectId: objectId,
@@ -1109,11 +1161,11 @@ exports.DownloadFile = /*#__PURE__*/function () {
1109
1161
  metadataSubtree: UrlJoin("files", filePath)
1110
1162
  });
1111
1163
  case 6:
1112
- fileInfo = _context15.sent;
1164
+ fileInfo = _context16.sent;
1113
1165
  encrypted = fileInfo && fileInfo["."].encryption && fileInfo["."].encryption.scheme === "cgck";
1114
1166
  encryption = encrypted ? "cgck" : undefined;
1115
1167
  path = encrypted && !clientSideDecryption ? UrlJoin("q", writeToken || versionHash || objectId, "rep", "files_download", filePath) : UrlJoin("q", writeToken || versionHash || objectId, "files", filePath);
1116
- _context15.next = 12;
1168
+ _context16.next = 12;
1117
1169
  return this.authClient.AuthorizationHeader({
1118
1170
  libraryId: libraryId,
1119
1171
  objectId: objectId,
@@ -1122,12 +1174,12 @@ exports.DownloadFile = /*#__PURE__*/function () {
1122
1174
  makeAccessRequest: encryption === "cgck"
1123
1175
  });
1124
1176
  case 12:
1125
- headers = _context15.sent;
1177
+ headers = _context16.sent;
1126
1178
  headers.Accept = "*/*";
1127
1179
 
1128
1180
  // If not owner, indicate re-encryption
1129
1181
  ownerCapKey = "eluv.caps.iusr".concat(this.utils.AddressToHash(this.signer.address));
1130
- _context15.next = 17;
1182
+ _context16.next = 17;
1131
1183
  return this.ContentObjectMetadata({
1132
1184
  libraryId: libraryId,
1133
1185
  objectId: objectId,
@@ -1135,31 +1187,31 @@ exports.DownloadFile = /*#__PURE__*/function () {
1135
1187
  metadataSubtree: ownerCapKey
1136
1188
  });
1137
1189
  case 17:
1138
- ownerCap = _context15.sent;
1139
- _context15.t1 = encrypted;
1140
- if (!_context15.t1) {
1141
- _context15.next = 26;
1190
+ ownerCap = _context16.sent;
1191
+ _context16.t1 = encrypted;
1192
+ if (!_context16.t1) {
1193
+ _context16.next = 26;
1142
1194
  break;
1143
1195
  }
1144
- _context15.t2 = this.utils;
1145
- _context15.t3 = this.signer.address;
1146
- _context15.next = 24;
1196
+ _context16.t2 = this.utils;
1197
+ _context16.t3 = this.signer.address;
1198
+ _context16.next = 24;
1147
1199
  return this.ContentObjectOwner({
1148
1200
  objectId: objectId
1149
1201
  });
1150
1202
  case 24:
1151
- _context15.t4 = _context15.sent;
1152
- _context15.t1 = !_context15.t2.EqualAddress.call(_context15.t2, _context15.t3, _context15.t4);
1203
+ _context16.t4 = _context16.sent;
1204
+ _context16.t1 = !_context16.t2.EqualAddress.call(_context16.t2, _context16.t3, _context16.t4);
1153
1205
  case 26:
1154
- _context15.t0 = _context15.t1;
1155
- if (!_context15.t0) {
1156
- _context15.next = 29;
1206
+ _context16.t0 = _context16.t1;
1207
+ if (!_context16.t0) {
1208
+ _context16.next = 29;
1157
1209
  break;
1158
1210
  }
1159
- _context15.t0 = !ownerCap;
1211
+ _context16.t0 = !ownerCap;
1160
1212
  case 29:
1161
- if (!_context15.t0) {
1162
- _context15.next = 31;
1213
+ if (!_context16.t0) {
1214
+ _context16.next = 31;
1163
1215
  break;
1164
1216
  }
1165
1217
  headers["X-Content-Fabric-Decryption-Mode"] = "reencrypt";
@@ -1172,11 +1224,11 @@ exports.DownloadFile = /*#__PURE__*/function () {
1172
1224
  }
1173
1225
  bytesTotal = fileInfo["."].size;
1174
1226
  if (!(encrypted && clientSideDecryption)) {
1175
- _context15.next = 51;
1227
+ _context16.next = 51;
1176
1228
  break;
1177
1229
  }
1178
- _context15.t5 = this;
1179
- _context15.next = 37;
1230
+ _context16.t5 = this;
1231
+ _context16.next = 37;
1180
1232
  return this.EncryptionConk({
1181
1233
  libraryId: libraryId,
1182
1234
  objectId: objectId,
@@ -1184,34 +1236,34 @@ exports.DownloadFile = /*#__PURE__*/function () {
1184
1236
  download: true
1185
1237
  });
1186
1238
  case 37:
1187
- _context15.t6 = _context15.sent;
1188
- _context15.t7 = path;
1189
- _context15.t8 = bytesTotal;
1190
- _context15.t9 = headers;
1191
- _context15.t10 = callback;
1192
- _context15.t11 = format;
1193
- _context15.t12 = clientSideDecryption;
1194
- _context15.t13 = chunked;
1195
- _context15.t14 = {
1196
- conk: _context15.t6,
1197
- downloadPath: _context15.t7,
1198
- bytesTotal: _context15.t8,
1199
- headers: _context15.t9,
1200
- callback: _context15.t10,
1201
- format: _context15.t11,
1202
- clientSideDecryption: _context15.t12,
1203
- chunked: _context15.t13
1239
+ _context16.t6 = _context16.sent;
1240
+ _context16.t7 = path;
1241
+ _context16.t8 = bytesTotal;
1242
+ _context16.t9 = headers;
1243
+ _context16.t10 = callback;
1244
+ _context16.t11 = format;
1245
+ _context16.t12 = clientSideDecryption;
1246
+ _context16.t13 = chunked;
1247
+ _context16.t14 = {
1248
+ conk: _context16.t6,
1249
+ downloadPath: _context16.t7,
1250
+ bytesTotal: _context16.t8,
1251
+ headers: _context16.t9,
1252
+ callback: _context16.t10,
1253
+ format: _context16.t11,
1254
+ clientSideDecryption: _context16.t12,
1255
+ chunked: _context16.t13
1204
1256
  };
1205
- _context15.next = 48;
1206
- return _context15.t5.DownloadEncrypted.call(_context15.t5, _context15.t14);
1257
+ _context16.next = 48;
1258
+ return _context16.t5.DownloadEncrypted.call(_context16.t5, _context16.t14);
1207
1259
  case 48:
1208
- return _context15.abrupt("return", _context15.sent);
1260
+ return _context16.abrupt("return", _context16.sent);
1209
1261
  case 51:
1210
1262
  if (!chunkSize) {
1211
1263
  chunkSize = 10000000;
1212
1264
  }
1213
- _context15.prev = 52;
1214
- _context15.next = 55;
1265
+ _context16.prev = 52;
1266
+ _context16.next = 55;
1215
1267
  return this.Download({
1216
1268
  downloadPath: path,
1217
1269
  bytesTotal: bytesTotal,
@@ -1222,27 +1274,27 @@ exports.DownloadFile = /*#__PURE__*/function () {
1222
1274
  chunkSize: chunkSize
1223
1275
  });
1224
1276
  case 55:
1225
- return _context15.abrupt("return", _context15.sent);
1277
+ return _context16.abrupt("return", _context16.sent);
1226
1278
  case 58:
1227
- _context15.prev = 58;
1228
- _context15.t15 = _context15["catch"](52);
1279
+ _context16.prev = 58;
1280
+ _context16.t15 = _context16["catch"](52);
1229
1281
  if (!(encrypted && !clientSideDecryption)) {
1230
- _context15.next = 62;
1282
+ _context16.next = 62;
1231
1283
  break;
1232
1284
  }
1233
- return _context15.abrupt("return", this.DownloadFile(_objectSpread(_objectSpread({}, _args15[0]), {}, {
1285
+ return _context16.abrupt("return", this.DownloadFile(_objectSpread(_objectSpread({}, _args16[0]), {}, {
1234
1286
  clientSideDecryption: true
1235
1287
  })));
1236
1288
  case 62:
1237
- throw _context15.t15;
1289
+ throw _context16.t15;
1238
1290
  case 63:
1239
1291
  case "end":
1240
- return _context15.stop();
1292
+ return _context16.stop();
1241
1293
  }
1242
- }, _callee14, this, [[52, 58]]);
1294
+ }, _callee15, this, [[52, 58]]);
1243
1295
  }));
1244
- return function (_x15) {
1245
- return _ref25.apply(this, arguments);
1296
+ return function (_x16) {
1297
+ return _ref28.apply(this, arguments);
1246
1298
  };
1247
1299
  }();
1248
1300
 
@@ -1261,12 +1313,12 @@ exports.DownloadFile = /*#__PURE__*/function () {
1261
1313
  * @returns {Promise<Object>} - Response containing list of parts of the object
1262
1314
  */
1263
1315
  exports.ContentParts = /*#__PURE__*/function () {
1264
- var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee15(_ref26) {
1316
+ var _ref30 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref29) {
1265
1317
  var libraryId, objectId, versionHash, path, response;
1266
- return _regeneratorRuntime.wrap(function _callee15$(_context16) {
1267
- while (1) switch (_context16.prev = _context16.next) {
1318
+ return _regeneratorRuntime.wrap(function _callee16$(_context17) {
1319
+ while (1) switch (_context17.prev = _context17.next) {
1268
1320
  case 0:
1269
- libraryId = _ref26.libraryId, objectId = _ref26.objectId, versionHash = _ref26.versionHash;
1321
+ libraryId = _ref29.libraryId, objectId = _ref29.objectId, versionHash = _ref29.versionHash;
1270
1322
  ValidateParameters({
1271
1323
  libraryId: libraryId,
1272
1324
  objectId: objectId,
@@ -1277,36 +1329,36 @@ exports.ContentParts = /*#__PURE__*/function () {
1277
1329
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1278
1330
  }
1279
1331
  path = UrlJoin("q", versionHash || objectId, "parts");
1280
- _context16.t0 = this.utils;
1281
- _context16.t1 = this.HttpClient;
1282
- _context16.next = 9;
1332
+ _context17.t0 = this.utils;
1333
+ _context17.t1 = this.HttpClient;
1334
+ _context17.next = 9;
1283
1335
  return this.authClient.AuthorizationHeader({
1284
1336
  libraryId: libraryId,
1285
1337
  objectId: objectId,
1286
1338
  versionHash: versionHash
1287
1339
  });
1288
1340
  case 9:
1289
- _context16.t2 = _context16.sent;
1290
- _context16.t3 = path;
1291
- _context16.t4 = {
1292
- headers: _context16.t2,
1341
+ _context17.t2 = _context17.sent;
1342
+ _context17.t3 = path;
1343
+ _context17.t4 = {
1344
+ headers: _context17.t2,
1293
1345
  method: "GET",
1294
- path: _context16.t3
1346
+ path: _context17.t3
1295
1347
  };
1296
- _context16.t5 = _context16.t1.Request.call(_context16.t1, _context16.t4);
1297
- _context16.next = 15;
1298
- return _context16.t0.ResponseToJson.call(_context16.t0, _context16.t5);
1348
+ _context17.t5 = _context17.t1.Request.call(_context17.t1, _context17.t4);
1349
+ _context17.next = 15;
1350
+ return _context17.t0.ResponseToJson.call(_context17.t0, _context17.t5);
1299
1351
  case 15:
1300
- response = _context16.sent;
1301
- return _context16.abrupt("return", response.parts);
1352
+ response = _context17.sent;
1353
+ return _context17.abrupt("return", response.parts);
1302
1354
  case 17:
1303
1355
  case "end":
1304
- return _context16.stop();
1356
+ return _context17.stop();
1305
1357
  }
1306
- }, _callee15, this);
1358
+ }, _callee16, this);
1307
1359
  }));
1308
- return function (_x16) {
1309
- return _ref27.apply(this, arguments);
1360
+ return function (_x17) {
1361
+ return _ref30.apply(this, arguments);
1310
1362
  };
1311
1363
  }();
1312
1364
 
@@ -1324,12 +1376,12 @@ exports.ContentParts = /*#__PURE__*/function () {
1324
1376
  * @returns {Promise<Object>} - Response containing information about the specified part
1325
1377
  */
1326
1378
  exports.ContentPart = /*#__PURE__*/function () {
1327
- var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee16(_ref28) {
1379
+ var _ref32 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref31) {
1328
1380
  var libraryId, objectId, versionHash, partHash, path;
1329
- return _regeneratorRuntime.wrap(function _callee16$(_context17) {
1330
- while (1) switch (_context17.prev = _context17.next) {
1381
+ return _regeneratorRuntime.wrap(function _callee17$(_context18) {
1382
+ while (1) switch (_context18.prev = _context18.next) {
1331
1383
  case 0:
1332
- libraryId = _ref28.libraryId, objectId = _ref28.objectId, versionHash = _ref28.versionHash, partHash = _ref28.partHash;
1384
+ libraryId = _ref31.libraryId, objectId = _ref31.objectId, versionHash = _ref31.versionHash, partHash = _ref31.partHash;
1333
1385
  ValidateParameters({
1334
1386
  libraryId: libraryId,
1335
1387
  objectId: objectId,
@@ -1341,35 +1393,35 @@ exports.ContentPart = /*#__PURE__*/function () {
1341
1393
  objectId = this.utils.DecodeVersionHash(versionHash).objectId;
1342
1394
  }
1343
1395
  path = UrlJoin("q", versionHash || objectId, "parts", partHash);
1344
- _context17.t0 = this.utils;
1345
- _context17.t1 = this.HttpClient;
1346
- _context17.next = 10;
1396
+ _context18.t0 = this.utils;
1397
+ _context18.t1 = this.HttpClient;
1398
+ _context18.next = 10;
1347
1399
  return this.authClient.AuthorizationHeader({
1348
1400
  libraryId: libraryId,
1349
1401
  objectId: objectId,
1350
1402
  versionHash: versionHash
1351
1403
  });
1352
1404
  case 10:
1353
- _context17.t2 = _context17.sent;
1354
- _context17.t3 = path;
1355
- _context17.t4 = {
1356
- headers: _context17.t2,
1405
+ _context18.t2 = _context18.sent;
1406
+ _context18.t3 = path;
1407
+ _context18.t4 = {
1408
+ headers: _context18.t2,
1357
1409
  method: "GET",
1358
- path: _context17.t3
1410
+ path: _context18.t3
1359
1411
  };
1360
- _context17.t5 = _context17.t1.Request.call(_context17.t1, _context17.t4);
1361
- _context17.next = 16;
1362
- return _context17.t0.ResponseToJson.call(_context17.t0, _context17.t5);
1412
+ _context18.t5 = _context18.t1.Request.call(_context18.t1, _context18.t4);
1413
+ _context18.next = 16;
1414
+ return _context18.t0.ResponseToJson.call(_context18.t0, _context18.t5);
1363
1415
  case 16:
1364
- return _context17.abrupt("return", _context17.sent);
1416
+ return _context18.abrupt("return", _context18.sent);
1365
1417
  case 17:
1366
1418
  case "end":
1367
- return _context17.stop();
1419
+ return _context18.stop();
1368
1420
  }
1369
- }, _callee16, this);
1421
+ }, _callee17, this);
1370
1422
  }));
1371
- return function (_x17) {
1372
- return _ref29.apply(this, arguments);
1423
+ return function (_x18) {
1424
+ return _ref32.apply(this, arguments);
1373
1425
  };
1374
1426
  }();
1375
1427
 
@@ -1398,12 +1450,12 @@ exports.ContentPart = /*#__PURE__*/function () {
1398
1450
  * @returns {Promise<ArrayBuffer> | undefined} - No return if chunked is specified, part data in the requested format otherwise
1399
1451
  */
1400
1452
  exports.DownloadPart = /*#__PURE__*/function () {
1401
- var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee17(_ref30) {
1402
- var libraryId, objectId, versionHash, writeToken, partHash, _ref30$format, format, _ref30$chunked, chunked, _ref30$chunkSize, chunkSize, callback, encrypted, encryption, path, headers, bytesTotal;
1403
- return _regeneratorRuntime.wrap(function _callee17$(_context18) {
1404
- while (1) switch (_context18.prev = _context18.next) {
1453
+ var _ref34 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref33) {
1454
+ var libraryId, objectId, versionHash, writeToken, partHash, _ref33$format, format, _ref33$chunked, chunked, _ref33$chunkSize, chunkSize, callback, encrypted, encryption, path, headers, bytesTotal;
1455
+ return _regeneratorRuntime.wrap(function _callee18$(_context19) {
1456
+ while (1) switch (_context19.prev = _context19.next) {
1405
1457
  case 0:
1406
- libraryId = _ref30.libraryId, objectId = _ref30.objectId, versionHash = _ref30.versionHash, writeToken = _ref30.writeToken, partHash = _ref30.partHash, _ref30$format = _ref30.format, format = _ref30$format === void 0 ? "arrayBuffer" : _ref30$format, _ref30$chunked = _ref30.chunked, chunked = _ref30$chunked === void 0 ? false : _ref30$chunked, _ref30$chunkSize = _ref30.chunkSize, chunkSize = _ref30$chunkSize === void 0 ? 10000000 : _ref30$chunkSize, callback = _ref30.callback;
1458
+ libraryId = _ref33.libraryId, objectId = _ref33.objectId, versionHash = _ref33.versionHash, writeToken = _ref33.writeToken, partHash = _ref33.partHash, _ref33$format = _ref33.format, format = _ref33$format === void 0 ? "arrayBuffer" : _ref33$format, _ref33$chunked = _ref33.chunked, chunked = _ref33$chunked === void 0 ? false : _ref33$chunked, _ref33$chunkSize = _ref33.chunkSize, chunkSize = _ref33$chunkSize === void 0 ? 10000000 : _ref33$chunkSize, callback = _ref33.callback;
1407
1459
  ValidateParameters({
1408
1460
  libraryId: libraryId,
1409
1461
  objectId: objectId,
@@ -1416,7 +1468,7 @@ exports.DownloadPart = /*#__PURE__*/function () {
1416
1468
  encrypted = partHash.startsWith("hqpe");
1417
1469
  encryption = encrypted ? "cgck" : undefined;
1418
1470
  path = UrlJoin("q", writeToken || versionHash || objectId, "data", partHash);
1419
- _context18.next = 9;
1471
+ _context19.next = 9;
1420
1472
  return this.authClient.AuthorizationHeader({
1421
1473
  libraryId: libraryId,
1422
1474
  objectId: objectId,
@@ -1425,8 +1477,8 @@ exports.DownloadPart = /*#__PURE__*/function () {
1425
1477
  makeAccessRequest: true
1426
1478
  });
1427
1479
  case 9:
1428
- headers = _context18.sent;
1429
- _context18.next = 12;
1480
+ headers = _context19.sent;
1481
+ _context19.next = 12;
1430
1482
  return this.ContentPart({
1431
1483
  libraryId: libraryId,
1432
1484
  objectId: objectId,
@@ -1434,55 +1486,55 @@ exports.DownloadPart = /*#__PURE__*/function () {
1434
1486
  partHash: partHash
1435
1487
  });
1436
1488
  case 12:
1437
- bytesTotal = _context18.sent.part.size;
1489
+ bytesTotal = _context19.sent.part.size;
1438
1490
  if (!encrypted) {
1439
- _context18.next = 37;
1491
+ _context19.next = 37;
1440
1492
  break;
1441
1493
  }
1442
- _context18.t0 = this.utils;
1443
- _context18.t1 = this.signer.address;
1444
- _context18.next = 18;
1494
+ _context19.t0 = this.utils;
1495
+ _context19.t1 = this.signer.address;
1496
+ _context19.next = 18;
1445
1497
  return this.ContentObjectOwner({
1446
1498
  objectId: objectId
1447
1499
  });
1448
1500
  case 18:
1449
- _context18.t2 = _context18.sent;
1450
- if (_context18.t0.EqualAddress.call(_context18.t0, _context18.t1, _context18.t2)) {
1451
- _context18.next = 21;
1501
+ _context19.t2 = _context19.sent;
1502
+ if (_context19.t0.EqualAddress.call(_context19.t0, _context19.t1, _context19.t2)) {
1503
+ _context19.next = 21;
1452
1504
  break;
1453
1505
  }
1454
1506
  headers["X-Content-Fabric-Decryption-Mode"] = "reencrypt";
1455
1507
  case 21:
1456
- _context18.t3 = this;
1457
- _context18.next = 24;
1508
+ _context19.t3 = this;
1509
+ _context19.next = 24;
1458
1510
  return this.EncryptionConk({
1459
1511
  libraryId: libraryId,
1460
1512
  objectId: objectId,
1461
1513
  download: true
1462
1514
  });
1463
1515
  case 24:
1464
- _context18.t4 = _context18.sent;
1465
- _context18.t5 = path;
1466
- _context18.t6 = bytesTotal;
1467
- _context18.t7 = headers;
1468
- _context18.t8 = callback;
1469
- _context18.t9 = format;
1470
- _context18.t10 = chunked;
1471
- _context18.t11 = {
1472
- conk: _context18.t4,
1473
- downloadPath: _context18.t5,
1474
- bytesTotal: _context18.t6,
1475
- headers: _context18.t7,
1476
- callback: _context18.t8,
1477
- format: _context18.t9,
1478
- chunked: _context18.t10
1516
+ _context19.t4 = _context19.sent;
1517
+ _context19.t5 = path;
1518
+ _context19.t6 = bytesTotal;
1519
+ _context19.t7 = headers;
1520
+ _context19.t8 = callback;
1521
+ _context19.t9 = format;
1522
+ _context19.t10 = chunked;
1523
+ _context19.t11 = {
1524
+ conk: _context19.t4,
1525
+ downloadPath: _context19.t5,
1526
+ bytesTotal: _context19.t6,
1527
+ headers: _context19.t7,
1528
+ callback: _context19.t8,
1529
+ format: _context19.t9,
1530
+ chunked: _context19.t10
1479
1531
  };
1480
- _context18.next = 34;
1481
- return _context18.t3.DownloadEncrypted.call(_context18.t3, _context18.t11);
1532
+ _context19.next = 34;
1533
+ return _context19.t3.DownloadEncrypted.call(_context19.t3, _context19.t11);
1482
1534
  case 34:
1483
- return _context18.abrupt("return", _context18.sent);
1535
+ return _context19.abrupt("return", _context19.sent);
1484
1536
  case 37:
1485
- _context18.next = 39;
1537
+ _context19.next = 39;
1486
1538
  return this.Download({
1487
1539
  downloadPath: path,
1488
1540
  bytesTotal: bytesTotal,
@@ -1493,26 +1545,26 @@ exports.DownloadPart = /*#__PURE__*/function () {
1493
1545
  chunkSize: chunkSize
1494
1546
  });
1495
1547
  case 39:
1496
- return _context18.abrupt("return", _context18.sent);
1548
+ return _context19.abrupt("return", _context19.sent);
1497
1549
  case 40:
1498
1550
  case "end":
1499
- return _context18.stop();
1551
+ return _context19.stop();
1500
1552
  }
1501
- }, _callee17, this);
1553
+ }, _callee18, this);
1502
1554
  }));
1503
- return function (_x18) {
1504
- return _ref31.apply(this, arguments);
1555
+ return function (_x19) {
1556
+ return _ref34.apply(this, arguments);
1505
1557
  };
1506
1558
  }();
1507
1559
  exports.Download = /*#__PURE__*/function () {
1508
- var _ref33 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee18(_ref32) {
1509
- var downloadPath, headers, bytesTotal, _ref32$chunked, chunked, _ref32$chunkSize, chunkSize, callback, _ref32$format, format, outputChunks, bytesFinished, totalChunks, i, response;
1510
- return _regeneratorRuntime.wrap(function _callee18$(_context19) {
1511
- while (1) switch (_context19.prev = _context19.next) {
1560
+ var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(_ref35) {
1561
+ var downloadPath, headers, bytesTotal, _ref35$chunked, chunked, _ref35$chunkSize, chunkSize, callback, _ref35$format, format, outputChunks, bytesFinished, totalChunks, i, response;
1562
+ return _regeneratorRuntime.wrap(function _callee19$(_context20) {
1563
+ while (1) switch (_context20.prev = _context20.next) {
1512
1564
  case 0:
1513
- downloadPath = _ref32.downloadPath, headers = _ref32.headers, bytesTotal = _ref32.bytesTotal, _ref32$chunked = _ref32.chunked, chunked = _ref32$chunked === void 0 ? false : _ref32$chunked, _ref32$chunkSize = _ref32.chunkSize, chunkSize = _ref32$chunkSize === void 0 ? 2000000 : _ref32$chunkSize, callback = _ref32.callback, _ref32$format = _ref32.format, format = _ref32$format === void 0 ? "arrayBuffer" : _ref32$format;
1565
+ downloadPath = _ref35.downloadPath, headers = _ref35.headers, bytesTotal = _ref35.bytesTotal, _ref35$chunked = _ref35.chunked, chunked = _ref35$chunked === void 0 ? false : _ref35$chunked, _ref35$chunkSize = _ref35.chunkSize, chunkSize = _ref35$chunkSize === void 0 ? 2000000 : _ref35$chunkSize, callback = _ref35.callback, _ref35$format = _ref35.format, format = _ref35$format === void 0 ? "arrayBuffer" : _ref35$format;
1514
1566
  if (!(chunked && !callback)) {
1515
- _context19.next = 3;
1567
+ _context20.next = 3;
1516
1568
  break;
1517
1569
  }
1518
1570
  throw Error("No callback specified for chunked download");
@@ -1527,47 +1579,47 @@ exports.Download = /*#__PURE__*/function () {
1527
1579
  i = 0;
1528
1580
  case 7:
1529
1581
  if (!(i < totalChunks)) {
1530
- _context19.next = 35;
1582
+ _context20.next = 35;
1531
1583
  break;
1532
1584
  }
1533
1585
  headers["Range"] = "bytes=".concat(bytesFinished, "-").concat(bytesFinished + chunkSize - 1);
1534
- _context19.next = 11;
1586
+ _context20.next = 11;
1535
1587
  return this.HttpClient.Request({
1536
1588
  path: downloadPath,
1537
1589
  headers: headers,
1538
1590
  method: "GET"
1539
1591
  });
1540
1592
  case 11:
1541
- response = _context19.sent;
1593
+ response = _context20.sent;
1542
1594
  bytesFinished = Math.min(bytesFinished + chunkSize, bytesTotal);
1543
1595
  if (!chunked) {
1544
- _context19.next = 24;
1596
+ _context20.next = 24;
1545
1597
  break;
1546
1598
  }
1547
- _context19.t0 = callback;
1548
- _context19.t1 = bytesFinished;
1549
- _context19.t2 = bytesTotal;
1550
- _context19.next = 19;
1599
+ _context20.t0 = callback;
1600
+ _context20.t1 = bytesFinished;
1601
+ _context20.t2 = bytesTotal;
1602
+ _context20.next = 19;
1551
1603
  return this.utils.ResponseToFormat(format, response);
1552
1604
  case 19:
1553
- _context19.t3 = _context19.sent;
1554
- _context19.t4 = {
1555
- bytesFinished: _context19.t1,
1556
- bytesTotal: _context19.t2,
1557
- chunk: _context19.t3
1605
+ _context20.t3 = _context20.sent;
1606
+ _context20.t4 = {
1607
+ bytesFinished: _context20.t1,
1608
+ bytesTotal: _context20.t2,
1609
+ chunk: _context20.t3
1558
1610
  };
1559
- (0, _context19.t0)(_context19.t4);
1560
- _context19.next = 32;
1611
+ (0, _context20.t0)(_context20.t4);
1612
+ _context20.next = 32;
1561
1613
  break;
1562
1614
  case 24:
1563
- _context19.t5 = outputChunks;
1564
- _context19.t6 = Buffer;
1565
- _context19.next = 28;
1615
+ _context20.t5 = outputChunks;
1616
+ _context20.t6 = Buffer;
1617
+ _context20.next = 28;
1566
1618
  return response.arrayBuffer();
1567
1619
  case 28:
1568
- _context19.t7 = _context19.sent;
1569
- _context19.t8 = _context19.t6.from.call(_context19.t6, _context19.t7);
1570
- _context19.t5.push.call(_context19.t5, _context19.t8);
1620
+ _context20.t7 = _context20.sent;
1621
+ _context20.t8 = _context20.t6.from.call(_context20.t6, _context20.t7);
1622
+ _context20.t5.push.call(_context20.t5, _context20.t8);
1571
1623
  if (callback) {
1572
1624
  callback({
1573
1625
  bytesFinished: bytesFinished,
@@ -1576,37 +1628,37 @@ exports.Download = /*#__PURE__*/function () {
1576
1628
  }
1577
1629
  case 32:
1578
1630
  i++;
1579
- _context19.next = 7;
1631
+ _context20.next = 7;
1580
1632
  break;
1581
1633
  case 35:
1582
1634
  if (chunked) {
1583
- _context19.next = 39;
1635
+ _context20.next = 39;
1584
1636
  break;
1585
1637
  }
1586
- _context19.next = 38;
1638
+ _context20.next = 38;
1587
1639
  return this.utils.ResponseToFormat(format, new Response(Buffer.concat(outputChunks)));
1588
1640
  case 38:
1589
- return _context19.abrupt("return", _context19.sent);
1641
+ return _context20.abrupt("return", _context20.sent);
1590
1642
  case 39:
1591
1643
  case "end":
1592
- return _context19.stop();
1644
+ return _context20.stop();
1593
1645
  }
1594
- }, _callee18, this);
1646
+ }, _callee19, this);
1595
1647
  }));
1596
- return function (_x19) {
1597
- return _ref33.apply(this, arguments);
1648
+ return function (_x20) {
1649
+ return _ref36.apply(this, arguments);
1598
1650
  };
1599
1651
  }();
1600
1652
  exports.DownloadEncrypted = /*#__PURE__*/function () {
1601
- var _ref35 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(_ref34) {
1653
+ var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref37) {
1602
1654
  var _this2 = this;
1603
- var conk, downloadPath, bytesTotal, headers, callback, _ref34$format, format, _ref34$chunked, chunked, isReencryption, chunkSize, bytesFinished, outputChunks, stream, totalChunks, i, response;
1604
- return _regeneratorRuntime.wrap(function _callee20$(_context21) {
1605
- while (1) switch (_context21.prev = _context21.next) {
1655
+ var conk, downloadPath, bytesTotal, headers, callback, _ref37$format, format, _ref37$chunked, chunked, isReencryption, chunkSize, bytesFinished, outputChunks, stream, totalChunks, i, response;
1656
+ return _regeneratorRuntime.wrap(function _callee21$(_context22) {
1657
+ while (1) switch (_context22.prev = _context22.next) {
1606
1658
  case 0:
1607
- conk = _ref34.conk, downloadPath = _ref34.downloadPath, bytesTotal = _ref34.bytesTotal, headers = _ref34.headers, callback = _ref34.callback, _ref34$format = _ref34.format, format = _ref34$format === void 0 ? "arrayBuffer" : _ref34$format, _ref34$chunked = _ref34.chunked, chunked = _ref34$chunked === void 0 ? false : _ref34$chunked;
1659
+ conk = _ref37.conk, downloadPath = _ref37.downloadPath, bytesTotal = _ref37.bytesTotal, headers = _ref37.headers, callback = _ref37.callback, _ref37$format = _ref37.format, format = _ref37$format === void 0 ? "arrayBuffer" : _ref37$format, _ref37$chunked = _ref37.chunked, chunked = _ref37$chunked === void 0 ? false : _ref37$chunked;
1608
1660
  if (!(chunked && !callback)) {
1609
- _context21.next = 3;
1661
+ _context22.next = 3;
1610
1662
  break;
1611
1663
  }
1612
1664
  throw Error("No callback specified for chunked download");
@@ -1617,44 +1669,44 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
1617
1669
  bytesFinished = 0;
1618
1670
  format = format.toLowerCase();
1619
1671
  outputChunks = []; // Set up decryption stream
1620
- _context21.next = 10;
1672
+ _context22.next = 10;
1621
1673
  return this.Crypto.OpenDecryptionStream(conk);
1622
1674
  case 10:
1623
- stream = _context21.sent;
1675
+ stream = _context22.sent;
1624
1676
  stream.on("data", /*#__PURE__*/function () {
1625
- var _ref36 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee19(chunk) {
1677
+ var _ref39 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee20(chunk) {
1626
1678
  var arrayBuffer;
1627
- return _regeneratorRuntime.wrap(function _callee19$(_context20) {
1628
- while (1) switch (_context20.prev = _context20.next) {
1679
+ return _regeneratorRuntime.wrap(function _callee20$(_context21) {
1680
+ while (1) switch (_context21.prev = _context21.next) {
1629
1681
  case 0:
1630
1682
  if (!chunked) {
1631
- _context20.next = 13;
1683
+ _context21.next = 13;
1632
1684
  break;
1633
1685
  }
1634
1686
  if (!(format !== "buffer")) {
1635
- _context20.next = 10;
1687
+ _context21.next = 10;
1636
1688
  break;
1637
1689
  }
1638
1690
  arrayBuffer = chunk.buffer.slice(chunk.byteOffset, chunk.byteOffset + chunk.byteLength);
1639
1691
  if (!(format === "arraybuffer")) {
1640
- _context20.next = 7;
1692
+ _context21.next = 7;
1641
1693
  break;
1642
1694
  }
1643
1695
  chunk = arrayBuffer;
1644
- _context20.next = 10;
1696
+ _context21.next = 10;
1645
1697
  break;
1646
1698
  case 7:
1647
- _context20.next = 9;
1699
+ _context21.next = 9;
1648
1700
  return _this2.utils.ResponseToFormat(format, new Response(arrayBuffer));
1649
1701
  case 9:
1650
- chunk = _context20.sent;
1702
+ chunk = _context21.sent;
1651
1703
  case 10:
1652
1704
  callback({
1653
1705
  bytesFinished: bytesFinished,
1654
1706
  bytesTotal: bytesTotal,
1655
1707
  chunk: chunk
1656
1708
  });
1657
- _context20.next = 15;
1709
+ _context21.next = 15;
1658
1710
  break;
1659
1711
  case 13:
1660
1712
  if (callback) {
@@ -1666,47 +1718,47 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
1666
1718
  outputChunks.push(chunk);
1667
1719
  case 15:
1668
1720
  case "end":
1669
- return _context20.stop();
1721
+ return _context21.stop();
1670
1722
  }
1671
- }, _callee19);
1723
+ }, _callee20);
1672
1724
  }));
1673
- return function (_x21) {
1674
- return _ref36.apply(this, arguments);
1725
+ return function (_x22) {
1726
+ return _ref39.apply(this, arguments);
1675
1727
  };
1676
1728
  }());
1677
1729
  totalChunks = Math.ceil(bytesTotal / chunkSize);
1678
1730
  i = 0;
1679
1731
  case 14:
1680
1732
  if (!(i < totalChunks)) {
1681
- _context21.next = 30;
1733
+ _context22.next = 30;
1682
1734
  break;
1683
1735
  }
1684
1736
  headers["Range"] = "bytes=".concat(bytesFinished, "-").concat(bytesFinished + chunkSize - 1);
1685
- _context21.next = 18;
1737
+ _context22.next = 18;
1686
1738
  return this.HttpClient.Request({
1687
1739
  headers: headers,
1688
1740
  method: "GET",
1689
1741
  path: downloadPath
1690
1742
  });
1691
1743
  case 18:
1692
- response = _context21.sent;
1744
+ response = _context22.sent;
1693
1745
  bytesFinished = Math.min(bytesFinished + chunkSize, bytesTotal);
1694
- _context21.t0 = stream;
1695
- _context21.t1 = Uint8Array;
1696
- _context21.next = 24;
1746
+ _context22.t0 = stream;
1747
+ _context22.t1 = Uint8Array;
1748
+ _context22.next = 24;
1697
1749
  return response.arrayBuffer();
1698
1750
  case 24:
1699
- _context21.t2 = _context21.sent;
1700
- _context21.t3 = new _context21.t1(_context21.t2);
1701
- _context21.t0.write.call(_context21.t0, _context21.t3);
1751
+ _context22.t2 = _context22.sent;
1752
+ _context22.t3 = new _context22.t1(_context22.t2);
1753
+ _context22.t0.write.call(_context22.t0, _context22.t3);
1702
1754
  case 27:
1703
1755
  i++;
1704
- _context21.next = 14;
1756
+ _context22.next = 14;
1705
1757
  break;
1706
1758
  case 30:
1707
1759
  // Wait for decryption to complete
1708
1760
  stream.end();
1709
- _context21.next = 33;
1761
+ _context22.next = 33;
1710
1762
  return new Promise(function (resolve) {
1711
1763
  return stream.on("finish", function () {
1712
1764
  resolve();
@@ -1714,21 +1766,21 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
1714
1766
  });
1715
1767
  case 33:
1716
1768
  if (chunked) {
1717
- _context21.next = 37;
1769
+ _context22.next = 37;
1718
1770
  break;
1719
1771
  }
1720
- _context21.next = 36;
1772
+ _context22.next = 36;
1721
1773
  return this.utils.ResponseToFormat(format, new Response(Buffer.concat(outputChunks)));
1722
1774
  case 36:
1723
- return _context21.abrupt("return", _context21.sent);
1775
+ return _context22.abrupt("return", _context22.sent);
1724
1776
  case 37:
1725
1777
  case "end":
1726
- return _context21.stop();
1778
+ return _context22.stop();
1727
1779
  }
1728
- }, _callee20, this);
1780
+ }, _callee21, this);
1729
1781
  }));
1730
- return function (_x20) {
1731
- return _ref35.apply(this, arguments);
1782
+ return function (_x21) {
1783
+ return _ref38.apply(this, arguments);
1732
1784
  };
1733
1785
  }();
1734
1786
 
@@ -1746,21 +1798,21 @@ exports.DownloadEncrypted = /*#__PURE__*/function () {
1746
1798
  * @returns {Promise<string>} - The part write token for the part draft
1747
1799
  */
1748
1800
  exports.CreatePart = /*#__PURE__*/function () {
1749
- var _ref38 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee21(_ref37) {
1801
+ var _ref41 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref40) {
1750
1802
  var libraryId, objectId, writeToken, encryption, path, openResponse;
1751
- return _regeneratorRuntime.wrap(function _callee21$(_context22) {
1752
- while (1) switch (_context22.prev = _context22.next) {
1803
+ return _regeneratorRuntime.wrap(function _callee22$(_context23) {
1804
+ while (1) switch (_context23.prev = _context23.next) {
1753
1805
  case 0:
1754
- libraryId = _ref37.libraryId, objectId = _ref37.objectId, writeToken = _ref37.writeToken, encryption = _ref37.encryption;
1806
+ libraryId = _ref40.libraryId, objectId = _ref40.objectId, writeToken = _ref40.writeToken, encryption = _ref40.encryption;
1755
1807
  ValidateParameters({
1756
1808
  libraryId: libraryId,
1757
1809
  objectId: objectId
1758
1810
  });
1759
1811
  ValidateWriteToken(writeToken);
1760
1812
  path = UrlJoin("q", writeToken, "parts");
1761
- _context22.t0 = this.utils;
1762
- _context22.t1 = this.HttpClient;
1763
- _context22.next = 8;
1813
+ _context23.t0 = this.utils;
1814
+ _context23.t1 = this.HttpClient;
1815
+ _context23.next = 8;
1764
1816
  return this.authClient.AuthorizationHeader({
1765
1817
  libraryId: libraryId,
1766
1818
  objectId: objectId,
@@ -1768,30 +1820,30 @@ exports.CreatePart = /*#__PURE__*/function () {
1768
1820
  encryption: encryption
1769
1821
  });
1770
1822
  case 8:
1771
- _context22.t2 = _context22.sent;
1772
- _context22.t3 = path;
1773
- _context22.t4 = {
1774
- headers: _context22.t2,
1823
+ _context23.t2 = _context23.sent;
1824
+ _context23.t3 = path;
1825
+ _context23.t4 = {
1826
+ headers: _context23.t2,
1775
1827
  method: "POST",
1776
- path: _context22.t3,
1828
+ path: _context23.t3,
1777
1829
  bodyType: "BINARY",
1778
1830
  body: "",
1779
1831
  allowFailover: false
1780
1832
  };
1781
- _context22.t5 = _context22.t1.Request.call(_context22.t1, _context22.t4);
1782
- _context22.next = 14;
1783
- return _context22.t0.ResponseToJson.call(_context22.t0, _context22.t5);
1833
+ _context23.t5 = _context23.t1.Request.call(_context23.t1, _context23.t4);
1834
+ _context23.next = 14;
1835
+ return _context23.t0.ResponseToJson.call(_context23.t0, _context23.t5);
1784
1836
  case 14:
1785
- openResponse = _context22.sent;
1786
- return _context22.abrupt("return", openResponse.part.write_token);
1837
+ openResponse = _context23.sent;
1838
+ return _context23.abrupt("return", openResponse.part.write_token);
1787
1839
  case 16:
1788
1840
  case "end":
1789
- return _context22.stop();
1841
+ return _context23.stop();
1790
1842
  }
1791
- }, _callee21, this);
1843
+ }, _callee22, this);
1792
1844
  }));
1793
- return function (_x22) {
1794
- return _ref38.apply(this, arguments);
1845
+ return function (_x23) {
1846
+ return _ref41.apply(this, arguments);
1795
1847
  };
1796
1848
  }();
1797
1849
 
@@ -1811,38 +1863,38 @@ exports.CreatePart = /*#__PURE__*/function () {
1811
1863
  * @returns {Promise<string>} - The part write token for the part draft
1812
1864
  */
1813
1865
  exports.UploadPartChunk = /*#__PURE__*/function () {
1814
- var _ref40 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee22(_ref39) {
1866
+ var _ref43 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref42) {
1815
1867
  var libraryId, objectId, writeToken, partWriteToken, chunk, encryption, conk, path;
1816
- return _regeneratorRuntime.wrap(function _callee22$(_context23) {
1817
- while (1) switch (_context23.prev = _context23.next) {
1868
+ return _regeneratorRuntime.wrap(function _callee23$(_context24) {
1869
+ while (1) switch (_context24.prev = _context24.next) {
1818
1870
  case 0:
1819
- libraryId = _ref39.libraryId, objectId = _ref39.objectId, writeToken = _ref39.writeToken, partWriteToken = _ref39.partWriteToken, chunk = _ref39.chunk, encryption = _ref39.encryption;
1871
+ libraryId = _ref42.libraryId, objectId = _ref42.objectId, writeToken = _ref42.writeToken, partWriteToken = _ref42.partWriteToken, chunk = _ref42.chunk, encryption = _ref42.encryption;
1820
1872
  ValidateParameters({
1821
1873
  libraryId: libraryId,
1822
1874
  objectId: objectId
1823
1875
  });
1824
1876
  ValidateWriteToken(writeToken);
1825
1877
  if (!(encryption && encryption !== "none")) {
1826
- _context23.next = 10;
1878
+ _context24.next = 10;
1827
1879
  break;
1828
1880
  }
1829
- _context23.next = 6;
1881
+ _context24.next = 6;
1830
1882
  return this.EncryptionConk({
1831
1883
  libraryId: libraryId,
1832
1884
  objectId: objectId,
1833
1885
  writeToken: writeToken
1834
1886
  });
1835
1887
  case 6:
1836
- conk = _context23.sent;
1837
- _context23.next = 9;
1888
+ conk = _context24.sent;
1889
+ _context24.next = 9;
1838
1890
  return this.Crypto.Encrypt(conk, chunk);
1839
1891
  case 9:
1840
- chunk = _context23.sent;
1892
+ chunk = _context24.sent;
1841
1893
  case 10:
1842
1894
  path = UrlJoin("q", writeToken, "parts");
1843
- _context23.t0 = this.utils;
1844
- _context23.t1 = this.HttpClient;
1845
- _context23.next = 15;
1895
+ _context24.t0 = this.utils;
1896
+ _context24.t1 = this.HttpClient;
1897
+ _context24.next = 15;
1846
1898
  return this.authClient.AuthorizationHeader({
1847
1899
  libraryId: libraryId,
1848
1900
  objectId: objectId,
@@ -1850,28 +1902,28 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
1850
1902
  encryption: encryption
1851
1903
  });
1852
1904
  case 15:
1853
- _context23.t2 = _context23.sent;
1854
- _context23.t3 = UrlJoin(path, partWriteToken);
1855
- _context23.t4 = chunk;
1856
- _context23.t5 = {
1857
- headers: _context23.t2,
1905
+ _context24.t2 = _context24.sent;
1906
+ _context24.t3 = UrlJoin(path, partWriteToken);
1907
+ _context24.t4 = chunk;
1908
+ _context24.t5 = {
1909
+ headers: _context24.t2,
1858
1910
  method: "POST",
1859
- path: _context23.t3,
1860
- body: _context23.t4,
1911
+ path: _context24.t3,
1912
+ body: _context24.t4,
1861
1913
  bodyType: "BINARY",
1862
1914
  allowFailover: false
1863
1915
  };
1864
- _context23.t6 = _context23.t1.Request.call(_context23.t1, _context23.t5);
1865
- _context23.next = 22;
1866
- return _context23.t0.ResponseToJson.call(_context23.t0, _context23.t6);
1916
+ _context24.t6 = _context24.t1.Request.call(_context24.t1, _context24.t5);
1917
+ _context24.next = 22;
1918
+ return _context24.t0.ResponseToJson.call(_context24.t0, _context24.t6);
1867
1919
  case 22:
1868
1920
  case "end":
1869
- return _context23.stop();
1921
+ return _context24.stop();
1870
1922
  }
1871
- }, _callee22, this);
1923
+ }, _callee23, this);
1872
1924
  }));
1873
- return function (_x23) {
1874
- return _ref40.apply(this, arguments);
1925
+ return function (_x24) {
1926
+ return _ref43.apply(this, arguments);
1875
1927
  };
1876
1928
  }();
1877
1929
 
@@ -1890,21 +1942,21 @@ exports.UploadPartChunk = /*#__PURE__*/function () {
1890
1942
  * @returns {Promise<object>} - The finalize response for the new part
1891
1943
  */
1892
1944
  exports.FinalizePart = /*#__PURE__*/function () {
1893
- var _ref42 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee23(_ref41) {
1945
+ var _ref45 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref44) {
1894
1946
  var libraryId, objectId, writeToken, partWriteToken, encryption, path;
1895
- return _regeneratorRuntime.wrap(function _callee23$(_context24) {
1896
- while (1) switch (_context24.prev = _context24.next) {
1947
+ return _regeneratorRuntime.wrap(function _callee24$(_context25) {
1948
+ while (1) switch (_context25.prev = _context25.next) {
1897
1949
  case 0:
1898
- libraryId = _ref41.libraryId, objectId = _ref41.objectId, writeToken = _ref41.writeToken, partWriteToken = _ref41.partWriteToken, encryption = _ref41.encryption;
1950
+ libraryId = _ref44.libraryId, objectId = _ref44.objectId, writeToken = _ref44.writeToken, partWriteToken = _ref44.partWriteToken, encryption = _ref44.encryption;
1899
1951
  ValidateParameters({
1900
1952
  libraryId: libraryId,
1901
1953
  objectId: objectId
1902
1954
  });
1903
1955
  ValidateWriteToken(writeToken);
1904
1956
  path = UrlJoin("q", writeToken, "parts");
1905
- _context24.t0 = this.utils;
1906
- _context24.t1 = this.HttpClient;
1907
- _context24.next = 8;
1957
+ _context25.t0 = this.utils;
1958
+ _context25.t1 = this.HttpClient;
1959
+ _context25.next = 8;
1908
1960
  return this.authClient.AuthorizationHeader({
1909
1961
  libraryId: libraryId,
1910
1962
  objectId: objectId,
@@ -1912,32 +1964,32 @@ exports.FinalizePart = /*#__PURE__*/function () {
1912
1964
  encryption: encryption
1913
1965
  });
1914
1966
  case 8:
1915
- _context24.t2 = _context24.sent;
1916
- _context24.t3 = UrlJoin(path, partWriteToken);
1917
- _context24.t4 = {
1918
- headers: _context24.t2,
1967
+ _context25.t2 = _context25.sent;
1968
+ _context25.t3 = UrlJoin(path, partWriteToken);
1969
+ _context25.t4 = {
1970
+ headers: _context25.t2,
1919
1971
  method: "POST",
1920
- path: _context24.t3,
1972
+ path: _context25.t3,
1921
1973
  bodyType: "BINARY",
1922
1974
  body: "",
1923
1975
  allowFailover: false
1924
1976
  };
1925
- _context24.next = 13;
1926
- return _context24.t1.Request.call(_context24.t1, _context24.t4);
1977
+ _context25.next = 13;
1978
+ return _context25.t1.Request.call(_context25.t1, _context25.t4);
1927
1979
  case 13:
1928
- _context24.t5 = _context24.sent;
1929
- _context24.next = 16;
1930
- return _context24.t0.ResponseToJson.call(_context24.t0, _context24.t5);
1980
+ _context25.t5 = _context25.sent;
1981
+ _context25.next = 16;
1982
+ return _context25.t0.ResponseToJson.call(_context25.t0, _context25.t5);
1931
1983
  case 16:
1932
- return _context24.abrupt("return", _context24.sent);
1984
+ return _context25.abrupt("return", _context25.sent);
1933
1985
  case 17:
1934
1986
  case "end":
1935
- return _context24.stop();
1987
+ return _context25.stop();
1936
1988
  }
1937
- }, _callee23, this);
1989
+ }, _callee24, this);
1938
1990
  }));
1939
- return function (_x24) {
1940
- return _ref42.apply(this, arguments);
1991
+ return function (_x25) {
1992
+ return _ref45.apply(this, arguments);
1941
1993
  };
1942
1994
  }();
1943
1995
 
@@ -1963,18 +2015,18 @@ exports.FinalizePart = /*#__PURE__*/function () {
1963
2015
  * @returns {Promise<Object>} - Response containing information about the uploaded part
1964
2016
  */
1965
2017
  exports.UploadPart = /*#__PURE__*/function () {
1966
- var _ref44 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee24(_ref43) {
1967
- var libraryId, objectId, writeToken, data, _ref43$encryption, encryption, _ref43$chunkSize, chunkSize, callback, partWriteToken, size, i, chunk;
1968
- return _regeneratorRuntime.wrap(function _callee24$(_context25) {
1969
- while (1) switch (_context25.prev = _context25.next) {
2018
+ var _ref47 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref46) {
2019
+ var libraryId, objectId, writeToken, data, _ref46$encryption, encryption, _ref46$chunkSize, chunkSize, callback, partWriteToken, size, i, chunk;
2020
+ return _regeneratorRuntime.wrap(function _callee25$(_context26) {
2021
+ while (1) switch (_context26.prev = _context26.next) {
1970
2022
  case 0:
1971
- libraryId = _ref43.libraryId, objectId = _ref43.objectId, writeToken = _ref43.writeToken, data = _ref43.data, _ref43$encryption = _ref43.encryption, encryption = _ref43$encryption === void 0 ? "none" : _ref43$encryption, _ref43$chunkSize = _ref43.chunkSize, chunkSize = _ref43$chunkSize === void 0 ? 10000000 : _ref43$chunkSize, callback = _ref43.callback;
2023
+ libraryId = _ref46.libraryId, objectId = _ref46.objectId, writeToken = _ref46.writeToken, data = _ref46.data, _ref46$encryption = _ref46.encryption, encryption = _ref46$encryption === void 0 ? "none" : _ref46$encryption, _ref46$chunkSize = _ref46.chunkSize, chunkSize = _ref46$chunkSize === void 0 ? 10000000 : _ref46$chunkSize, callback = _ref46.callback;
1972
2024
  ValidateParameters({
1973
2025
  libraryId: libraryId,
1974
2026
  objectId: objectId
1975
2027
  });
1976
2028
  ValidateWriteToken(writeToken);
1977
- _context25.next = 5;
2029
+ _context26.next = 5;
1978
2030
  return this.CreatePart({
1979
2031
  libraryId: libraryId,
1980
2032
  objectId: objectId,
@@ -1982,7 +2034,7 @@ exports.UploadPart = /*#__PURE__*/function () {
1982
2034
  encryption: encryption
1983
2035
  });
1984
2036
  case 5:
1985
- partWriteToken = _context25.sent;
2037
+ partWriteToken = _context26.sent;
1986
2038
  size = data.length || data.byteLength || data.size;
1987
2039
  if (callback) {
1988
2040
  callback({
@@ -1993,11 +2045,11 @@ exports.UploadPart = /*#__PURE__*/function () {
1993
2045
  i = 0;
1994
2046
  case 9:
1995
2047
  if (!(i < size)) {
1996
- _context25.next = 17;
2048
+ _context26.next = 17;
1997
2049
  break;
1998
2050
  }
1999
2051
  chunk = data.slice(i, i + chunkSize);
2000
- _context25.next = 13;
2052
+ _context26.next = 13;
2001
2053
  return this.UploadPartChunk({
2002
2054
  libraryId: libraryId,
2003
2055
  objectId: objectId,
@@ -2015,10 +2067,10 @@ exports.UploadPart = /*#__PURE__*/function () {
2015
2067
  }
2016
2068
  case 14:
2017
2069
  i += chunkSize;
2018
- _context25.next = 9;
2070
+ _context26.next = 9;
2019
2071
  break;
2020
2072
  case 17:
2021
- _context25.next = 19;
2073
+ _context26.next = 19;
2022
2074
  return this.FinalizePart({
2023
2075
  libraryId: libraryId,
2024
2076
  objectId: objectId,
@@ -2027,15 +2079,15 @@ exports.UploadPart = /*#__PURE__*/function () {
2027
2079
  encryption: encryption
2028
2080
  });
2029
2081
  case 19:
2030
- return _context25.abrupt("return", _context25.sent);
2082
+ return _context26.abrupt("return", _context26.sent);
2031
2083
  case 20:
2032
2084
  case "end":
2033
- return _context25.stop();
2085
+ return _context26.stop();
2034
2086
  }
2035
- }, _callee24, this);
2087
+ }, _callee25, this);
2036
2088
  }));
2037
- return function (_x25) {
2038
- return _ref44.apply(this, arguments);
2089
+ return function (_x26) {
2090
+ return _ref47.apply(this, arguments);
2039
2091
  };
2040
2092
  }();
2041
2093
 
@@ -2051,12 +2103,12 @@ exports.UploadPart = /*#__PURE__*/function () {
2051
2103
  * @param {string} partHash - Hash of the part to delete
2052
2104
  */
2053
2105
  exports.DeletePart = /*#__PURE__*/function () {
2054
- var _ref46 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee25(_ref45) {
2106
+ var _ref49 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee26(_ref48) {
2055
2107
  var libraryId, objectId, writeToken, partHash, path;
2056
- return _regeneratorRuntime.wrap(function _callee25$(_context26) {
2057
- while (1) switch (_context26.prev = _context26.next) {
2108
+ return _regeneratorRuntime.wrap(function _callee26$(_context27) {
2109
+ while (1) switch (_context27.prev = _context27.next) {
2058
2110
  case 0:
2059
- libraryId = _ref45.libraryId, objectId = _ref45.objectId, writeToken = _ref45.writeToken, partHash = _ref45.partHash;
2111
+ libraryId = _ref48.libraryId, objectId = _ref48.objectId, writeToken = _ref48.writeToken, partHash = _ref48.partHash;
2060
2112
  ValidateParameters({
2061
2113
  libraryId: libraryId,
2062
2114
  objectId: objectId
@@ -2064,31 +2116,31 @@ exports.DeletePart = /*#__PURE__*/function () {
2064
2116
  ValidateWriteToken(writeToken);
2065
2117
  ValidatePartHash(partHash);
2066
2118
  path = UrlJoin("q", writeToken, "parts", partHash);
2067
- _context26.t0 = this.HttpClient;
2068
- _context26.next = 8;
2119
+ _context27.t0 = this.HttpClient;
2120
+ _context27.next = 8;
2069
2121
  return this.authClient.AuthorizationHeader({
2070
2122
  libraryId: libraryId,
2071
2123
  objectId: objectId,
2072
2124
  update: true
2073
2125
  });
2074
2126
  case 8:
2075
- _context26.t1 = _context26.sent;
2076
- _context26.t2 = path;
2077
- _context26.t3 = {
2078
- headers: _context26.t1,
2127
+ _context27.t1 = _context27.sent;
2128
+ _context27.t2 = path;
2129
+ _context27.t3 = {
2130
+ headers: _context27.t1,
2079
2131
  method: "DELETE",
2080
- path: _context26.t2,
2132
+ path: _context27.t2,
2081
2133
  allowFailover: false
2082
2134
  };
2083
- _context26.next = 13;
2084
- return _context26.t0.Request.call(_context26.t0, _context26.t3);
2135
+ _context27.next = 13;
2136
+ return _context27.t0.Request.call(_context27.t0, _context27.t3);
2085
2137
  case 13:
2086
2138
  case "end":
2087
- return _context26.stop();
2139
+ return _context27.stop();
2088
2140
  }
2089
- }, _callee25, this);
2141
+ }, _callee26, this);
2090
2142
  }));
2091
- return function (_x26) {
2092
- return _ref46.apply(this, arguments);
2143
+ return function (_x27) {
2144
+ return _ref49.apply(this, arguments);
2093
2145
  };
2094
2146
  }();