@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.
@@ -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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytescale/sdk",
3
- "version": "3.21.6",
3
+ "version": "3.23.1",
4
4
  "description": "Bytescale JavaScript SDK",
5
5
  "author": "Bytescale <hello@bytescale.com> (https://www.bytescale.com)",
6
6
  "license": "MIT",