@bytescale/sdk 3.21.6 → 3.23.1

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.
@@ -253,6 +253,40 @@ var AuthSessionState = /*#__PURE__*/function () {
253
253
  }();
254
254
  AuthSessionState.stateKey = "BytescaleSessionState";
255
255
  AuthSessionState.mutexKey = "BytescaleSessionStateMutex";
256
+ ;// CONCATENATED MODULE: ./src/private/ConsoleUtils.ts
257
+ function ConsoleUtils_typeof(obj) { "@babel/helpers - typeof"; return ConsoleUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, ConsoleUtils_typeof(obj); }
258
+ function ConsoleUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
259
+ function ConsoleUtils_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, ConsoleUtils_toPropertyKey(descriptor.key), descriptor); } }
260
+ function ConsoleUtils_createClass(Constructor, protoProps, staticProps) { if (protoProps) ConsoleUtils_defineProperties(Constructor.prototype, protoProps); if (staticProps) ConsoleUtils_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
261
+ function ConsoleUtils_toPropertyKey(arg) { var key = ConsoleUtils_toPrimitive(arg, "string"); return ConsoleUtils_typeof(key) === "symbol" ? key : String(key); }
262
+ function ConsoleUtils_toPrimitive(input, hint) { if (ConsoleUtils_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (ConsoleUtils_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
263
+ var ConsoleUtils = /*#__PURE__*/function () {
264
+ function ConsoleUtils() {
265
+ ConsoleUtils_classCallCheck(this, ConsoleUtils);
266
+ }
267
+ ConsoleUtils_createClass(ConsoleUtils, null, [{
268
+ key: "debug",
269
+ value: function debug(message) {
270
+ console.log(ConsoleUtils.prefix(message));
271
+ }
272
+ }, {
273
+ key: "warn",
274
+ value: function warn(message) {
275
+ console.warn(ConsoleUtils.prefix(message));
276
+ }
277
+ }, {
278
+ key: "error",
279
+ value: function error(message) {
280
+ console.error(ConsoleUtils.prefix(message));
281
+ }
282
+ }, {
283
+ key: "prefix",
284
+ value: function prefix(message) {
285
+ return "[bytescale-sdk] ".concat(message);
286
+ }
287
+ }]);
288
+ return ConsoleUtils;
289
+ }();
256
290
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
257
291
  function runtime_typeof(obj) { "@babel/helpers - typeof"; return runtime_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, runtime_typeof(obj); }
258
292
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
@@ -303,6 +337,7 @@ function runtime_createClass(Constructor, protoProps, staticProps) { if (protoPr
303
337
  function runtime_toPropertyKey(arg) { var key = runtime_toPrimitive(arg, "string"); return runtime_typeof(key) === "symbol" ? key : String(key); }
304
338
  function runtime_toPrimitive(input, hint) { if (runtime_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (runtime_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
305
339
 
340
+
306
341
  var BytescaleApiClientConfigUtils = /*#__PURE__*/function () {
307
342
  function BytescaleApiClientConfigUtils() {
308
343
  runtime_classCallCheck(this, BytescaleApiClientConfigUtils);
@@ -493,14 +528,24 @@ var BaseAPI = /*#__PURE__*/function () {
493
528
  if (_exit3) return _result;
494
529
  return response.status >= 200 && response.status < 300 ? response : runtime_invoke(function () {
495
530
  if (config.isBytescaleApi) {
496
- var jsonError = undefined;
531
+ var errorText = undefined;
532
+ var errorJson = undefined;
497
533
  return _continue(_catch(function () {
498
- return runtime_await(response.json(), function (_response$json) {
499
- jsonError = _response$json;
534
+ return runtime_await(response.text(), function (_response$text) {
535
+ errorText = _response$text;
536
+ errorJson = JSON.parse(errorText);
500
537
  });
501
538
  }, runtime_empty), function () {
502
- if (typeof ((_a = jsonError === null || jsonError === void 0 ? void 0 : jsonError.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
503
- throw new BytescaleApiError(jsonError);
539
+ if (typeof ((_a = errorJson === null || errorJson === void 0 ? void 0 : errorJson.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
540
+ throw new BytescaleApiError(errorJson);
541
+ }
542
+ if (config.debug === true) {
543
+ ConsoleUtils.debug("Error response header:");
544
+ response.headers.forEach(function (headerValue, headerKey) {
545
+ return ConsoleUtils.debug("".concat(headerKey, ": ").concat(headerValue));
546
+ });
547
+ ConsoleUtils.debug("Error response body:");
548
+ ConsoleUtils.debug(errorText !== null && errorText !== void 0 ? errorText : "<empty>");
504
549
  }
505
550
  // HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
506
551
  // this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
@@ -738,7 +783,7 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
738
783
  }
739
784
  }
740
785
  /**
741
- * Deletes a file synchronously.
786
+ * Deletes a file synchronously. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
742
787
  */
743
788
  }, {
744
789
  key: "deleteFile",
@@ -765,7 +810,7 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
765
810
  }
766
811
  }
767
812
  /**
768
- * Deletes multiple files asynchronously.
813
+ * Deletes multiple files asynchronously. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
769
814
  */
770
815
  }, {
771
816
  key: "deleteFileBatch",
@@ -983,7 +1028,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
983
1028
  key: "copyFolder",
984
1029
  value:
985
1030
  /**
986
- * Copies a folder asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1031
+ * Copies a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter.
987
1032
  */
988
1033
  function copyFolder(params) {
989
1034
  try {
@@ -1007,7 +1052,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1007
1052
  }
1008
1053
  }
1009
1054
  /**
1010
- * Copies multiple folders asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1055
+ * Copies multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter.
1011
1056
  */
1012
1057
  }, {
1013
1058
  key: "copyFolderBatch",
@@ -1033,7 +1078,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1033
1078
  }
1034
1079
  }
1035
1080
  /**
1036
- * Deletes a folder asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1081
+ * Deletes a folder asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1037
1082
  */
1038
1083
  }, {
1039
1084
  key: "deleteFolder",
@@ -1059,7 +1104,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1059
1104
  }
1060
1105
  }
1061
1106
  /**
1062
- * Deletes multiple folders asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1107
+ * Deletes multiple folders asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1063
1108
  */
1064
1109
  }, {
1065
1110
  key: "deleteFolderBatch",
@@ -1085,7 +1130,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1085
1130
  }
1086
1131
  }
1087
1132
  /**
1088
- * Gets the full details (e.g. permission, storage layer, etc.) for a folder. Returns an empty object if no settings have been configured for this folder.
1133
+ * Gets the full details (e.g. permission, storage layer, etc.) for a folder. Returns an empty object if no settings have been configured for this folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1089
1134
  */
1090
1135
  }, {
1091
1136
  key: "getFolderDetails",
@@ -1112,7 +1157,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1112
1157
  }
1113
1158
  }
1114
1159
  /**
1115
- * Lists the folder\'s contents. The result may be paginated: subsequent pages can be requested by passing the ```cursor``` from the response into the ```cursor``` request parameter. Pagination is complete when the response includes `isPaginationComplete=true`.
1160
+ * Lists the folder\'s contents. The result may be paginated: subsequent pages can be requested by passing the ```cursor``` from the response into the next request. Pagination is complete when the response includes `isPaginationComplete=true`.
1116
1161
  */
1117
1162
  }, {
1118
1163
  key: "listFolder",
@@ -1163,7 +1208,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1163
1208
  }
1164
1209
  }
1165
1210
  /**
1166
- * Creates or updates the folder specified by the `folderPath`. If the folder\'s ancestors do not exist, they will be created automatically (with empty FolderSettings). Note: you don\'t need to create folders before uploading files to them.
1211
+ * Creates or updates the folder specified by the `folderPath`. If the folder\'s ancestors do not exist, they will be created automatically (with empty FolderSettings). Note: you don\'t need to create folders before uploading files to them. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1167
1212
  */
1168
1213
  }, {
1169
1214
  key: "putFolder",
@@ -2360,40 +2405,6 @@ var UploadManager = /*#__PURE__*/function (_UploadManagerBrowser) {
2360
2405
  }]);
2361
2406
  return UploadManager;
2362
2407
  }(UploadManagerBrowserWorkerBase);
2363
- ;// CONCATENATED MODULE: ./src/private/ConsoleUtils.ts
2364
- function ConsoleUtils_typeof(obj) { "@babel/helpers - typeof"; return ConsoleUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, ConsoleUtils_typeof(obj); }
2365
- function ConsoleUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2366
- function ConsoleUtils_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, ConsoleUtils_toPropertyKey(descriptor.key), descriptor); } }
2367
- function ConsoleUtils_createClass(Constructor, protoProps, staticProps) { if (protoProps) ConsoleUtils_defineProperties(Constructor.prototype, protoProps); if (staticProps) ConsoleUtils_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2368
- function ConsoleUtils_toPropertyKey(arg) { var key = ConsoleUtils_toPrimitive(arg, "string"); return ConsoleUtils_typeof(key) === "symbol" ? key : String(key); }
2369
- function ConsoleUtils_toPrimitive(input, hint) { if (ConsoleUtils_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (ConsoleUtils_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2370
- var ConsoleUtils = /*#__PURE__*/function () {
2371
- function ConsoleUtils() {
2372
- ConsoleUtils_classCallCheck(this, ConsoleUtils);
2373
- }
2374
- ConsoleUtils_createClass(ConsoleUtils, null, [{
2375
- key: "debug",
2376
- value: function debug(message) {
2377
- console.log(ConsoleUtils.prefix(message));
2378
- }
2379
- }, {
2380
- key: "warn",
2381
- value: function warn(message) {
2382
- console.warn(ConsoleUtils.prefix(message));
2383
- }
2384
- }, {
2385
- key: "error",
2386
- value: function error(message) {
2387
- console.error(ConsoleUtils.prefix(message));
2388
- }
2389
- }, {
2390
- key: "prefix",
2391
- value: function prefix(message) {
2392
- return "[bytescale-sdk] ".concat(message);
2393
- }
2394
- }]);
2395
- return ConsoleUtils;
2396
- }();
2397
2408
  ;// CONCATENATED MODULE: ./src/private/ServiceWorkerUtils.ts
2398
2409
  function ServiceWorkerUtils_typeof(obj) { "@babel/helpers - typeof"; return ServiceWorkerUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, ServiceWorkerUtils_typeof(obj); }
2399
2410
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = ServiceWorkerUtils_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
@@ -238,6 +238,40 @@ var AuthSessionState = /*#__PURE__*/function () {
238
238
  }();
239
239
  AuthSessionState.stateKey = "BytescaleSessionState";
240
240
  AuthSessionState.mutexKey = "BytescaleSessionStateMutex";
241
+ ;// CONCATENATED MODULE: ./src/private/ConsoleUtils.ts
242
+ function ConsoleUtils_typeof(obj) { "@babel/helpers - typeof"; return ConsoleUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, ConsoleUtils_typeof(obj); }
243
+ function ConsoleUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
244
+ function ConsoleUtils_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, ConsoleUtils_toPropertyKey(descriptor.key), descriptor); } }
245
+ function ConsoleUtils_createClass(Constructor, protoProps, staticProps) { if (protoProps) ConsoleUtils_defineProperties(Constructor.prototype, protoProps); if (staticProps) ConsoleUtils_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
246
+ function ConsoleUtils_toPropertyKey(arg) { var key = ConsoleUtils_toPrimitive(arg, "string"); return ConsoleUtils_typeof(key) === "symbol" ? key : String(key); }
247
+ function ConsoleUtils_toPrimitive(input, hint) { if (ConsoleUtils_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (ConsoleUtils_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
248
+ var ConsoleUtils = /*#__PURE__*/function () {
249
+ function ConsoleUtils() {
250
+ ConsoleUtils_classCallCheck(this, ConsoleUtils);
251
+ }
252
+ ConsoleUtils_createClass(ConsoleUtils, null, [{
253
+ key: "debug",
254
+ value: function debug(message) {
255
+ console.log(ConsoleUtils.prefix(message));
256
+ }
257
+ }, {
258
+ key: "warn",
259
+ value: function warn(message) {
260
+ console.warn(ConsoleUtils.prefix(message));
261
+ }
262
+ }, {
263
+ key: "error",
264
+ value: function error(message) {
265
+ console.error(ConsoleUtils.prefix(message));
266
+ }
267
+ }, {
268
+ key: "prefix",
269
+ value: function prefix(message) {
270
+ return "[bytescale-sdk] ".concat(message);
271
+ }
272
+ }]);
273
+ return ConsoleUtils;
274
+ }();
241
275
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
242
276
  function runtime_typeof(obj) { "@babel/helpers - typeof"; return runtime_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, runtime_typeof(obj); }
243
277
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
@@ -288,6 +322,7 @@ function runtime_createClass(Constructor, protoProps, staticProps) { if (protoPr
288
322
  function runtime_toPropertyKey(arg) { var key = runtime_toPrimitive(arg, "string"); return runtime_typeof(key) === "symbol" ? key : String(key); }
289
323
  function runtime_toPrimitive(input, hint) { if (runtime_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (runtime_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
290
324
 
325
+
291
326
  var BytescaleApiClientConfigUtils = /*#__PURE__*/function () {
292
327
  function BytescaleApiClientConfigUtils() {
293
328
  runtime_classCallCheck(this, BytescaleApiClientConfigUtils);
@@ -478,14 +513,24 @@ var BaseAPI = /*#__PURE__*/function () {
478
513
  if (_exit3) return _result;
479
514
  return response.status >= 200 && response.status < 300 ? response : runtime_invoke(function () {
480
515
  if (config.isBytescaleApi) {
481
- var jsonError = undefined;
516
+ var errorText = undefined;
517
+ var errorJson = undefined;
482
518
  return _continue(_catch(function () {
483
- return runtime_await(response.json(), function (_response$json) {
484
- jsonError = _response$json;
519
+ return runtime_await(response.text(), function (_response$text) {
520
+ errorText = _response$text;
521
+ errorJson = JSON.parse(errorText);
485
522
  });
486
523
  }, runtime_empty), function () {
487
- if (typeof ((_a = jsonError === null || jsonError === void 0 ? void 0 : jsonError.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
488
- throw new BytescaleApiError(jsonError);
524
+ if (typeof ((_a = errorJson === null || errorJson === void 0 ? void 0 : errorJson.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
525
+ throw new BytescaleApiError(errorJson);
526
+ }
527
+ if (config.debug === true) {
528
+ ConsoleUtils.debug("Error response header:");
529
+ response.headers.forEach(function (headerValue, headerKey) {
530
+ return ConsoleUtils.debug("".concat(headerKey, ": ").concat(headerValue));
531
+ });
532
+ ConsoleUtils.debug("Error response body:");
533
+ ConsoleUtils.debug(errorText !== null && errorText !== void 0 ? errorText : "<empty>");
489
534
  }
490
535
  // HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
491
536
  // this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
@@ -723,7 +768,7 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
723
768
  }
724
769
  }
725
770
  /**
726
- * Deletes a file synchronously.
771
+ * Deletes a file synchronously. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
727
772
  */
728
773
  }, {
729
774
  key: "deleteFile",
@@ -750,7 +795,7 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
750
795
  }
751
796
  }
752
797
  /**
753
- * Deletes multiple files asynchronously.
798
+ * Deletes multiple files asynchronously. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
754
799
  */
755
800
  }, {
756
801
  key: "deleteFileBatch",
@@ -968,7 +1013,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
968
1013
  key: "copyFolder",
969
1014
  value:
970
1015
  /**
971
- * Copies a folder asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1016
+ * Copies a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter.
972
1017
  */
973
1018
  function copyFolder(params) {
974
1019
  try {
@@ -992,7 +1037,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
992
1037
  }
993
1038
  }
994
1039
  /**
995
- * Copies multiple folders asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1040
+ * Copies multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter.
996
1041
  */
997
1042
  }, {
998
1043
  key: "copyFolderBatch",
@@ -1018,7 +1063,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1018
1063
  }
1019
1064
  }
1020
1065
  /**
1021
- * Deletes a folder asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1066
+ * Deletes a folder asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1022
1067
  */
1023
1068
  }, {
1024
1069
  key: "deleteFolder",
@@ -1044,7 +1089,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1044
1089
  }
1045
1090
  }
1046
1091
  /**
1047
- * Deletes multiple folders asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1092
+ * Deletes multiple folders asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1048
1093
  */
1049
1094
  }, {
1050
1095
  key: "deleteFolderBatch",
@@ -1070,7 +1115,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1070
1115
  }
1071
1116
  }
1072
1117
  /**
1073
- * Gets the full details (e.g. permission, storage layer, etc.) for a folder. Returns an empty object if no settings have been configured for this folder.
1118
+ * Gets the full details (e.g. permission, storage layer, etc.) for a folder. Returns an empty object if no settings have been configured for this folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1074
1119
  */
1075
1120
  }, {
1076
1121
  key: "getFolderDetails",
@@ -1097,7 +1142,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1097
1142
  }
1098
1143
  }
1099
1144
  /**
1100
- * Lists the folder\'s contents. The result may be paginated: subsequent pages can be requested by passing the ```cursor``` from the response into the ```cursor``` request parameter. Pagination is complete when the response includes `isPaginationComplete=true`.
1145
+ * Lists the folder\'s contents. The result may be paginated: subsequent pages can be requested by passing the ```cursor``` from the response into the next request. Pagination is complete when the response includes `isPaginationComplete=true`.
1101
1146
  */
1102
1147
  }, {
1103
1148
  key: "listFolder",
@@ -1148,7 +1193,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1148
1193
  }
1149
1194
  }
1150
1195
  /**
1151
- * Creates or updates the folder specified by the `folderPath`. If the folder\'s ancestors do not exist, they will be created automatically (with empty FolderSettings). Note: you don\'t need to create folders before uploading files to them.
1196
+ * Creates or updates the folder specified by the `folderPath`. If the folder\'s ancestors do not exist, they will be created automatically (with empty FolderSettings). Note: you don\'t need to create folders before uploading files to them. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1152
1197
  */
1153
1198
  }, {
1154
1199
  key: "putFolder",
@@ -2345,40 +2390,6 @@ var UploadManager = /*#__PURE__*/function (_UploadManagerBrowser) {
2345
2390
  }]);
2346
2391
  return UploadManager;
2347
2392
  }(UploadManagerBrowserWorkerBase);
2348
- ;// CONCATENATED MODULE: ./src/private/ConsoleUtils.ts
2349
- function ConsoleUtils_typeof(obj) { "@babel/helpers - typeof"; return ConsoleUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, ConsoleUtils_typeof(obj); }
2350
- function ConsoleUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2351
- function ConsoleUtils_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, ConsoleUtils_toPropertyKey(descriptor.key), descriptor); } }
2352
- function ConsoleUtils_createClass(Constructor, protoProps, staticProps) { if (protoProps) ConsoleUtils_defineProperties(Constructor.prototype, protoProps); if (staticProps) ConsoleUtils_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2353
- function ConsoleUtils_toPropertyKey(arg) { var key = ConsoleUtils_toPrimitive(arg, "string"); return ConsoleUtils_typeof(key) === "symbol" ? key : String(key); }
2354
- function ConsoleUtils_toPrimitive(input, hint) { if (ConsoleUtils_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (ConsoleUtils_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
2355
- var ConsoleUtils = /*#__PURE__*/function () {
2356
- function ConsoleUtils() {
2357
- ConsoleUtils_classCallCheck(this, ConsoleUtils);
2358
- }
2359
- ConsoleUtils_createClass(ConsoleUtils, null, [{
2360
- key: "debug",
2361
- value: function debug(message) {
2362
- console.log(ConsoleUtils.prefix(message));
2363
- }
2364
- }, {
2365
- key: "warn",
2366
- value: function warn(message) {
2367
- console.warn(ConsoleUtils.prefix(message));
2368
- }
2369
- }, {
2370
- key: "error",
2371
- value: function error(message) {
2372
- console.error(ConsoleUtils.prefix(message));
2373
- }
2374
- }, {
2375
- key: "prefix",
2376
- value: function prefix(message) {
2377
- return "[bytescale-sdk] ".concat(message);
2378
- }
2379
- }]);
2380
- return ConsoleUtils;
2381
- }();
2382
2393
  ;// CONCATENATED MODULE: ./src/private/ServiceWorkerUtils.ts
2383
2394
  function ServiceWorkerUtils_typeof(obj) { "@babel/helpers - typeof"; return ServiceWorkerUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, ServiceWorkerUtils_typeof(obj); }
2384
2395
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = ServiceWorkerUtils_unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
@@ -253,6 +253,40 @@ var AuthSessionState = /*#__PURE__*/function () {
253
253
  }();
254
254
  AuthSessionState.stateKey = "BytescaleSessionState";
255
255
  AuthSessionState.mutexKey = "BytescaleSessionStateMutex";
256
+ ;// CONCATENATED MODULE: ./src/private/ConsoleUtils.ts
257
+ function ConsoleUtils_typeof(obj) { "@babel/helpers - typeof"; return ConsoleUtils_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, ConsoleUtils_typeof(obj); }
258
+ function ConsoleUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
259
+ function ConsoleUtils_defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, ConsoleUtils_toPropertyKey(descriptor.key), descriptor); } }
260
+ function ConsoleUtils_createClass(Constructor, protoProps, staticProps) { if (protoProps) ConsoleUtils_defineProperties(Constructor.prototype, protoProps); if (staticProps) ConsoleUtils_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
261
+ function ConsoleUtils_toPropertyKey(arg) { var key = ConsoleUtils_toPrimitive(arg, "string"); return ConsoleUtils_typeof(key) === "symbol" ? key : String(key); }
262
+ function ConsoleUtils_toPrimitive(input, hint) { if (ConsoleUtils_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (ConsoleUtils_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
263
+ var ConsoleUtils = /*#__PURE__*/function () {
264
+ function ConsoleUtils() {
265
+ ConsoleUtils_classCallCheck(this, ConsoleUtils);
266
+ }
267
+ ConsoleUtils_createClass(ConsoleUtils, null, [{
268
+ key: "debug",
269
+ value: function debug(message) {
270
+ console.log(ConsoleUtils.prefix(message));
271
+ }
272
+ }, {
273
+ key: "warn",
274
+ value: function warn(message) {
275
+ console.warn(ConsoleUtils.prefix(message));
276
+ }
277
+ }, {
278
+ key: "error",
279
+ value: function error(message) {
280
+ console.error(ConsoleUtils.prefix(message));
281
+ }
282
+ }, {
283
+ key: "prefix",
284
+ value: function prefix(message) {
285
+ return "[bytescale-sdk] ".concat(message);
286
+ }
287
+ }]);
288
+ return ConsoleUtils;
289
+ }();
256
290
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
257
291
  function runtime_typeof(obj) { "@babel/helpers - typeof"; return runtime_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, runtime_typeof(obj); }
258
292
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
@@ -303,6 +337,7 @@ function runtime_createClass(Constructor, protoProps, staticProps) { if (protoPr
303
337
  function runtime_toPropertyKey(arg) { var key = runtime_toPrimitive(arg, "string"); return runtime_typeof(key) === "symbol" ? key : String(key); }
304
338
  function runtime_toPrimitive(input, hint) { if (runtime_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (runtime_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
305
339
 
340
+
306
341
  var BytescaleApiClientConfigUtils = /*#__PURE__*/function () {
307
342
  function BytescaleApiClientConfigUtils() {
308
343
  runtime_classCallCheck(this, BytescaleApiClientConfigUtils);
@@ -493,14 +528,24 @@ var BaseAPI = /*#__PURE__*/function () {
493
528
  if (_exit3) return _result;
494
529
  return response.status >= 200 && response.status < 300 ? response : runtime_invoke(function () {
495
530
  if (config.isBytescaleApi) {
496
- var jsonError = undefined;
531
+ var errorText = undefined;
532
+ var errorJson = undefined;
497
533
  return _continue(_catch(function () {
498
- return runtime_await(response.json(), function (_response$json) {
499
- jsonError = _response$json;
534
+ return runtime_await(response.text(), function (_response$text) {
535
+ errorText = _response$text;
536
+ errorJson = JSON.parse(errorText);
500
537
  });
501
538
  }, runtime_empty), function () {
502
- if (typeof ((_a = jsonError === null || jsonError === void 0 ? void 0 : jsonError.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
503
- throw new BytescaleApiError(jsonError);
539
+ if (typeof ((_a = errorJson === null || errorJson === void 0 ? void 0 : errorJson.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
540
+ throw new BytescaleApiError(errorJson);
541
+ }
542
+ if (config.debug === true) {
543
+ ConsoleUtils.debug("Error response header:");
544
+ response.headers.forEach(function (headerValue, headerKey) {
545
+ return ConsoleUtils.debug("".concat(headerKey, ": ").concat(headerValue));
546
+ });
547
+ ConsoleUtils.debug("Error response body:");
548
+ ConsoleUtils.debug(errorText !== null && errorText !== void 0 ? errorText : "<empty>");
504
549
  }
505
550
  // HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
506
551
  // this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
@@ -738,7 +783,7 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
738
783
  }
739
784
  }
740
785
  /**
741
- * Deletes a file synchronously.
786
+ * Deletes a file synchronously. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
742
787
  */
743
788
  }, {
744
789
  key: "deleteFile",
@@ -765,7 +810,7 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
765
810
  }
766
811
  }
767
812
  /**
768
- * Deletes multiple files asynchronously.
813
+ * Deletes multiple files asynchronously. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
769
814
  */
770
815
  }, {
771
816
  key: "deleteFileBatch",
@@ -983,7 +1028,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
983
1028
  key: "copyFolder",
984
1029
  value:
985
1030
  /**
986
- * Copies a folder asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1031
+ * Copies a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter.
987
1032
  */
988
1033
  function copyFolder(params) {
989
1034
  try {
@@ -1007,7 +1052,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1007
1052
  }
1008
1053
  }
1009
1054
  /**
1010
- * Copies multiple folders asynchronously. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles```, ```includeOverriddenStorage``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1055
+ * Copies multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter.
1011
1056
  */
1012
1057
  }, {
1013
1058
  key: "copyFolderBatch",
@@ -1033,7 +1078,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1033
1078
  }
1034
1079
  }
1035
1080
  /**
1036
- * Deletes a folder asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1081
+ * Deletes a folder asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1037
1082
  */
1038
1083
  }, {
1039
1084
  key: "deleteFolder",
@@ -1059,7 +1104,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1059
1104
  }
1060
1105
  }
1061
1106
  /**
1062
- * Deletes multiple folders asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation: set `dryRun=true` with ```recursive```, ```includeFiles``` and ```includeVirtualFolders``` set to match the values you\'re using here. Leave all other flags unset.
1107
+ * Deletes multiple folders asynchronously. If the folder has overridden storage settings, then no files will be deleted. You can use ListFolder to preview the operation using the `dryRun` parameter. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1063
1108
  */
1064
1109
  }, {
1065
1110
  key: "deleteFolderBatch",
@@ -1085,7 +1130,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1085
1130
  }
1086
1131
  }
1087
1132
  /**
1088
- * Gets the full details (e.g. permission, storage layer, etc.) for a folder. Returns an empty object if no settings have been configured for this folder.
1133
+ * Gets the full details (e.g. permission, storage layer, etc.) for a folder. Returns an empty object if no settings have been configured for this folder. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1089
1134
  */
1090
1135
  }, {
1091
1136
  key: "getFolderDetails",
@@ -1112,7 +1157,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1112
1157
  }
1113
1158
  }
1114
1159
  /**
1115
- * Lists the folder\'s contents. The result may be paginated: subsequent pages can be requested by passing the ```cursor``` from the response into the ```cursor``` request parameter. Pagination is complete when the response includes `isPaginationComplete=true`.
1160
+ * Lists the folder\'s contents. The result may be paginated: subsequent pages can be requested by passing the ```cursor``` from the response into the next request. Pagination is complete when the response includes `isPaginationComplete=true`.
1116
1161
  */
1117
1162
  }, {
1118
1163
  key: "listFolder",
@@ -1163,7 +1208,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1163
1208
  }
1164
1209
  }
1165
1210
  /**
1166
- * Creates or updates the folder specified by the `folderPath`. If the folder\'s ancestors do not exist, they will be created automatically (with empty FolderSettings). Note: you don\'t need to create folders before uploading files to them.
1211
+ * Creates or updates the folder specified by the `folderPath`. If the folder\'s ancestors do not exist, they will be created automatically (with empty FolderSettings). Note: you don\'t need to create folders before uploading files to them. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
1167
1212
  */
1168
1213
  }, {
1169
1214
  key: "putFolder",