@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.
@@ -240,6 +240,40 @@ var AuthSessionState = /*#__PURE__*/function () {
240
240
  }();
241
241
  AuthSessionState.stateKey = "BytescaleSessionState";
242
242
  AuthSessionState.mutexKey = "BytescaleSessionStateMutex";
243
+ ;// CONCATENATED MODULE: ./src/private/ConsoleUtils.ts
244
+ 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); }
245
+ function ConsoleUtils_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
246
+ 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); } }
247
+ 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; }
248
+ function ConsoleUtils_toPropertyKey(arg) { var key = ConsoleUtils_toPrimitive(arg, "string"); return ConsoleUtils_typeof(key) === "symbol" ? key : String(key); }
249
+ 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); }
250
+ var ConsoleUtils = /*#__PURE__*/function () {
251
+ function ConsoleUtils() {
252
+ ConsoleUtils_classCallCheck(this, ConsoleUtils);
253
+ }
254
+ ConsoleUtils_createClass(ConsoleUtils, null, [{
255
+ key: "debug",
256
+ value: function debug(message) {
257
+ console.log(ConsoleUtils.prefix(message));
258
+ }
259
+ }, {
260
+ key: "warn",
261
+ value: function warn(message) {
262
+ console.warn(ConsoleUtils.prefix(message));
263
+ }
264
+ }, {
265
+ key: "error",
266
+ value: function error(message) {
267
+ console.error(ConsoleUtils.prefix(message));
268
+ }
269
+ }, {
270
+ key: "prefix",
271
+ value: function prefix(message) {
272
+ return "[bytescale-sdk] ".concat(message);
273
+ }
274
+ }]);
275
+ return ConsoleUtils;
276
+ }();
243
277
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
244
278
  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); }
245
279
  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); }
@@ -290,6 +324,7 @@ function runtime_createClass(Constructor, protoProps, staticProps) { if (protoPr
290
324
  function runtime_toPropertyKey(arg) { var key = runtime_toPrimitive(arg, "string"); return runtime_typeof(key) === "symbol" ? key : String(key); }
291
325
  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); }
292
326
 
