@bytescale/sdk 3.26.0 → 3.28.0
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.
- package/dist/browser/cjs/main.js +45 -20
- package/dist/browser/esm/main.mjs +47 -21
- package/dist/node/cjs/main.js +45 -20
- package/dist/node/esm/main.mjs +47 -21
- package/dist/types/public/shared/generated/runtime.d.ts +13 -0
- package/dist/worker/cjs/main.js +45 -20
- package/dist/worker/esm/main.mjs +47 -21
- package/package.json +1 -1
package/dist/browser/cjs/main.js
CHANGED
|
@@ -44,6 +44,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
44
44
|
"BinaryResult": function() { return /* reexport */ BinaryResult; },
|
|
45
45
|
"BytescaleApiClientConfigUtils": function() { return /* reexport */ BytescaleApiClientConfigUtils; },
|
|
46
46
|
"BytescaleApiError": function() { return /* reexport */ BytescaleApiError; },
|
|
47
|
+
"BytescaleGenericError": function() { return /* reexport */ BytescaleGenericError; },
|
|
47
48
|
"CancelledError": function() { return /* reexport */ CancelledError; },
|
|
48
49
|
"CommonTypesNoOp": function() { return /* reexport */ CommonTypesNoOp; },
|
|
49
50
|
"FileApi": function() { return /* reexport */ FileApi; },
|
|
@@ -549,8 +550,10 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
549
550
|
}
|
|
550
551
|
// HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
|
|
551
552
|
// this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
|
|
552
|
-
// this error will appear from any intermediary service failure.
|
|
553
|
-
|
|
553
|
+
// this error will appear from any intermediary service failure. Also occurs when calling ProcessFile for an
|
|
554
|
+
// asynchronous media job, where the transformation is initiated using the primary artifact: in this instance,
|
|
555
|
+
// a 404 JSON response is returned containing the transformation job until it completes.
|
|
556
|
+
throw new BytescaleGenericError(response, errorText, errorJson);
|
|
554
557
|
});
|
|
555
558
|
}
|
|
556
559
|
}, function (_result2) {
|
|
@@ -577,18 +580,39 @@ var CancelledError = /*#__PURE__*/function (_Error) {
|
|
|
577
580
|
}
|
|
578
581
|
return runtime_createClass(CancelledError);
|
|
579
582
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
583
|
+
/**
|
|
584
|
+
* Thrown when the Bytescale API cannot be reached or when an error is returned that cannot be parsed as a JSON error response.
|
|
585
|
+
*/
|
|
586
|
+
var BytescaleGenericError = /*#__PURE__*/function (_Error2) {
|
|
587
|
+
_inherits(BytescaleGenericError, _Error2);
|
|
588
|
+
var _super2 = _createSuper(BytescaleGenericError);
|
|
589
|
+
function BytescaleGenericError(response, responseText, responseJson) {
|
|
584
590
|
var _this6;
|
|
585
|
-
runtime_classCallCheck(this,
|
|
586
|
-
_this6 = _super2.call(this, response.
|
|
587
|
-
_this6.
|
|
588
|
-
_this6.
|
|
589
|
-
_this6.
|
|
591
|
+
runtime_classCallCheck(this, BytescaleGenericError);
|
|
592
|
+
_this6 = _super2.call(this, "Unable to connect to the Bytescale API (".concat(response.status, "): please try again."));
|
|
593
|
+
_this6.response = response;
|
|
594
|
+
_this6.responseText = responseText;
|
|
595
|
+
_this6.responseJson = responseJson;
|
|
596
|
+
_this6.name = "BytescaleGenericError";
|
|
590
597
|
return _this6;
|
|
591
598
|
}
|
|
599
|
+
return runtime_createClass(BytescaleGenericError);
|
|
600
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
601
|
+
/**
|
|
602
|
+
* Thrown when the Bytescale API returns a JSON error response.
|
|
603
|
+
*/
|
|
604
|
+
var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
605
|
+
_inherits(BytescaleApiError, _Error3);
|
|
606
|
+
var _super3 = _createSuper(BytescaleApiError);
|
|
607
|
+
function BytescaleApiError(response) {
|
|
608
|
+
var _this7;
|
|
609
|
+
runtime_classCallCheck(this, BytescaleApiError);
|
|
610
|
+
_this7 = _super3.call(this, response.error.message);
|
|
611
|
+
_this7.name = "BytescaleApiError";
|
|
612
|
+
_this7.errorCode = response.error.code;
|
|
613
|
+
_this7.details = response.error.details;
|
|
614
|
+
return _this7;
|
|
615
|
+
}
|
|
592
616
|
return runtime_createClass(BytescaleApiError);
|
|
593
617
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
594
618
|
function querystring(params) {
|
|
@@ -614,8 +638,8 @@ var JSONApiResponse = /*#__PURE__*/function () {
|
|
|
614
638
|
key: "value",
|
|
615
639
|
value: function value() {
|
|
616
640
|
try {
|
|
617
|
-
var
|
|
618
|
-
return runtime_await(
|
|
641
|
+
var _this9 = this;
|
|
642
|
+
return runtime_await(_this9.raw.json());
|
|
619
643
|
} catch (e) {
|
|
620
644
|
return Promise.reject(e);
|
|
621
645
|
}
|
|
@@ -656,8 +680,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
656
680
|
key: "text",
|
|
657
681
|
value: function text() {
|
|
658
682
|
try {
|
|
659
|
-
var
|
|
660
|
-
return runtime_await(
|
|
683
|
+
var _this11 = this;
|
|
684
|
+
return runtime_await(_this11.raw.text());
|
|
661
685
|
} catch (e) {
|
|
662
686
|
return Promise.reject(e);
|
|
663
687
|
}
|
|
@@ -666,8 +690,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
666
690
|
key: "blob",
|
|
667
691
|
value: function blob() {
|
|
668
692
|
try {
|
|
669
|
-
var
|
|
670
|
-
return runtime_await(
|
|
693
|
+
var _this13 = this;
|
|
694
|
+
return runtime_await(_this13.raw.blob());
|
|
671
695
|
} catch (e) {
|
|
672
696
|
return Promise.reject(e);
|
|
673
697
|
}
|
|
@@ -676,8 +700,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
676
700
|
key: "json",
|
|
677
701
|
value: function json() {
|
|
678
702
|
try {
|
|
679
|
-
var
|
|
680
|
-
return runtime_await(
|
|
703
|
+
var _this15 = this;
|
|
704
|
+
return runtime_await(_this15.raw.json());
|
|
681
705
|
} catch (e) {
|
|
682
706
|
return Promise.reject(e);
|
|
683
707
|
}
|
|
@@ -1655,7 +1679,8 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1655
1679
|
value: function getBaseUrl(params, prefix) {
|
|
1656
1680
|
var _a, _b;
|
|
1657
1681
|
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1658
|
-
|
|
1682
|
+
var filePathEncoded = encodeURIComponent(params.filePath).replace(/%2F/g, "/");
|
|
1683
|
+
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(filePathEncoded);
|
|
1659
1684
|
}
|
|
1660
1685
|
}, {
|
|
1661
1686
|
key: "getCommonTransformationQueryParams",
|
|
@@ -29,6 +29,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
29
29
|
"BinaryResult": function() { return /* reexport */ BinaryResult; },
|
|
30
30
|
"BytescaleApiClientConfigUtils": function() { return /* reexport */ BytescaleApiClientConfigUtils; },
|
|
31
31
|
"BytescaleApiError": function() { return /* reexport */ BytescaleApiError; },
|
|
32
|
+
"BytescaleGenericError": function() { return /* reexport */ BytescaleGenericError; },
|
|
32
33
|
"CancelledError": function() { return /* reexport */ CancelledError; },
|
|
33
34
|
"CommonTypesNoOp": function() { return /* reexport */ CommonTypesNoOp; },
|
|
34
35
|
"FileApi": function() { return /* reexport */ FileApi; },
|
|
@@ -534,8 +535,10 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
534
535
|
}
|
|
535
536
|
// HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
|
|
536
537
|
// this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
|
|
537
|
-
// this error will appear from any intermediary service failure.
|
|
538
|
-
|
|
538
|
+
// this error will appear from any intermediary service failure. Also occurs when calling ProcessFile for an
|
|
539
|
+
// asynchronous media job, where the transformation is initiated using the primary artifact: in this instance,
|
|
540
|
+
// a 404 JSON response is returned containing the transformation job until it completes.
|
|
541
|
+
throw new BytescaleGenericError(response, errorText, errorJson);
|
|
539
542
|
});
|
|
540
543
|
}
|
|
541
544
|
}, function (_result2) {
|
|
@@ -562,18 +565,39 @@ var CancelledError = /*#__PURE__*/function (_Error) {
|
|
|
562
565
|
}
|
|
563
566
|
return runtime_createClass(CancelledError);
|
|
564
567
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
568
|
+
/**
|
|
569
|
+
* Thrown when the Bytescale API cannot be reached or when an error is returned that cannot be parsed as a JSON error response.
|
|
570
|
+
*/
|
|
571
|
+
var BytescaleGenericError = /*#__PURE__*/function (_Error2) {
|
|
572
|
+
_inherits(BytescaleGenericError, _Error2);
|
|
573
|
+
var _super2 = _createSuper(BytescaleGenericError);
|
|
574
|
+
function BytescaleGenericError(response, responseText, responseJson) {
|
|
569
575
|
var _this6;
|
|
570
|
-
runtime_classCallCheck(this,
|
|
571
|
-
_this6 = _super2.call(this, response.
|
|
572
|
-
_this6.
|
|
573
|
-
_this6.
|
|
574
|
-
_this6.
|
|
576
|
+
runtime_classCallCheck(this, BytescaleGenericError);
|
|
577
|
+
_this6 = _super2.call(this, "Unable to connect to the Bytescale API (".concat(response.status, "): please try again."));
|
|
578
|
+
_this6.response = response;
|
|
579
|
+
_this6.responseText = responseText;
|
|
580
|
+
_this6.responseJson = responseJson;
|
|
581
|
+
_this6.name = "BytescaleGenericError";
|
|
575
582
|
return _this6;
|
|
576
583
|
}
|
|
584
|
+
return runtime_createClass(BytescaleGenericError);
|
|
585
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
586
|
+
/**
|
|
587
|
+
* Thrown when the Bytescale API returns a JSON error response.
|
|
588
|
+
*/
|
|
589
|
+
var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
590
|
+
_inherits(BytescaleApiError, _Error3);
|
|
591
|
+
var _super3 = _createSuper(BytescaleApiError);
|
|
592
|
+
function BytescaleApiError(response) {
|
|
593
|
+
var _this7;
|
|
594
|
+
runtime_classCallCheck(this, BytescaleApiError);
|
|
595
|
+
_this7 = _super3.call(this, response.error.message);
|
|
596
|
+
_this7.name = "BytescaleApiError";
|
|
597
|
+
_this7.errorCode = response.error.code;
|
|
598
|
+
_this7.details = response.error.details;
|
|
599
|
+
return _this7;
|
|
600
|
+
}
|
|
577
601
|
return runtime_createClass(BytescaleApiError);
|
|
578
602
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
579
603
|
function querystring(params) {
|
|
@@ -599,8 +623,8 @@ var JSONApiResponse = /*#__PURE__*/function () {
|
|
|
599
623
|
key: "value",
|
|
600
624
|
value: function value() {
|
|
601
625
|
try {
|
|
602
|
-
var
|
|
603
|
-
return runtime_await(
|
|
626
|
+
var _this9 = this;
|
|
627
|
+
return runtime_await(_this9.raw.json());
|
|
604
628
|
} catch (e) {
|
|
605
629
|
return Promise.reject(e);
|
|
606
630
|
}
|
|
@@ -641,8 +665,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
641
665
|
key: "text",
|
|
642
666
|
value: function text() {
|
|
643
667
|
try {
|
|
644
|
-
var
|
|
645
|
-
return runtime_await(
|
|
668
|
+
var _this11 = this;
|
|
669
|
+
return runtime_await(_this11.raw.text());
|
|
646
670
|
} catch (e) {
|
|
647
671
|
return Promise.reject(e);
|
|
648
672
|
}
|
|
@@ -651,8 +675,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
651
675
|
key: "blob",
|
|
652
676
|
value: function blob() {
|
|
653
677
|
try {
|
|
654
|
-
var
|
|
655
|
-
return runtime_await(
|
|
678
|
+
var _this13 = this;
|
|
679
|
+
return runtime_await(_this13.raw.blob());
|
|
656
680
|
} catch (e) {
|
|
657
681
|
return Promise.reject(e);
|
|
658
682
|
}
|
|
@@ -661,8 +685,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
661
685
|
key: "json",
|
|
662
686
|
value: function json() {
|
|
663
687
|
try {
|
|
664
|
-
var
|
|
665
|
-
return runtime_await(
|
|
688
|
+
var _this15 = this;
|
|
689
|
+
return runtime_await(_this15.raw.json());
|
|
666
690
|
} catch (e) {
|
|
667
691
|
return Promise.reject(e);
|
|
668
692
|
}
|
|
@@ -1640,7 +1664,8 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1640
1664
|
value: function getBaseUrl(params, prefix) {
|
|
1641
1665
|
var _a, _b;
|
|
1642
1666
|
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1643
|
-
|
|
1667
|
+
var filePathEncoded = encodeURIComponent(params.filePath).replace(/%2F/g, "/");
|
|
1668
|
+
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(filePathEncoded);
|
|
1644
1669
|
}
|
|
1645
1670
|
}, {
|
|
1646
1671
|
key: "getCommonTransformationQueryParams",
|
|
@@ -2955,6 +2980,7 @@ var __lib_exports__BaseAPI = __lib_exports__.BaseAPI;
|
|
|
2955
2980
|
var __lib_exports__BinaryResult = __lib_exports__.BinaryResult;
|
|
2956
2981
|
var __lib_exports__BytescaleApiClientConfigUtils = __lib_exports__.BytescaleApiClientConfigUtils;
|
|
2957
2982
|
var __lib_exports__BytescaleApiError = __lib_exports__.BytescaleApiError;
|
|
2983
|
+
var __lib_exports__BytescaleGenericError = __lib_exports__.BytescaleGenericError;
|
|
2958
2984
|
var __lib_exports__CancelledError = __lib_exports__.CancelledError;
|
|
2959
2985
|
var __lib_exports__CommonTypesNoOp = __lib_exports__.CommonTypesNoOp;
|
|
2960
2986
|
var __lib_exports__FileApi = __lib_exports__.FileApi;
|
|
@@ -2967,4 +2993,4 @@ var __lib_exports__UrlBuilder = __lib_exports__.UrlBuilder;
|
|
|
2967
2993
|
var __lib_exports__UrlBuilderTypesNoOp = __lib_exports__.UrlBuilderTypesNoOp;
|
|
2968
2994
|
var __lib_exports__VoidApiResponse = __lib_exports__.VoidApiResponse;
|
|
2969
2995
|
var __lib_exports__querystring = __lib_exports__.querystring;
|
|
2970
|
-
export { __lib_exports__AuthManager as AuthManager, __lib_exports__BaseAPI as BaseAPI, __lib_exports__BinaryResult as BinaryResult, __lib_exports__BytescaleApiClientConfigUtils as BytescaleApiClientConfigUtils, __lib_exports__BytescaleApiError as BytescaleApiError, __lib_exports__CancelledError as CancelledError, __lib_exports__CommonTypesNoOp as CommonTypesNoOp, __lib_exports__FileApi as FileApi, __lib_exports__FolderApi as FolderApi, __lib_exports__JSONApiResponse as JSONApiResponse, __lib_exports__JobApi as JobApi, __lib_exports__UploadApi as UploadApi, __lib_exports__UploadManager as UploadManager, __lib_exports__UrlBuilder as UrlBuilder, __lib_exports__UrlBuilderTypesNoOp as UrlBuilderTypesNoOp, __lib_exports__VoidApiResponse as VoidApiResponse, __lib_exports__querystring as querystring };
|
|
2996
|
+
export { __lib_exports__AuthManager as AuthManager, __lib_exports__BaseAPI as BaseAPI, __lib_exports__BinaryResult as BinaryResult, __lib_exports__BytescaleApiClientConfigUtils as BytescaleApiClientConfigUtils, __lib_exports__BytescaleApiError as BytescaleApiError, __lib_exports__BytescaleGenericError as BytescaleGenericError, __lib_exports__CancelledError as CancelledError, __lib_exports__CommonTypesNoOp as CommonTypesNoOp, __lib_exports__FileApi as FileApi, __lib_exports__FolderApi as FolderApi, __lib_exports__JSONApiResponse as JSONApiResponse, __lib_exports__JobApi as JobApi, __lib_exports__UploadApi as UploadApi, __lib_exports__UploadManager as UploadManager, __lib_exports__UrlBuilder as UrlBuilder, __lib_exports__UrlBuilderTypesNoOp as UrlBuilderTypesNoOp, __lib_exports__VoidApiResponse as VoidApiResponse, __lib_exports__querystring as querystring };
|
package/dist/node/cjs/main.js
CHANGED
|
@@ -44,6 +44,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
44
44
|
"BinaryResult": function() { return /* reexport */ BinaryResult; },
|
|
45
45
|
"BytescaleApiClientConfigUtils": function() { return /* reexport */ BytescaleApiClientConfigUtils; },
|
|
46
46
|
"BytescaleApiError": function() { return /* reexport */ BytescaleApiError; },
|
|
47
|
+
"BytescaleGenericError": function() { return /* reexport */ BytescaleGenericError; },
|
|
47
48
|
"CancelledError": function() { return /* reexport */ CancelledError; },
|
|
48
49
|
"CommonTypesNoOp": function() { return /* reexport */ CommonTypesNoOp; },
|
|
49
50
|
"FileApi": function() { return /* reexport */ FileApi; },
|
|
@@ -549,8 +550,10 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
549
550
|
}
|
|
550
551
|
// HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
|
|
551
552
|
// this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
|
|
552
|
-
// this error will appear from any intermediary service failure.
|
|
553
|
-
|
|
553
|
+
// this error will appear from any intermediary service failure. Also occurs when calling ProcessFile for an
|
|
554
|
+
// asynchronous media job, where the transformation is initiated using the primary artifact: in this instance,
|
|
555
|
+
// a 404 JSON response is returned containing the transformation job until it completes.
|
|
556
|
+
throw new BytescaleGenericError(response, errorText, errorJson);
|
|
554
557
|
});
|
|
555
558
|
}
|
|
556
559
|
}, function (_result2) {
|
|
@@ -577,18 +580,39 @@ var CancelledError = /*#__PURE__*/function (_Error) {
|
|
|
577
580
|
}
|
|
578
581
|
return runtime_createClass(CancelledError);
|
|
579
582
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
583
|
+
/**
|
|
584
|
+
* Thrown when the Bytescale API cannot be reached or when an error is returned that cannot be parsed as a JSON error response.
|
|
585
|
+
*/
|
|
586
|
+
var BytescaleGenericError = /*#__PURE__*/function (_Error2) {
|
|
587
|
+
_inherits(BytescaleGenericError, _Error2);
|
|
588
|
+
var _super2 = _createSuper(BytescaleGenericError);
|
|
589
|
+
function BytescaleGenericError(response, responseText, responseJson) {
|
|
584
590
|
var _this6;
|
|
585
|
-
runtime_classCallCheck(this,
|
|
586
|
-
_this6 = _super2.call(this, response.
|
|
587
|
-
_this6.
|
|
588
|
-
_this6.
|
|
589
|
-
_this6.
|
|
591
|
+
runtime_classCallCheck(this, BytescaleGenericError);
|
|
592
|
+
_this6 = _super2.call(this, "Unable to connect to the Bytescale API (".concat(response.status, "): please try again."));
|
|
593
|
+
_this6.response = response;
|
|
594
|
+
_this6.responseText = responseText;
|
|
595
|
+
_this6.responseJson = responseJson;
|
|
596
|
+
_this6.name = "BytescaleGenericError";
|
|
590
597
|
return _this6;
|
|
591
598
|
}
|
|
599
|
+
return runtime_createClass(BytescaleGenericError);
|
|
600
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
601
|
+
/**
|
|
602
|
+
* Thrown when the Bytescale API returns a JSON error response.
|
|
603
|
+
*/
|
|
604
|
+
var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
605
|
+
_inherits(BytescaleApiError, _Error3);
|
|
606
|
+
var _super3 = _createSuper(BytescaleApiError);
|
|
607
|
+
function BytescaleApiError(response) {
|
|
608
|
+
var _this7;
|
|
609
|
+
runtime_classCallCheck(this, BytescaleApiError);
|
|
610
|
+
_this7 = _super3.call(this, response.error.message);
|
|
611
|
+
_this7.name = "BytescaleApiError";
|
|
612
|
+
_this7.errorCode = response.error.code;
|
|
613
|
+
_this7.details = response.error.details;
|
|
614
|
+
return _this7;
|
|
615
|
+
}
|
|
592
616
|
return runtime_createClass(BytescaleApiError);
|
|
593
617
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
594
618
|
function querystring(params) {
|
|
@@ -614,8 +638,8 @@ var JSONApiResponse = /*#__PURE__*/function () {
|
|
|
614
638
|
key: "value",
|
|
615
639
|
value: function value() {
|
|
616
640
|
try {
|
|
617
|
-
var
|
|
618
|
-
return runtime_await(
|
|
641
|
+
var _this9 = this;
|
|
642
|
+
return runtime_await(_this9.raw.json());
|
|
619
643
|
} catch (e) {
|
|
620
644
|
return Promise.reject(e);
|
|
621
645
|
}
|
|
@@ -656,8 +680,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
656
680
|
key: "text",
|
|
657
681
|
value: function text() {
|
|
658
682
|
try {
|
|
659
|
-
var
|
|
660
|
-
return runtime_await(
|
|
683
|
+
var _this11 = this;
|
|
684
|
+
return runtime_await(_this11.raw.text());
|
|
661
685
|
} catch (e) {
|
|
662
686
|
return Promise.reject(e);
|
|
663
687
|
}
|
|
@@ -666,8 +690,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
666
690
|
key: "blob",
|
|
667
691
|
value: function blob() {
|
|
668
692
|
try {
|
|
669
|
-
var
|
|
670
|
-
return runtime_await(
|
|
693
|
+
var _this13 = this;
|
|
694
|
+
return runtime_await(_this13.raw.blob());
|
|
671
695
|
} catch (e) {
|
|
672
696
|
return Promise.reject(e);
|
|
673
697
|
}
|
|
@@ -676,8 +700,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
676
700
|
key: "json",
|
|
677
701
|
value: function json() {
|
|
678
702
|
try {
|
|
679
|
-
var
|
|
680
|
-
return runtime_await(
|
|
703
|
+
var _this15 = this;
|
|
704
|
+
return runtime_await(_this15.raw.json());
|
|
681
705
|
} catch (e) {
|
|
682
706
|
return Promise.reject(e);
|
|
683
707
|
}
|
|
@@ -1655,7 +1679,8 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1655
1679
|
value: function getBaseUrl(params, prefix) {
|
|
1656
1680
|
var _a, _b;
|
|
1657
1681
|
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1658
|
-
|
|
1682
|
+
var filePathEncoded = encodeURIComponent(params.filePath).replace(/%2F/g, "/");
|
|
1683
|
+
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(filePathEncoded);
|
|
1659
1684
|
}
|
|
1660
1685
|
}, {
|
|
1661
1686
|
key: "getCommonTransformationQueryParams",
|
package/dist/node/esm/main.mjs
CHANGED
|
@@ -31,6 +31,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
31
31
|
"BinaryResult": function() { return /* reexport */ BinaryResult; },
|
|
32
32
|
"BytescaleApiClientConfigUtils": function() { return /* reexport */ BytescaleApiClientConfigUtils; },
|
|
33
33
|
"BytescaleApiError": function() { return /* reexport */ BytescaleApiError; },
|
|
34
|
+
"BytescaleGenericError": function() { return /* reexport */ BytescaleGenericError; },
|
|
34
35
|
"CancelledError": function() { return /* reexport */ CancelledError; },
|
|
35
36
|
"CommonTypesNoOp": function() { return /* reexport */ CommonTypesNoOp; },
|
|
36
37
|
"FileApi": function() { return /* reexport */ FileApi; },
|
|
@@ -536,8 +537,10 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
536
537
|
}
|
|
537
538
|
// HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
|
|
538
539
|
// this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
|
|
539
|
-
// this error will appear from any intermediary service failure.
|
|
540
|
-
|
|
540
|
+
// this error will appear from any intermediary service failure. Also occurs when calling ProcessFile for an
|
|
541
|
+
// asynchronous media job, where the transformation is initiated using the primary artifact: in this instance,
|
|
542
|
+
// a 404 JSON response is returned containing the transformation job until it completes.
|
|
543
|
+
throw new BytescaleGenericError(response, errorText, errorJson);
|
|
541
544
|
});
|
|
542
545
|
}
|
|
543
546
|
}, function (_result2) {
|
|
@@ -564,18 +567,39 @@ var CancelledError = /*#__PURE__*/function (_Error) {
|
|
|
564
567
|
}
|
|
565
568
|
return runtime_createClass(CancelledError);
|
|
566
569
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
570
|
+
/**
|
|
571
|
+
* Thrown when the Bytescale API cannot be reached or when an error is returned that cannot be parsed as a JSON error response.
|
|
572
|
+
*/
|
|
573
|
+
var BytescaleGenericError = /*#__PURE__*/function (_Error2) {
|
|
574
|
+
_inherits(BytescaleGenericError, _Error2);
|
|
575
|
+
var _super2 = _createSuper(BytescaleGenericError);
|
|
576
|
+
function BytescaleGenericError(response, responseText, responseJson) {
|
|
571
577
|
var _this6;
|
|
572
|
-
runtime_classCallCheck(this,
|
|
573
|
-
_this6 = _super2.call(this, response.
|
|
574
|
-
_this6.
|
|
575
|
-
_this6.
|
|
576
|
-
_this6.
|
|
578
|
+
runtime_classCallCheck(this, BytescaleGenericError);
|
|
579
|
+
_this6 = _super2.call(this, "Unable to connect to the Bytescale API (".concat(response.status, "): please try again."));
|
|
580
|
+
_this6.response = response;
|
|
581
|
+
_this6.responseText = responseText;
|
|
582
|
+
_this6.responseJson = responseJson;
|
|
583
|
+
_this6.name = "BytescaleGenericError";
|
|
577
584
|
return _this6;
|
|
578
585
|
}
|
|
586
|
+
return runtime_createClass(BytescaleGenericError);
|
|
587
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
588
|
+
/**
|
|
589
|
+
* Thrown when the Bytescale API returns a JSON error response.
|
|
590
|
+
*/
|
|
591
|
+
var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
592
|
+
_inherits(BytescaleApiError, _Error3);
|
|
593
|
+
var _super3 = _createSuper(BytescaleApiError);
|
|
594
|
+
function BytescaleApiError(response) {
|
|
595
|
+
var _this7;
|
|
596
|
+
runtime_classCallCheck(this, BytescaleApiError);
|
|
597
|
+
_this7 = _super3.call(this, response.error.message);
|
|
598
|
+
_this7.name = "BytescaleApiError";
|
|
599
|
+
_this7.errorCode = response.error.code;
|
|
600
|
+
_this7.details = response.error.details;
|
|
601
|
+
return _this7;
|
|
602
|
+
}
|
|
579
603
|
return runtime_createClass(BytescaleApiError);
|
|
580
604
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
581
605
|
function querystring(params) {
|
|
@@ -601,8 +625,8 @@ var JSONApiResponse = /*#__PURE__*/function () {
|
|
|
601
625
|
key: "value",
|
|
602
626
|
value: function value() {
|
|
603
627
|
try {
|
|
604
|
-
var
|
|
605
|
-
return runtime_await(
|
|
628
|
+
var _this9 = this;
|
|
629
|
+
return runtime_await(_this9.raw.json());
|
|
606
630
|
} catch (e) {
|
|
607
631
|
return Promise.reject(e);
|
|
608
632
|
}
|
|
@@ -643,8 +667,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
643
667
|
key: "text",
|
|
644
668
|
value: function text() {
|
|
645
669
|
try {
|
|
646
|
-
var
|
|
647
|
-
return runtime_await(
|
|
670
|
+
var _this11 = this;
|
|
671
|
+
return runtime_await(_this11.raw.text());
|
|
648
672
|
} catch (e) {
|
|
649
673
|
return Promise.reject(e);
|
|
650
674
|
}
|
|
@@ -653,8 +677,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
653
677
|
key: "blob",
|
|
654
678
|
value: function blob() {
|
|
655
679
|
try {
|
|
656
|
-
var
|
|
657
|
-
return runtime_await(
|
|
680
|
+
var _this13 = this;
|
|
681
|
+
return runtime_await(_this13.raw.blob());
|
|
658
682
|
} catch (e) {
|
|
659
683
|
return Promise.reject(e);
|
|
660
684
|
}
|
|
@@ -663,8 +687,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
663
687
|
key: "json",
|
|
664
688
|
value: function json() {
|
|
665
689
|
try {
|
|
666
|
-
var
|
|
667
|
-
return runtime_await(
|
|
690
|
+
var _this15 = this;
|
|
691
|
+
return runtime_await(_this15.raw.json());
|
|
668
692
|
} catch (e) {
|
|
669
693
|
return Promise.reject(e);
|
|
670
694
|
}
|
|
@@ -1642,7 +1666,8 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1642
1666
|
value: function getBaseUrl(params, prefix) {
|
|
1643
1667
|
var _a, _b;
|
|
1644
1668
|
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1645
|
-
|
|
1669
|
+
var filePathEncoded = encodeURIComponent(params.filePath).replace(/%2F/g, "/");
|
|
1670
|
+
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(filePathEncoded);
|
|
1646
1671
|
}
|
|
1647
1672
|
}, {
|
|
1648
1673
|
key: "getCommonTransformationQueryParams",
|
|
@@ -2973,6 +2998,7 @@ var __lib_exports__BaseAPI = __lib_exports__.BaseAPI;
|
|
|
2973
2998
|
var __lib_exports__BinaryResult = __lib_exports__.BinaryResult;
|
|
2974
2999
|
var __lib_exports__BytescaleApiClientConfigUtils = __lib_exports__.BytescaleApiClientConfigUtils;
|
|
2975
3000
|
var __lib_exports__BytescaleApiError = __lib_exports__.BytescaleApiError;
|
|
3001
|
+
var __lib_exports__BytescaleGenericError = __lib_exports__.BytescaleGenericError;
|
|
2976
3002
|
var __lib_exports__CancelledError = __lib_exports__.CancelledError;
|
|
2977
3003
|
var __lib_exports__CommonTypesNoOp = __lib_exports__.CommonTypesNoOp;
|
|
2978
3004
|
var __lib_exports__FileApi = __lib_exports__.FileApi;
|
|
@@ -2985,4 +3011,4 @@ var __lib_exports__UrlBuilder = __lib_exports__.UrlBuilder;
|
|
|
2985
3011
|
var __lib_exports__UrlBuilderTypesNoOp = __lib_exports__.UrlBuilderTypesNoOp;
|
|
2986
3012
|
var __lib_exports__VoidApiResponse = __lib_exports__.VoidApiResponse;
|
|
2987
3013
|
var __lib_exports__querystring = __lib_exports__.querystring;
|
|
2988
|
-
export { __lib_exports__AuthManager as AuthManager, __lib_exports__BaseAPI as BaseAPI, __lib_exports__BinaryResult as BinaryResult, __lib_exports__BytescaleApiClientConfigUtils as BytescaleApiClientConfigUtils, __lib_exports__BytescaleApiError as BytescaleApiError, __lib_exports__CancelledError as CancelledError, __lib_exports__CommonTypesNoOp as CommonTypesNoOp, __lib_exports__FileApi as FileApi, __lib_exports__FolderApi as FolderApi, __lib_exports__JSONApiResponse as JSONApiResponse, __lib_exports__JobApi as JobApi, __lib_exports__UploadApi as UploadApi, __lib_exports__UploadManager as UploadManager, __lib_exports__UrlBuilder as UrlBuilder, __lib_exports__UrlBuilderTypesNoOp as UrlBuilderTypesNoOp, __lib_exports__VoidApiResponse as VoidApiResponse, __lib_exports__querystring as querystring };
|
|
3014
|
+
export { __lib_exports__AuthManager as AuthManager, __lib_exports__BaseAPI as BaseAPI, __lib_exports__BinaryResult as BinaryResult, __lib_exports__BytescaleApiClientConfigUtils as BytescaleApiClientConfigUtils, __lib_exports__BytescaleApiError as BytescaleApiError, __lib_exports__BytescaleGenericError as BytescaleGenericError, __lib_exports__CancelledError as CancelledError, __lib_exports__CommonTypesNoOp as CommonTypesNoOp, __lib_exports__FileApi as FileApi, __lib_exports__FolderApi as FolderApi, __lib_exports__JSONApiResponse as JSONApiResponse, __lib_exports__JobApi as JobApi, __lib_exports__UploadApi as UploadApi, __lib_exports__UploadManager as UploadManager, __lib_exports__UrlBuilder as UrlBuilder, __lib_exports__UrlBuilderTypesNoOp as UrlBuilderTypesNoOp, __lib_exports__VoidApiResponse as VoidApiResponse, __lib_exports__querystring as querystring };
|
|
@@ -74,6 +74,19 @@ export declare class CancelledError extends Error {
|
|
|
74
74
|
name: "CancelledError";
|
|
75
75
|
constructor();
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Thrown when the Bytescale API cannot be reached or when an error is returned that cannot be parsed as a JSON error response.
|
|
79
|
+
*/
|
|
80
|
+
export declare class BytescaleGenericError extends Error {
|
|
81
|
+
readonly response: Response;
|
|
82
|
+
readonly responseText: string | undefined;
|
|
83
|
+
readonly responseJson: object | undefined;
|
|
84
|
+
name: "BytescaleGenericError";
|
|
85
|
+
constructor(response: Response, responseText: string | undefined, responseJson: object | undefined);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Thrown when the Bytescale API returns a JSON error response.
|
|
89
|
+
*/
|
|
77
90
|
export declare class BytescaleApiError extends Error {
|
|
78
91
|
name: "BytescaleApiError";
|
|
79
92
|
readonly errorCode: string;
|
package/dist/worker/cjs/main.js
CHANGED
|
@@ -44,6 +44,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
44
44
|
"BinaryResult": function() { return /* reexport */ BinaryResult; },
|
|
45
45
|
"BytescaleApiClientConfigUtils": function() { return /* reexport */ BytescaleApiClientConfigUtils; },
|
|
46
46
|
"BytescaleApiError": function() { return /* reexport */ BytescaleApiError; },
|
|
47
|
+
"BytescaleGenericError": function() { return /* reexport */ BytescaleGenericError; },
|
|
47
48
|
"CancelledError": function() { return /* reexport */ CancelledError; },
|
|
48
49
|
"CommonTypesNoOp": function() { return /* reexport */ CommonTypesNoOp; },
|
|
49
50
|
"FileApi": function() { return /* reexport */ FileApi; },
|
|
@@ -549,8 +550,10 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
549
550
|
}
|
|
550
551
|
// HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
|
|
551
552
|
// this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
|
|
552
|
-
// this error will appear from any intermediary service failure.
|
|
553
|
-
|
|
553
|
+
// this error will appear from any intermediary service failure. Also occurs when calling ProcessFile for an
|
|
554
|
+
// asynchronous media job, where the transformation is initiated using the primary artifact: in this instance,
|
|
555
|
+
// a 404 JSON response is returned containing the transformation job until it completes.
|
|
556
|
+
throw new BytescaleGenericError(response, errorText, errorJson);
|
|
554
557
|
});
|
|
555
558
|
}
|
|
556
559
|
}, function (_result2) {
|
|
@@ -577,18 +580,39 @@ var CancelledError = /*#__PURE__*/function (_Error) {
|
|
|
577
580
|
}
|
|
578
581
|
return runtime_createClass(CancelledError);
|
|
579
582
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
583
|
+
/**
|
|
584
|
+
* Thrown when the Bytescale API cannot be reached or when an error is returned that cannot be parsed as a JSON error response.
|
|
585
|
+
*/
|
|
586
|
+
var BytescaleGenericError = /*#__PURE__*/function (_Error2) {
|
|
587
|
+
_inherits(BytescaleGenericError, _Error2);
|
|
588
|
+
var _super2 = _createSuper(BytescaleGenericError);
|
|
589
|
+
function BytescaleGenericError(response, responseText, responseJson) {
|
|
584
590
|
var _this6;
|
|
585
|
-
runtime_classCallCheck(this,
|
|
586
|
-
_this6 = _super2.call(this, response.
|
|
587
|
-
_this6.
|
|
588
|
-
_this6.
|
|
589
|
-
_this6.
|
|
591
|
+
runtime_classCallCheck(this, BytescaleGenericError);
|
|
592
|
+
_this6 = _super2.call(this, "Unable to connect to the Bytescale API (".concat(response.status, "): please try again."));
|
|
593
|
+
_this6.response = response;
|
|
594
|
+
_this6.responseText = responseText;
|
|
595
|
+
_this6.responseJson = responseJson;
|
|
596
|
+
_this6.name = "BytescaleGenericError";
|
|
590
597
|
return _this6;
|
|
591
598
|
}
|
|
599
|
+
return runtime_createClass(BytescaleGenericError);
|
|
600
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
601
|
+
/**
|
|
602
|
+
* Thrown when the Bytescale API returns a JSON error response.
|
|
603
|
+
*/
|
|
604
|
+
var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
605
|
+
_inherits(BytescaleApiError, _Error3);
|
|
606
|
+
var _super3 = _createSuper(BytescaleApiError);
|
|
607
|
+
function BytescaleApiError(response) {
|
|
608
|
+
var _this7;
|
|
609
|
+
runtime_classCallCheck(this, BytescaleApiError);
|
|
610
|
+
_this7 = _super3.call(this, response.error.message);
|
|
611
|
+
_this7.name = "BytescaleApiError";
|
|
612
|
+
_this7.errorCode = response.error.code;
|
|
613
|
+
_this7.details = response.error.details;
|
|
614
|
+
return _this7;
|
|
615
|
+
}
|
|
592
616
|
return runtime_createClass(BytescaleApiError);
|
|
593
617
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
594
618
|
function querystring(params) {
|
|
@@ -614,8 +638,8 @@ var JSONApiResponse = /*#__PURE__*/function () {
|
|
|
614
638
|
key: "value",
|
|
615
639
|
value: function value() {
|
|
616
640
|
try {
|
|
617
|
-
var
|
|
618
|
-
return runtime_await(
|
|
641
|
+
var _this9 = this;
|
|
642
|
+
return runtime_await(_this9.raw.json());
|
|
619
643
|
} catch (e) {
|
|
620
644
|
return Promise.reject(e);
|
|
621
645
|
}
|
|
@@ -656,8 +680,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
656
680
|
key: "text",
|
|
657
681
|
value: function text() {
|
|
658
682
|
try {
|
|
659
|
-
var
|
|
660
|
-
return runtime_await(
|
|
683
|
+
var _this11 = this;
|
|
684
|
+
return runtime_await(_this11.raw.text());
|
|
661
685
|
} catch (e) {
|
|
662
686
|
return Promise.reject(e);
|
|
663
687
|
}
|
|
@@ -666,8 +690,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
666
690
|
key: "blob",
|
|
667
691
|
value: function blob() {
|
|
668
692
|
try {
|
|
669
|
-
var
|
|
670
|
-
return runtime_await(
|
|
693
|
+
var _this13 = this;
|
|
694
|
+
return runtime_await(_this13.raw.blob());
|
|
671
695
|
} catch (e) {
|
|
672
696
|
return Promise.reject(e);
|
|
673
697
|
}
|
|
@@ -676,8 +700,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
676
700
|
key: "json",
|
|
677
701
|
value: function json() {
|
|
678
702
|
try {
|
|
679
|
-
var
|
|
680
|
-
return runtime_await(
|
|
703
|
+
var _this15 = this;
|
|
704
|
+
return runtime_await(_this15.raw.json());
|
|
681
705
|
} catch (e) {
|
|
682
706
|
return Promise.reject(e);
|
|
683
707
|
}
|
|
@@ -1655,7 +1679,8 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1655
1679
|
value: function getBaseUrl(params, prefix) {
|
|
1656
1680
|
var _a, _b;
|
|
1657
1681
|
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1658
|
-
|
|
1682
|
+
var filePathEncoded = encodeURIComponent(params.filePath).replace(/%2F/g, "/");
|
|
1683
|
+
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(filePathEncoded);
|
|
1659
1684
|
}
|
|
1660
1685
|
}, {
|
|
1661
1686
|
key: "getCommonTransformationQueryParams",
|
package/dist/worker/esm/main.mjs
CHANGED
|
@@ -29,6 +29,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
29
29
|
"BinaryResult": function() { return /* reexport */ BinaryResult; },
|
|
30
30
|
"BytescaleApiClientConfigUtils": function() { return /* reexport */ BytescaleApiClientConfigUtils; },
|
|
31
31
|
"BytescaleApiError": function() { return /* reexport */ BytescaleApiError; },
|
|
32
|
+
"BytescaleGenericError": function() { return /* reexport */ BytescaleGenericError; },
|
|
32
33
|
"CancelledError": function() { return /* reexport */ CancelledError; },
|
|
33
34
|
"CommonTypesNoOp": function() { return /* reexport */ CommonTypesNoOp; },
|
|
34
35
|
"FileApi": function() { return /* reexport */ FileApi; },
|
|
@@ -534,8 +535,10 @@ var BaseAPI = /*#__PURE__*/function () {
|
|
|
534
535
|
}
|
|
535
536
|
// HTTP-level errors from intermediary services (e.g. AWS or the user's own infrastructure/proxies). On the browser,
|
|
536
537
|
// this error is unlikely to be triggered since these errors will masqurade as CORS errors (see above) but in Node.js
|
|
537
|
-
// this error will appear from any intermediary service failure.
|
|
538
|
-
|
|
538
|
+
// this error will appear from any intermediary service failure. Also occurs when calling ProcessFile for an
|
|
539
|
+
// asynchronous media job, where the transformation is initiated using the primary artifact: in this instance,
|
|
540
|
+
// a 404 JSON response is returned containing the transformation job until it completes.
|
|
541
|
+
throw new BytescaleGenericError(response, errorText, errorJson);
|
|
539
542
|
});
|
|
540
543
|
}
|
|
541
544
|
}, function (_result2) {
|
|
@@ -562,18 +565,39 @@ var CancelledError = /*#__PURE__*/function (_Error) {
|
|
|
562
565
|
}
|
|
563
566
|
return runtime_createClass(CancelledError);
|
|
564
567
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
568
|
+
/**
|
|
569
|
+
* Thrown when the Bytescale API cannot be reached or when an error is returned that cannot be parsed as a JSON error response.
|
|
570
|
+
*/
|
|
571
|
+
var BytescaleGenericError = /*#__PURE__*/function (_Error2) {
|
|
572
|
+
_inherits(BytescaleGenericError, _Error2);
|
|
573
|
+
var _super2 = _createSuper(BytescaleGenericError);
|
|
574
|
+
function BytescaleGenericError(response, responseText, responseJson) {
|
|
569
575
|
var _this6;
|
|
570
|
-
runtime_classCallCheck(this,
|
|
571
|
-
_this6 = _super2.call(this, response.
|
|
572
|
-
_this6.
|
|
573
|
-
_this6.
|
|
574
|
-
_this6.
|
|
576
|
+
runtime_classCallCheck(this, BytescaleGenericError);
|
|
577
|
+
_this6 = _super2.call(this, "Unable to connect to the Bytescale API (".concat(response.status, "): please try again."));
|
|
578
|
+
_this6.response = response;
|
|
579
|
+
_this6.responseText = responseText;
|
|
580
|
+
_this6.responseJson = responseJson;
|
|
581
|
+
_this6.name = "BytescaleGenericError";
|
|
575
582
|
return _this6;
|
|
576
583
|
}
|
|
584
|
+
return runtime_createClass(BytescaleGenericError);
|
|
585
|
+
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
586
|
+
/**
|
|
587
|
+
* Thrown when the Bytescale API returns a JSON error response.
|
|
588
|
+
*/
|
|
589
|
+
var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
590
|
+
_inherits(BytescaleApiError, _Error3);
|
|
591
|
+
var _super3 = _createSuper(BytescaleApiError);
|
|
592
|
+
function BytescaleApiError(response) {
|
|
593
|
+
var _this7;
|
|
594
|
+
runtime_classCallCheck(this, BytescaleApiError);
|
|
595
|
+
_this7 = _super3.call(this, response.error.message);
|
|
596
|
+
_this7.name = "BytescaleApiError";
|
|
597
|
+
_this7.errorCode = response.error.code;
|
|
598
|
+
_this7.details = response.error.details;
|
|
599
|
+
return _this7;
|
|
600
|
+
}
|
|
577
601
|
return runtime_createClass(BytescaleApiError);
|
|
578
602
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
579
603
|
function querystring(params) {
|
|
@@ -599,8 +623,8 @@ var JSONApiResponse = /*#__PURE__*/function () {
|
|
|
599
623
|
key: "value",
|
|
600
624
|
value: function value() {
|
|
601
625
|
try {
|
|
602
|
-
var
|
|
603
|
-
return runtime_await(
|
|
626
|
+
var _this9 = this;
|
|
627
|
+
return runtime_await(_this9.raw.json());
|
|
604
628
|
} catch (e) {
|
|
605
629
|
return Promise.reject(e);
|
|
606
630
|
}
|
|
@@ -641,8 +665,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
641
665
|
key: "text",
|
|
642
666
|
value: function text() {
|
|
643
667
|
try {
|
|
644
|
-
var
|
|
645
|
-
return runtime_await(
|
|
668
|
+
var _this11 = this;
|
|
669
|
+
return runtime_await(_this11.raw.text());
|
|
646
670
|
} catch (e) {
|
|
647
671
|
return Promise.reject(e);
|
|
648
672
|
}
|
|
@@ -651,8 +675,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
651
675
|
key: "blob",
|
|
652
676
|
value: function blob() {
|
|
653
677
|
try {
|
|
654
|
-
var
|
|
655
|
-
return runtime_await(
|
|
678
|
+
var _this13 = this;
|
|
679
|
+
return runtime_await(_this13.raw.blob());
|
|
656
680
|
} catch (e) {
|
|
657
681
|
return Promise.reject(e);
|
|
658
682
|
}
|
|
@@ -661,8 +685,8 @@ var BinaryResult = /*#__PURE__*/function () {
|
|
|
661
685
|
key: "json",
|
|
662
686
|
value: function json() {
|
|
663
687
|
try {
|
|
664
|
-
var
|
|
665
|
-
return runtime_await(
|
|
688
|
+
var _this15 = this;
|
|
689
|
+
return runtime_await(_this15.raw.json());
|
|
666
690
|
} catch (e) {
|
|
667
691
|
return Promise.reject(e);
|
|
668
692
|
}
|
|
@@ -1640,7 +1664,8 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1640
1664
|
value: function getBaseUrl(params, prefix) {
|
|
1641
1665
|
var _a, _b;
|
|
1642
1666
|
var cdnUrl = (_b = (_a = params.options) === null || _a === void 0 ? void 0 : _a.cdnUrl) !== null && _b !== void 0 ? _b : BytescaleApiClientConfigUtils.defaultCdnUrl;
|
|
1643
|
-
|
|
1667
|
+
var filePathEncoded = encodeURIComponent(params.filePath).replace(/%2F/g, "/");
|
|
1668
|
+
return "".concat(cdnUrl, "/").concat(params.accountId, "/").concat(prefix).concat(filePathEncoded);
|
|
1644
1669
|
}
|
|
1645
1670
|
}, {
|
|
1646
1671
|
key: "getCommonTransformationQueryParams",
|
|
@@ -2498,6 +2523,7 @@ var __lib_exports__BaseAPI = __lib_exports__.BaseAPI;
|
|
|
2498
2523
|
var __lib_exports__BinaryResult = __lib_exports__.BinaryResult;
|
|
2499
2524
|
var __lib_exports__BytescaleApiClientConfigUtils = __lib_exports__.BytescaleApiClientConfigUtils;
|
|
2500
2525
|
var __lib_exports__BytescaleApiError = __lib_exports__.BytescaleApiError;
|
|
2526
|
+
var __lib_exports__BytescaleGenericError = __lib_exports__.BytescaleGenericError;
|
|
2501
2527
|
var __lib_exports__CancelledError = __lib_exports__.CancelledError;
|
|
2502
2528
|
var __lib_exports__CommonTypesNoOp = __lib_exports__.CommonTypesNoOp;
|
|
2503
2529
|
var __lib_exports__FileApi = __lib_exports__.FileApi;
|
|
@@ -2510,4 +2536,4 @@ var __lib_exports__UrlBuilder = __lib_exports__.UrlBuilder;
|
|
|
2510
2536
|
var __lib_exports__UrlBuilderTypesNoOp = __lib_exports__.UrlBuilderTypesNoOp;
|
|
2511
2537
|
var __lib_exports__VoidApiResponse = __lib_exports__.VoidApiResponse;
|
|
2512
2538
|
var __lib_exports__querystring = __lib_exports__.querystring;
|
|
2513
|
-
export { __lib_exports__AuthManager as AuthManager, __lib_exports__BaseAPI as BaseAPI, __lib_exports__BinaryResult as BinaryResult, __lib_exports__BytescaleApiClientConfigUtils as BytescaleApiClientConfigUtils, __lib_exports__BytescaleApiError as BytescaleApiError, __lib_exports__CancelledError as CancelledError, __lib_exports__CommonTypesNoOp as CommonTypesNoOp, __lib_exports__FileApi as FileApi, __lib_exports__FolderApi as FolderApi, __lib_exports__JSONApiResponse as JSONApiResponse, __lib_exports__JobApi as JobApi, __lib_exports__UploadApi as UploadApi, __lib_exports__UploadManager as UploadManager, __lib_exports__UrlBuilder as UrlBuilder, __lib_exports__UrlBuilderTypesNoOp as UrlBuilderTypesNoOp, __lib_exports__VoidApiResponse as VoidApiResponse, __lib_exports__querystring as querystring };
|
|
2539
|
+
export { __lib_exports__AuthManager as AuthManager, __lib_exports__BaseAPI as BaseAPI, __lib_exports__BinaryResult as BinaryResult, __lib_exports__BytescaleApiClientConfigUtils as BytescaleApiClientConfigUtils, __lib_exports__BytescaleApiError as BytescaleApiError, __lib_exports__BytescaleGenericError as BytescaleGenericError, __lib_exports__CancelledError as CancelledError, __lib_exports__CommonTypesNoOp as CommonTypesNoOp, __lib_exports__FileApi as FileApi, __lib_exports__FolderApi as FolderApi, __lib_exports__JSONApiResponse as JSONApiResponse, __lib_exports__JobApi as JobApi, __lib_exports__UploadApi as UploadApi, __lib_exports__UploadManager as UploadManager, __lib_exports__UrlBuilder as UrlBuilder, __lib_exports__UrlBuilderTypesNoOp as UrlBuilderTypesNoOp, __lib_exports__VoidApiResponse as VoidApiResponse, __lib_exports__querystring as querystring };
|