327
+
293
328
  var BytescaleApiClientConfigUtils = /*#__PURE__*/function () {
294
329
  function BytescaleApiClientConfigUtils() {
295
330
  runtime_classCallCheck(this, BytescaleApiClientConfigUtils);
@@ -480,14 +515,24 @@ var BaseAPI = /*#__PURE__*/function () {
480
515
  if (_exit3) return _result;
481
516
  return response.status >= 200 && response.status < 300 ? response : runtime_invoke(function () {
482
517
  if (config.isBytescaleApi) {
483
- var jsonError = undefined;
518
+ var errorText = undefined;
519
+ var errorJson = undefined;
484
520
  return _continue(_catch(function () {
485
- return runtime_await(response.json(), function (_response$json) {
486
- jsonError = _response$json;
521
+ return runtime_await(response.text(), function (_response$text) {
522
+ errorText = _response$text;
523
+ errorJson = JSON.parse(errorText);
487
524
  });
488
525
  }, runtime_empty), function () {
489
- if (typeof ((_a = jsonError === null || jsonError === void 0 ? void 0 : jsonError.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
490
- throw new BytescaleApiError(jsonError);
526
+ if (typeof ((_a = errorJson === null || errorJson === void 0 ? void 0 : errorJson.error) === null || _a === void 0 ? void 0 : _a.code) === "string") {
527
+ throw new BytescaleApiError(errorJson);
528
+ }
529
+ if (config.debug === true) {
530
+ ConsoleUtils.debug("Error response header:");
531
+ response.headers.forEach(function (headerValue, headerKey) {
532
+ return ConsoleUtils.debug("".concat(headerKey, ": ").concat(headerValue));
533
+ });
534
+ ConsoleUtils.debug("Error response body:");
535
+ ConsoleUtils.debug(errorText !== null && errorText !== void 0 ? errorText : "<empty>");
491
536
  }
492
537
  // HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
493
538
  // this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
@@ -725,7 +770,7 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
725
770
  }
726
771
  }
727
772
  /**
728
- * Deletes a file synchronously.
773
+ * Deletes a file synchronously. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
729
774
  */
730
775
  }, {
731
776
  key: "deleteFile",
@@ -752,7 +797,7 @@ var FileApi = /*#__PURE__*/function (_runtime$BaseAPI) {
752
797
  }
753
798
  }
754
799
  /**
755
- * Deletes multiple files asynchronously.
800
+ * Deletes multiple files asynchronously. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
756
801
  */
757
802
  }, {
758
803
  key: "deleteFileBatch",
@@ -970,7 +1015,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
970
1015
  key: "copyFolder",
971
1016
  value:
972
1017
  /**
973
- * 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.
1018
+ * Copies a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter.
974
1019
  */
975
1020
  function copyFolder(params) {
976
1021
  try {
@@ -994,7 +1039,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
994
1039
  }
995
1040
  }
996
1041
  /**
997
- * 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.
1042
+ * Copies multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter.
998
1043
  */
999
1044
  }, {
1000
1045
  key: "copyFolderBatch",
@@ -1020,7 +1065,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1020
1065
  }
1021
1066
  }
1022
1067
  /**
1023
- * 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.
1068
+ * 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.
1024
1069
  */
1025
1070
  }, {
1026
1071
  key: "deleteFolder",
@@ -1046,7 +1091,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1046
1091
  }
1047
1092
  }
1048
1093
  /**
1049
- * 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.
1094
+ * 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.
1050
1095
  */
1051
1096
  }, {
1052
1097
  key: "deleteFolderBatch",
@@ -1072,7 +1117,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1072
1117
  }
1073
1118
  }
1074
1119
  /**
1075
- * 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.
1120
+ * 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.
1076
1121
  */
1077
1122
  }, {
1078
1123
  key: "getFolderDetails",
@@ -1099,7 +1144,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1099
1144
  }
1100
1145
  }
1101
1146
  /**
1102
- * 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`.
1147
+ * 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`.
1103
1148
  */
1104
1149
  }, {
1105
1150
  key: "listFolder",
@@ -1150,7 +1195,7 @@ var FolderApi = /*#__PURE__*/function (_runtime$BaseAPI) {
1150
1195
  }
1151
1196
  }
1152
1197
  /**
1153
- * 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.
1198
+ * 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.
1154
1199
  */
1155
1200
  }, {
1156
1201
  key: "putFolder",
@@ -163,11 +163,11 @@ export declare class FileApi extends runtime.BaseAPI {
163
163
  */
164
164
  copyFileBatch(params: CopyFileBatchOperationParams): Promise<AsyncResponse>;
165
165
  /**
166
- * Deletes a file synchronously.
166
+ * Deletes a file synchronously. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
167
167
  */
168
168
  deleteFile(params: DeleteFileParams): Promise<void>;
169
169
  /**
170
- * Deletes multiple files asynchronously.
170
+ * Deletes multiple files asynchronously. Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth.
171
171
  */
172
172
  deleteFileBatch(params: DeleteFileBatchOperationParams): Promise<AsyncResponse>;
173
173
  /**
@@ -49,31 +49,31 @@ export interface PutFolderOperationParams {
49
49
  }
50
50
  export declare class FolderApi extends runtime.BaseAPI {
51
51
  /**
52
- * 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.
52
+ * Copies a folder asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter.
53
53
  */
54
54
  copyFolder(params: CopyFolderOperationParams): Promise<AsyncResponse>;
55
55
  /**
56
- * 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.
56
+ * Copies multiple folders asynchronously. You can use ListFolder to preview the operation using the `dryRun` parameter.
57
57
  */
58
58
  copyFolderBatch(params: CopyFolderBatchOperationParams): Promise<AsyncResponse>;
59
59
  /**
60
- * 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.
60
+ * 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.
61
61
  */
62
62
  deleteFolder(params: DeleteFolderOperationParams): Promise<AsyncResponse>;
63
63
  /**
64
- * 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.
64
+ * 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.
65
65
  */
66
66
  deleteFolderBatch(params: DeleteFolderBatchOperationParams): Promise<AsyncResponse>;
67
67
  /**
68
- * 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.
68
+ * 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.
69
69
  */
70
70
  getFolderDetails(params: GetFolderDetailsParams): Promise<FolderDetails>;
71
71
  /**
72
- * 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`.
72
+ * 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`.
73
73
  */
74
74
  listFolder(params: ListFolderParams): Promise<ListFolderResponse>;
75
75
  /**
76
- * 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.
76
+ * 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.
77
77
  */
78
78
  putFolder(params: PutFolderOperationParams): Promise<FolderDetails>;
79
79
  }
@@ -7,7 +7,7 @@ export declare type AccountJobStatus = "Created" | "Pending" | "Running" | "Roll
7
7
  * Job type.
8
8
  * @export
9
9
  */
10
- export declare type AccountJobType = "ProcessFileJob" | "DeleteFolderBatchJob" | "DeleteFileBatchJob" | "CopyFolderBatchJob" | "CopyFileBatchJob";
10
+ export declare type AccountJobType = "ProcessVideoJob" | "ProcessAudioJob" | "AntivirusJob" | "DeleteFolderBatchJob" | "DeleteFileBatchJob" | "CopyFolderBatchJob" | "CopyFileBatchJob";
11
11
  /**
12
12
  * Response body from an API endpoint that performs work asynchronously (i.e. does not complete the work immediately).
13
13
  * @export
@@ -212,12 +212,6 @@ export interface CopyFileBatchRequest {
212
212
  * @interface CopyFileRequest
213
213
  */
214
214
  export interface CopyFileRequest {
215
- /**
216
- *
217
- * @type {TagCondition}
218
- * @memberof CopyFileRequest
219
- */
220
- condition?: TagCondition;
221
215
  /**
222
216
  * Absolute path to a file. Begins with a `/`.
223
217
  * @type {string}
@@ -263,12 +257,6 @@ export interface CopyFolderBatchRequest {
263
257
  * @interface CopyFolderRequest
264
258
  */
265
259
  export interface CopyFolderRequest {
266
- /**
267
- *
268
- * @type {TagCondition}
269
- * @memberof CopyFolderRequest
270
- */
271
- condition?: TagCondition;
272
260
  /**
273
261
  * If `true` then copies files.
274
262
  *
@@ -278,7 +266,13 @@ export interface CopyFolderRequest {
278
266
  */
279
267
  copyFiles?: boolean;
280
268
  /**
281
- * If `true` then copies files from folders that have overridden storage settings, else skips them. The current folder is treated the same: if it has overridden storage settings, then its files will only be copied if this flag is `true`, else they will be skipped.
269
+ * If `true` then copies files from folders that have overridden storage settings, else skips them.
270
+ *
271
+ * If the `source` folder overrides its storage settings, then its files will only be copied if this flag is `true`.
272
+ *
273
+ * If the `source` folder inherits its storage settings, then its files will be copied regardless of this flag.
274
+ *
275
+ * In all cases, files will only be copied if `copyFiles` is also set to `true`.
282
276
  *
283
277
  * You can ignore this setting if your account does not use folders with overridden storage settings, such as custom AWS S3 buckets.
284
278
  *
@@ -417,7 +411,7 @@ export interface DeleteFolderBatchRequest {
417
411
  *
418
412
  * If the folder has overridden storage settings, then no files will be deleted.
419
413
  *
420
- * 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.
414
+ * You can use ListFolder to preview the operation using the `dryRun` parameter.
421
415
  * @export
422
416
  * @interface DeleteFolderRequest
423
417
  */
@@ -579,7 +573,7 @@ export interface DynamicFilePath {
579
573
  folderPathVariablesEnabled?: boolean;
580
574
  }
581
575
  /**
582
- * Response body for all error responses.
576
+ * Response body for client-side and server-side errors.
583
577
  * @export
584
578
  * @interface ErrorResponse
585
579
  */
@@ -1882,162 +1876,6 @@ export declare type StorageLayerSummary = InternalStorageV1 | InternalStorageV2
1882
1876
  * @export
1883
1877
  */
1884
1878
  export declare type StorageLayerUpdate = DigitalOceanStorage | GoogleStorage | InternalStorageV2 | R2Storage | S3Storage | WebStorage;
1885
- /**
1886
- * @type TagCondition
1887
- * Expresses a condition that matches files by their tags.
1888
- * @export
1889
- */
1890
- export declare type TagCondition = TagConditionAll | TagConditionAnd | TagConditionAny | TagConditionEquals | TagConditionNot | TagConditionOr;
1891
- /**
1892
- *
1893
- * @export
1894
- * @interface TagConditionAll
1895
- */
1896
- export interface TagConditionAll {
1897
- /**
1898
- *
1899
- * @type {Array<string>}
1900
- * @memberof TagConditionAll
1901
- */
1902
- all: Array<string>;
1903
- /**
1904
- *
1905
- * @type {string}
1906
- * @memberof TagConditionAll
1907
- */
1908
- type: TagConditionAllTypeEnum;
1909
- }
1910
- /**
1911
- * @export
1912
- */
1913
- export declare type TagConditionAllTypeEnum = "All";
1914
- /**
1915
- *
1916
- * @export
1917
- * @interface TagConditionAnd
1918
- */
1919
- export interface TagConditionAnd {
1920
- /**
1921
- *
1922
- * @type {TagCondition}
1923
- * @memberof TagConditionAnd
1924
- */
1925
- left: TagCondition;
1926
- /**
1927
- *
1928
- * @type {TagCondition}
1929
- * @memberof TagConditionAnd
1930
- */
1931
- right: TagCondition;
1932
- /**
1933
- *
1934
- * @type {string}
1935
- * @memberof TagConditionAnd
1936
- */
1937
- type: TagConditionAndTypeEnum;
1938
- }
1939
- /**
1940
- * @export
1941
- */
1942
- export declare type TagConditionAndTypeEnum = "And";
1943
- /**
1944
- *
1945
- * @export
1946
- * @interface TagConditionAny
1947
- */
1948
- export interface TagConditionAny {
1949
- /**
1950
- *
1951
- * @type {Array<string>}
1952
- * @memberof TagConditionAny
1953
- */
1954
- any: Array<string>;
1955
- /**
1956
- *
1957
- * @type {string}
1958
- * @memberof TagConditionAny
1959
- */
1960
- type: TagConditionAnyTypeEnum;
1961
- }
1962
- /**
1963
- * @export
1964
- */
1965
- export declare type TagConditionAnyTypeEnum = "Any";
1966
- /**
1967
- *
1968
- * @export
1969
- * @interface TagConditionEquals
1970
- */
1971
- export interface TagConditionEquals {
1972
- /**
1973
- * File tag scope, e.g. for a transformation definition, a CDN download access token, or an API key's tag whitelist.
1974
- * @type {string}
1975
- * @memberof TagConditionEquals
1976
- */
1977
- equals: string;
1978
- /**
1979
- *
1980
- * @type {string}
1981
- * @memberof TagConditionEquals
1982
- */
1983
- type: TagConditionEqualsTypeEnum;
1984
- }
1985
- /**
1986
- * @export
1987
- */
1988
- export declare type TagConditionEqualsTypeEnum = "Equals";
1989
- /**
1990
- *
1991
- * @export
1992
- * @interface TagConditionNot
1993
- */
1994
- export interface TagConditionNot {
1995
- /**
1996
- *
1997
- * @type {TagCondition}
1998
- * @memberof TagConditionNot
1999
- */
2000
- condition: TagCondition;
2001
- /**
2002
- *
2003
- * @type {string}
2004
- * @memberof TagConditionNot
2005
- */
2006
- type: TagConditionNotTypeEnum;
2007
- }
2008
- /**
2009
- * @export
2010
- */
2011
- export declare type TagConditionNotTypeEnum = "Not";
2012
- /**
2013
- *
2014
- * @export
2015
- * @interface TagConditionOr
2016
- */
2017
- export interface TagConditionOr {
2018
- /**
2019
- *
2020
- * @type {TagCondition}
2021
- * @memberof TagConditionOr
2022
- */
2023
- left: TagCondition;
2024
- /**
2025
- *
2026
- * @type {TagCondition}
2027
- * @memberof TagConditionOr
2028
- */
2029
- right: TagCondition;
2030
- /**
2031
- *
2032
- * @type {string}
2033
- * @memberof TagConditionOr
2034
- */
2035
- type: TagConditionOrTypeEnum;
2036
- }
2037
- /**
2038
- * @export
2039
- */
2040
- export declare type TagConditionOrTypeEnum = "Or";
2041
1879
  /**
2042
1880
  * This data type specifies no update is to be performed.
2043
1881
  * @export
@@ -31,6 +31,10 @@ export interface BytescaleApiClientConfig {
31
31
  * The base URL of the Bytescale CDN. (Excludes trailing "/".)
32
32
  */
33
33
  cdnUrl?: string;
34
+ /**
35
+ * Enables additional debug information.
36
+ */
37
+ debug?: boolean;
34
38
  /**
35
39
  * Headers to include in all API requests.
36
40
  *
@@ -59,7 +63,7 @@ export declare class BaseAPI {
59
63
  /**
60
64
  * Returns a successful response (2**) else throws an error.
61
65
  */
62
- static fetch(url: string, init: RequestInit, config: Pick<BytescaleApiClientConfig, "fetchApi"> & {
66
+ static fetch(url: string, init: RequestInit, config: Pick<BytescaleApiClientConfig, "fetchApi" | "debug"> & {
63
67
  isBytescaleApi: boolean;
64
68
  }): Promise<Response>;
65
69
  protected request(context: RequestOpts, initOverrides: RequestInit | InitOverrideFunction | undefined, baseUrlOverride: string | undefined): Promise<Response>;
@@ -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",