@bytescale/sdk 3.28.0 → 3.30.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 +51 -12
- package/dist/browser/esm/main.mjs +53 -13
- package/dist/node/cjs/main.js +51 -12
- package/dist/node/esm/main.mjs +53 -13
- package/dist/types/public/shared/generated/runtime.d.ts +8 -0
- package/dist/worker/cjs/main.js +51 -12
- package/dist/worker/esm/main.mjs +53 -13
- package/package.json +1 -1
- package/tests/UrlBuilder.test.ts +4 -4
package/dist/browser/cjs/main.js
CHANGED
|
@@ -56,6 +56,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
56
56
|
"UrlBuilder": function() { return /* reexport */ UrlBuilder; },
|
|
57
57
|
"UrlBuilderTypesNoOp": function() { return /* reexport */ UrlBuilderTypesNoOp; },
|
|
58
58
|
"VoidApiResponse": function() { return /* reexport */ VoidApiResponse; },
|
|
59
|
+
"encodeBytescaleQuerystringKVP": function() { return /* reexport */ encodeBytescaleQuerystringKVP; },
|
|
59
60
|
"querystring": function() { return /* reexport */ querystring; }
|
|
60
61
|
});
|
|
61
62
|
|
|
@@ -290,6 +291,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
|
|
|
290
291
|
}();
|
|
291
292
|
;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
|
|
292
293
|
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); }
|
|
294
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
295
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
296
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
297
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
298
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
299
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
293
300
|
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); }
|
|
294
301
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
295
302
|
function _possibleConstructorReturn(self, call) { if (call && (runtime_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
@@ -615,8 +622,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
|
615
622
|
}
|
|
616
623
|
return runtime_createClass(BytescaleApiError);
|
|
617
624
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
625
|
+
function moveElementToEnd(array, element) {
|
|
626
|
+
return [].concat(_toConsumableArray(array.filter(function (x) {
|
|
627
|
+
return x !== element;
|
|
628
|
+
})), _toConsumableArray(array.filter(function (x) {
|
|
629
|
+
return x === element;
|
|
630
|
+
})));
|
|
631
|
+
}
|
|
618
632
|
function querystring(params) {
|
|
619
|
-
|
|
633
|
+
// The 'artifact' param must be the last param for certain transformations, such as async HLS jobs. For example,
|
|
634
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
635
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
636
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
637
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
638
|
+
// playlist to suddenly reference a different transformation.
|
|
639
|
+
var keysReordered = moveElementToEnd(Object.keys(params), "artifact");
|
|
640
|
+
return keysReordered.map(function (key) {
|
|
620
641
|
return querystringSingleKey(key, params[key]);
|
|
621
642
|
}).filter(function (part) {
|
|
622
643
|
return part.length > 0;
|
|
@@ -627,7 +648,20 @@ function querystringSingleKey(key, value) {
|
|
|
627
648
|
// Matches 'array' or 'object' (which we want).
|
|
628
649
|
return querystring(value);
|
|
629
650
|
}
|
|
630
|
-
return
|
|
651
|
+
return encodeBytescaleQuerystringKVP(key, String(value));
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Handles artifacts specially as these must use "/" instead of "%2F" in order for relative paths within the artifact's
|
|
655
|
+
* contents to work (assumes user has replaced "?" with "!"). For example, M3U8 artifacts that contain relative URLs to
|
|
656
|
+
* other M3U8s and/or media segments will only work if the user replaces "?" with "!" in the URL _and_ the artifact
|
|
657
|
+
* query param value has been written using "/" instead of "%2F", as this then means the URLs become relative to the
|
|
658
|
+
* artifact, as opposed to the file path.
|
|
659
|
+
*/
|
|
660
|
+
function encodeBytescaleQuerystringKVP(key, value) {
|
|
661
|
+
if (key === "a" || key === "artifact") {
|
|
662
|
+
return "".concat(key, "=").concat(encodeURIComponent(value).replace(/%2F/g, "/"));
|
|
663
|
+
}
|
|
664
|
+
return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
|
|
631
665
|
}
|
|
632
666
|
var JSONApiResponse = /*#__PURE__*/function () {
|
|
633
667
|
function JSONApiResponse(raw) {
|
|
@@ -1608,16 +1642,16 @@ function isDefinedEntry(object) {
|
|
|
1608
1642
|
}
|
|
1609
1643
|
;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
|
|
1610
1644
|
function UrlBuilder_typeof(obj) { "@babel/helpers - typeof"; return UrlBuilder_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; }, UrlBuilder_typeof(obj); }
|
|
1611
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) ||
|
|
1645
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1612
1646
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1613
1647
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
1614
1648
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1615
|
-
function
|
|
1616
|
-
function
|
|
1617
|
-
function
|
|
1618
|
-
function
|
|
1619
|
-
function
|
|
1620
|
-
function
|
|
1649
|
+
function UrlBuilder_toConsumableArray(arr) { return UrlBuilder_arrayWithoutHoles(arr) || UrlBuilder_iterableToArray(arr) || UrlBuilder_unsupportedIterableToArray(arr) || UrlBuilder_nonIterableSpread(); }
|
|
1650
|
+
function UrlBuilder_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1651
|
+
function UrlBuilder_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return UrlBuilder_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return UrlBuilder_arrayLikeToArray(o, minLen); }
|
|
1652
|
+
function UrlBuilder_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
1653
|
+
function UrlBuilder_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return UrlBuilder_arrayLikeToArray(arr); }
|
|
1654
|
+
function UrlBuilder_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1621
1655
|
function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1622
1656
|
function UrlBuilder_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, UrlBuilder_toPropertyKey(descriptor.key), descriptor); } }
|
|
1623
1657
|
function UrlBuilder_createClass(Constructor, protoProps, staticProps) { if (protoProps) UrlBuilder_defineProperties(Constructor.prototype, protoProps); if (staticProps) UrlBuilder_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -1672,7 +1706,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1672
1706
|
var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
|
|
1673
1707
|
var transCommonParams = this.getCommonTransformationQueryParams(trans);
|
|
1674
1708
|
// This format puts "artifact" at the end, which isn't required, but is convention.
|
|
1675
|
-
return this.addQueryParams(baseUrl, [].concat(
|
|
1709
|
+
return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
|
|
1676
1710
|
}
|
|
1677
1711
|
}, {
|
|
1678
1712
|
key: "getBaseUrl",
|
|
@@ -1688,7 +1722,12 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1688
1722
|
return this.makeQueryParams({
|
|
1689
1723
|
cacheOnly: null,
|
|
1690
1724
|
cachePermanently: null,
|
|
1691
|
-
// Keep this as the last param: this is
|
|
1725
|
+
// Keep this as the last param: this is required for certain transformations, such as async HLS jobs. For example,
|
|
1726
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
1727
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
1728
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
1729
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
1730
|
+
// playlist to suddenly reference a different transformation.
|
|
1692
1731
|
artifact: null
|
|
1693
1732
|
}, {
|
|
1694
1733
|
cacheOnly: "cache_only",
|
|
@@ -1756,7 +1795,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1756
1795
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
1757
1796
|
key = _ref4[0],
|
|
1758
1797
|
value = _ref4[1];
|
|
1759
|
-
return
|
|
1798
|
+
return encodeBytescaleQuerystringKVP(key, value);
|
|
1760
1799
|
}).join("&"));
|
|
1761
1800
|
}
|
|
1762
1801
|
}]);
|
|
@@ -41,6 +41,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
41
41
|
"UrlBuilder": function() { return /* reexport */ UrlBuilder; },
|
|
42
42
|
"UrlBuilderTypesNoOp": function() { return /* reexport */ UrlBuilderTypesNoOp; },
|
|
43
43
|
"VoidApiResponse": function() { return /* reexport */ VoidApiResponse; },
|
|
44
|
+
"encodeBytescaleQuerystringKVP": function() { return /* reexport */ encodeBytescaleQuerystringKVP; },
|
|
44
45
|
"querystring": function() { return /* reexport */ querystring; }
|
|
45
46
|
});
|
|
46
47
|
|
|
@@ -275,6 +276,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
|
|
|
275
276
|
}();
|
|
276
277
|
;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
|
|
277
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); }
|
|
279
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
280
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
281
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
282
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
283
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
284
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
278
285
|
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); }
|
|
279
286
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
280
287
|
function _possibleConstructorReturn(self, call) { if (call && (runtime_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
@@ -600,8 +607,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
|
600
607
|
}
|
|
601
608
|
return runtime_createClass(BytescaleApiError);
|
|
602
609
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
610
|
+
function moveElementToEnd(array, element) {
|
|
611
|
+
return [].concat(_toConsumableArray(array.filter(function (x) {
|
|
612
|
+
return x !== element;
|
|
613
|
+
})), _toConsumableArray(array.filter(function (x) {
|
|
614
|
+
return x === element;
|
|
615
|
+
})));
|
|
616
|
+
}
|
|
603
617
|
function querystring(params) {
|
|
604
|
-
|
|
618
|
+
// The 'artifact' param must be the last param for certain transformations, such as async HLS jobs. For example,
|
|
619
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
620
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
621
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
622
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
623
|
+
// playlist to suddenly reference a different transformation.
|
|
624
|
+
var keysReordered = moveElementToEnd(Object.keys(params), "artifact");
|
|
625
|
+
return keysReordered.map(function (key) {
|
|
605
626
|
return querystringSingleKey(key, params[key]);
|
|
606
627
|
}).filter(function (part) {
|
|
607
628
|
return part.length > 0;
|
|
@@ -612,7 +633,20 @@ function querystringSingleKey(key, value) {
|
|
|
612
633
|
// Matches 'array' or 'object' (which we want).
|
|
613
634
|
return querystring(value);
|
|
614
635
|
}
|
|
615
|
-
return
|
|
636
|
+
return encodeBytescaleQuerystringKVP(key, String(value));
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Handles artifacts specially as these must use "/" instead of "%2F" in order for relative paths within the artifact's
|
|
640
|
+
* contents to work (assumes user has replaced "?" with "!"). For example, M3U8 artifacts that contain relative URLs to
|
|
641
|
+
* other M3U8s and/or media segments will only work if the user replaces "?" with "!" in the URL _and_ the artifact
|
|
642
|
+
* query param value has been written using "/" instead of "%2F", as this then means the URLs become relative to the
|
|
643
|
+
* artifact, as opposed to the file path.
|
|
644
|
+
*/
|
|
645
|
+
function encodeBytescaleQuerystringKVP(key, value) {
|
|
646
|
+
if (key === "a" || key === "artifact") {
|
|
647
|
+
return "".concat(key, "=").concat(encodeURIComponent(value).replace(/%2F/g, "/"));
|
|
648
|
+
}
|
|
649
|
+
return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
|
|
616
650
|
}
|
|
617
651
|
var JSONApiResponse = /*#__PURE__*/function () {
|
|
618
652
|
function JSONApiResponse(raw) {
|
|
@@ -1593,16 +1627,16 @@ function isDefinedEntry(object) {
|
|
|
1593
1627
|
}
|
|
1594
1628
|
;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
|
|
1595
1629
|
function UrlBuilder_typeof(obj) { "@babel/helpers - typeof"; return UrlBuilder_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; }, UrlBuilder_typeof(obj); }
|
|
1596
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) ||
|
|
1630
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1597
1631
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1598
1632
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
1599
1633
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1600
|
-
function
|
|
1601
|
-
function
|
|
1602
|
-
function
|
|
1603
|
-
function
|
|
1604
|
-
function
|
|
1605
|
-
function
|
|
1634
|
+
function UrlBuilder_toConsumableArray(arr) { return UrlBuilder_arrayWithoutHoles(arr) || UrlBuilder_iterableToArray(arr) || UrlBuilder_unsupportedIterableToArray(arr) || UrlBuilder_nonIterableSpread(); }
|
|
1635
|
+
function UrlBuilder_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1636
|
+
function UrlBuilder_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return UrlBuilder_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return UrlBuilder_arrayLikeToArray(o, minLen); }
|
|
1637
|
+
function UrlBuilder_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
1638
|
+
function UrlBuilder_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return UrlBuilder_arrayLikeToArray(arr); }
|
|
1639
|
+
function UrlBuilder_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1606
1640
|
function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1607
1641
|
function UrlBuilder_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, UrlBuilder_toPropertyKey(descriptor.key), descriptor); } }
|
|
1608
1642
|
function UrlBuilder_createClass(Constructor, protoProps, staticProps) { if (protoProps) UrlBuilder_defineProperties(Constructor.prototype, protoProps); if (staticProps) UrlBuilder_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -1657,7 +1691,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1657
1691
|
var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
|
|
1658
1692
|
var transCommonParams = this.getCommonTransformationQueryParams(trans);
|
|
1659
1693
|
// This format puts "artifact" at the end, which isn't required, but is convention.
|
|
1660
|
-
return this.addQueryParams(baseUrl, [].concat(
|
|
1694
|
+
return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
|
|
1661
1695
|
}
|
|
1662
1696
|
}, {
|
|
1663
1697
|
key: "getBaseUrl",
|
|
@@ -1673,7 +1707,12 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1673
1707
|
return this.makeQueryParams({
|
|
1674
1708
|
cacheOnly: null,
|
|
1675
1709
|
cachePermanently: null,
|
|
1676
|
-
// Keep this as the last param: this is
|
|
1710
|
+
// Keep this as the last param: this is required for certain transformations, such as async HLS jobs. For example,
|
|
1711
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
1712
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
1713
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
1714
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
1715
|
+
// playlist to suddenly reference a different transformation.
|
|
1677
1716
|
artifact: null
|
|
1678
1717
|
}, {
|
|
1679
1718
|
cacheOnly: "cache_only",
|
|
@@ -1741,7 +1780,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1741
1780
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
1742
1781
|
key = _ref4[0],
|
|
1743
1782
|
value = _ref4[1];
|
|
1744
|
-
return
|
|
1783
|
+
return encodeBytescaleQuerystringKVP(key, value);
|
|
1745
1784
|
}).join("&"));
|
|
1746
1785
|
}
|
|
1747
1786
|
}]);
|
|
@@ -2992,5 +3031,6 @@ var __lib_exports__UploadManager = __lib_exports__.UploadManager;
|
|
|
2992
3031
|
var __lib_exports__UrlBuilder = __lib_exports__.UrlBuilder;
|
|
2993
3032
|
var __lib_exports__UrlBuilderTypesNoOp = __lib_exports__.UrlBuilderTypesNoOp;
|
|
2994
3033
|
var __lib_exports__VoidApiResponse = __lib_exports__.VoidApiResponse;
|
|
3034
|
+
var __lib_exports__encodeBytescaleQuerystringKVP = __lib_exports__.encodeBytescaleQuerystringKVP;
|
|
2995
3035
|
var __lib_exports__querystring = __lib_exports__.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 };
|
|
3036
|
+
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__encodeBytescaleQuerystringKVP as encodeBytescaleQuerystringKVP, __lib_exports__querystring as querystring };
|
package/dist/node/cjs/main.js
CHANGED
|
@@ -56,6 +56,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
56
56
|
"UrlBuilder": function() { return /* reexport */ UrlBuilder; },
|
|
57
57
|
"UrlBuilderTypesNoOp": function() { return /* reexport */ UrlBuilderTypesNoOp; },
|
|
58
58
|
"VoidApiResponse": function() { return /* reexport */ VoidApiResponse; },
|
|
59
|
+
"encodeBytescaleQuerystringKVP": function() { return /* reexport */ encodeBytescaleQuerystringKVP; },
|
|
59
60
|
"querystring": function() { return /* reexport */ querystring; }
|
|
60
61
|
});
|
|
61
62
|
|
|
@@ -290,6 +291,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
|
|
|
290
291
|
}();
|
|
291
292
|
;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
|
|
292
293
|
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); }
|
|
294
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
295
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
296
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
297
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
298
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
299
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
293
300
|
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); }
|
|
294
301
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
295
302
|
function _possibleConstructorReturn(self, call) { if (call && (runtime_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
@@ -615,8 +622,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
|
615
622
|
}
|
|
616
623
|
return runtime_createClass(BytescaleApiError);
|
|
617
624
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
625
|
+
function moveElementToEnd(array, element) {
|
|
626
|
+
return [].concat(_toConsumableArray(array.filter(function (x) {
|
|
627
|
+
return x !== element;
|
|
628
|
+
})), _toConsumableArray(array.filter(function (x) {
|
|
629
|
+
return x === element;
|
|
630
|
+
})));
|
|
631
|
+
}
|
|
618
632
|
function querystring(params) {
|
|
619
|
-
|
|
633
|
+
// The 'artifact' param must be the last param for certain transformations, such as async HLS jobs. For example,
|
|
634
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
635
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
636
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
637
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
638
|
+
// playlist to suddenly reference a different transformation.
|
|
639
|
+
var keysReordered = moveElementToEnd(Object.keys(params), "artifact");
|
|
640
|
+
return keysReordered.map(function (key) {
|
|
620
641
|
return querystringSingleKey(key, params[key]);
|
|
621
642
|
}).filter(function (part) {
|
|
622
643
|
return part.length > 0;
|
|
@@ -627,7 +648,20 @@ function querystringSingleKey(key, value) {
|
|
|
627
648
|
// Matches 'array' or 'object' (which we want).
|
|
628
649
|
return querystring(value);
|
|
629
650
|
}
|
|
630
|
-
return
|
|
651
|
+
return encodeBytescaleQuerystringKVP(key, String(value));
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Handles artifacts specially as these must use "/" instead of "%2F" in order for relative paths within the artifact's
|
|
655
|
+
* contents to work (assumes user has replaced "?" with "!"). For example, M3U8 artifacts that contain relative URLs to
|
|
656
|
+
* other M3U8s and/or media segments will only work if the user replaces "?" with "!" in the URL _and_ the artifact
|
|
657
|
+
* query param value has been written using "/" instead of "%2F", as this then means the URLs become relative to the
|
|
658
|
+
* artifact, as opposed to the file path.
|
|
659
|
+
*/
|
|
660
|
+
function encodeBytescaleQuerystringKVP(key, value) {
|
|
661
|
+
if (key === "a" || key === "artifact") {
|
|
662
|
+
return "".concat(key, "=").concat(encodeURIComponent(value).replace(/%2F/g, "/"));
|
|
663
|
+
}
|
|
664
|
+
return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
|
|
631
665
|
}
|
|
632
666
|
var JSONApiResponse = /*#__PURE__*/function () {
|
|
633
667
|
function JSONApiResponse(raw) {
|
|
@@ -1608,16 +1642,16 @@ function isDefinedEntry(object) {
|
|
|
1608
1642
|
}
|
|
1609
1643
|
;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
|
|
1610
1644
|
function UrlBuilder_typeof(obj) { "@babel/helpers - typeof"; return UrlBuilder_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; }, UrlBuilder_typeof(obj); }
|
|
1611
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) ||
|
|
1645
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1612
1646
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1613
1647
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
1614
1648
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1615
|
-
function
|
|
1616
|
-
function
|
|
1617
|
-
function
|
|
1618
|
-
function
|
|
1619
|
-
function
|
|
1620
|
-
function
|
|
1649
|
+
function UrlBuilder_toConsumableArray(arr) { return UrlBuilder_arrayWithoutHoles(arr) || UrlBuilder_iterableToArray(arr) || UrlBuilder_unsupportedIterableToArray(arr) || UrlBuilder_nonIterableSpread(); }
|
|
1650
|
+
function UrlBuilder_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1651
|
+
function UrlBuilder_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return UrlBuilder_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return UrlBuilder_arrayLikeToArray(o, minLen); }
|
|
1652
|
+
function UrlBuilder_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
1653
|
+
function UrlBuilder_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return UrlBuilder_arrayLikeToArray(arr); }
|
|
1654
|
+
function UrlBuilder_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1621
1655
|
function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1622
1656
|
function UrlBuilder_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, UrlBuilder_toPropertyKey(descriptor.key), descriptor); } }
|
|
1623
1657
|
function UrlBuilder_createClass(Constructor, protoProps, staticProps) { if (protoProps) UrlBuilder_defineProperties(Constructor.prototype, protoProps); if (staticProps) UrlBuilder_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -1672,7 +1706,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1672
1706
|
var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
|
|
1673
1707
|
var transCommonParams = this.getCommonTransformationQueryParams(trans);
|
|
1674
1708
|
// This format puts "artifact" at the end, which isn't required, but is convention.
|
|
1675
|
-
return this.addQueryParams(baseUrl, [].concat(
|
|
1709
|
+
return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
|
|
1676
1710
|
}
|
|
1677
1711
|
}, {
|
|
1678
1712
|
key: "getBaseUrl",
|
|
@@ -1688,7 +1722,12 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1688
1722
|
return this.makeQueryParams({
|
|
1689
1723
|
cacheOnly: null,
|
|
1690
1724
|
cachePermanently: null,
|
|
1691
|
-
// Keep this as the last param: this is
|
|
1725
|
+
// Keep this as the last param: this is required for certain transformations, such as async HLS jobs. For example,
|
|
1726
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
1727
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
1728
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
1729
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
1730
|
+
// playlist to suddenly reference a different transformation.
|
|
1692
1731
|
artifact: null
|
|
1693
1732
|
}, {
|
|
1694
1733
|
cacheOnly: "cache_only",
|
|
@@ -1756,7 +1795,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1756
1795
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
1757
1796
|
key = _ref4[0],
|
|
1758
1797
|
value = _ref4[1];
|
|
1759
|
-
return
|
|
1798
|
+
return encodeBytescaleQuerystringKVP(key, value);
|
|
1760
1799
|
}).join("&"));
|
|
1761
1800
|
}
|
|
1762
1801
|
}]);
|
package/dist/node/esm/main.mjs
CHANGED
|
@@ -43,6 +43,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
43
43
|
"UrlBuilder": function() { return /* reexport */ UrlBuilder; },
|
|
44
44
|
"UrlBuilderTypesNoOp": function() { return /* reexport */ UrlBuilderTypesNoOp; },
|
|
45
45
|
"VoidApiResponse": function() { return /* reexport */ VoidApiResponse; },
|
|
46
|
+
"encodeBytescaleQuerystringKVP": function() { return /* reexport */ encodeBytescaleQuerystringKVP; },
|
|
46
47
|
"querystring": function() { return /* reexport */ querystring; }
|
|
47
48
|
});
|
|
48
49
|
|
|
@@ -277,6 +278,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
|
|
|
277
278
|
}();
|
|
278
279
|
;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
|
|
279
280
|
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); }
|
|
281
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
282
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
283
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
284
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
285
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
286
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
280
287
|
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); }
|
|
281
288
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
282
289
|
function _possibleConstructorReturn(self, call) { if (call && (runtime_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
@@ -602,8 +609,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
|
602
609
|
}
|
|
603
610
|
return runtime_createClass(BytescaleApiError);
|
|
604
611
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
612
|
+
function moveElementToEnd(array, element) {
|
|
613
|
+
return [].concat(_toConsumableArray(array.filter(function (x) {
|
|
614
|
+
return x !== element;
|
|
615
|
+
})), _toConsumableArray(array.filter(function (x) {
|
|
616
|
+
return x === element;
|
|
617
|
+
})));
|
|
618
|
+
}
|
|
605
619
|
function querystring(params) {
|
|
606
|
-
|
|
620
|
+
// The 'artifact' param must be the last param for certain transformations, such as async HLS jobs. For example,
|
|
621
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
622
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
623
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
624
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
625
|
+
// playlist to suddenly reference a different transformation.
|
|
626
|
+
var keysReordered = moveElementToEnd(Object.keys(params), "artifact");
|
|
627
|
+
return keysReordered.map(function (key) {
|
|
607
628
|
return querystringSingleKey(key, params[key]);
|
|
608
629
|
}).filter(function (part) {
|
|
609
630
|
return part.length > 0;
|
|
@@ -614,7 +635,20 @@ function querystringSingleKey(key, value) {
|
|
|
614
635
|
// Matches 'array' or 'object' (which we want).
|
|
615
636
|
return querystring(value);
|
|
616
637
|
}
|
|
617
|
-
return
|
|
638
|
+
return encodeBytescaleQuerystringKVP(key, String(value));
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Handles artifacts specially as these must use "/" instead of "%2F" in order for relative paths within the artifact's
|
|
642
|
+
* contents to work (assumes user has replaced "?" with "!"). For example, M3U8 artifacts that contain relative URLs to
|
|
643
|
+
* other M3U8s and/or media segments will only work if the user replaces "?" with "!" in the URL _and_ the artifact
|
|
644
|
+
* query param value has been written using "/" instead of "%2F", as this then means the URLs become relative to the
|
|
645
|
+
* artifact, as opposed to the file path.
|
|
646
|
+
*/
|
|
647
|
+
function encodeBytescaleQuerystringKVP(key, value) {
|
|
648
|
+
if (key === "a" || key === "artifact") {
|
|
649
|
+
return "".concat(key, "=").concat(encodeURIComponent(value).replace(/%2F/g, "/"));
|
|
650
|
+
}
|
|
651
|
+
return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
|
|
618
652
|
}
|
|
619
653
|
var JSONApiResponse = /*#__PURE__*/function () {
|
|
620
654
|
function JSONApiResponse(raw) {
|
|
@@ -1595,16 +1629,16 @@ function isDefinedEntry(object) {
|
|
|
1595
1629
|
}
|
|
1596
1630
|
;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
|
|
1597
1631
|
function UrlBuilder_typeof(obj) { "@babel/helpers - typeof"; return UrlBuilder_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; }, UrlBuilder_typeof(obj); }
|
|
1598
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) ||
|
|
1632
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1599
1633
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1600
1634
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
1601
1635
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1602
|
-
function
|
|
1603
|
-
function
|
|
1604
|
-
function
|
|
1605
|
-
function
|
|
1606
|
-
function
|
|
1607
|
-
function
|
|
1636
|
+
function UrlBuilder_toConsumableArray(arr) { return UrlBuilder_arrayWithoutHoles(arr) || UrlBuilder_iterableToArray(arr) || UrlBuilder_unsupportedIterableToArray(arr) || UrlBuilder_nonIterableSpread(); }
|
|
1637
|
+
function UrlBuilder_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1638
|
+
function UrlBuilder_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return UrlBuilder_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return UrlBuilder_arrayLikeToArray(o, minLen); }
|
|
1639
|
+
function UrlBuilder_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
1640
|
+
function UrlBuilder_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return UrlBuilder_arrayLikeToArray(arr); }
|
|
1641
|
+
function UrlBuilder_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1608
1642
|
function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1609
1643
|
function UrlBuilder_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, UrlBuilder_toPropertyKey(descriptor.key), descriptor); } }
|
|
1610
1644
|
function UrlBuilder_createClass(Constructor, protoProps, staticProps) { if (protoProps) UrlBuilder_defineProperties(Constructor.prototype, protoProps); if (staticProps) UrlBuilder_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -1659,7 +1693,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1659
1693
|
var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
|
|
1660
1694
|
var transCommonParams = this.getCommonTransformationQueryParams(trans);
|
|
1661
1695
|
// This format puts "artifact" at the end, which isn't required, but is convention.
|
|
1662
|
-
return this.addQueryParams(baseUrl, [].concat(
|
|
1696
|
+
return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
|
|
1663
1697
|
}
|
|
1664
1698
|
}, {
|
|
1665
1699
|
key: "getBaseUrl",
|
|
@@ -1675,7 +1709,12 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1675
1709
|
return this.makeQueryParams({
|
|
1676
1710
|
cacheOnly: null,
|
|
1677
1711
|
cachePermanently: null,
|
|
1678
|
-
// Keep this as the last param: this is
|
|
1712
|
+
// Keep this as the last param: this is required for certain transformations, such as async HLS jobs. For example,
|
|
1713
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
1714
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
1715
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
1716
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
1717
|
+
// playlist to suddenly reference a different transformation.
|
|
1679
1718
|
artifact: null
|
|
1680
1719
|
}, {
|
|
1681
1720
|
cacheOnly: "cache_only",
|
|
@@ -1743,7 +1782,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1743
1782
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
1744
1783
|
key = _ref4[0],
|
|
1745
1784
|
value = _ref4[1];
|
|
1746
|
-
return
|
|
1785
|
+
return encodeBytescaleQuerystringKVP(key, value);
|
|
1747
1786
|
}).join("&"));
|
|
1748
1787
|
}
|
|
1749
1788
|
}]);
|
|
@@ -3010,5 +3049,6 @@ var __lib_exports__UploadManager = __lib_exports__.UploadManager;
|
|
|
3010
3049
|
var __lib_exports__UrlBuilder = __lib_exports__.UrlBuilder;
|
|
3011
3050
|
var __lib_exports__UrlBuilderTypesNoOp = __lib_exports__.UrlBuilderTypesNoOp;
|
|
3012
3051
|
var __lib_exports__VoidApiResponse = __lib_exports__.VoidApiResponse;
|
|
3052
|
+
var __lib_exports__encodeBytescaleQuerystringKVP = __lib_exports__.encodeBytescaleQuerystringKVP;
|
|
3013
3053
|
var __lib_exports__querystring = __lib_exports__.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 };
|
|
3054
|
+
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__encodeBytescaleQuerystringKVP as encodeBytescaleQuerystringKVP, __lib_exports__querystring as querystring };
|
|
@@ -120,6 +120,14 @@ export interface RequestOpts {
|
|
|
120
120
|
body?: HTTPBody;
|
|
121
121
|
}
|
|
122
122
|
export declare function querystring(params: HTTPQuery): string;
|
|
123
|
+
/**
|
|
124
|
+
* Handles artifacts specially as these must use "/" instead of "%2F" in order for relative paths within the artifact's
|
|
125
|
+
* contents to work (assumes user has replaced "?" with "!"). For example, M3U8 artifacts that contain relative URLs to
|
|
126
|
+
* other M3U8s and/or media segments will only work if the user replaces "?" with "!" in the URL _and_ the artifact
|
|
127
|
+
* query param value has been written using "/" instead of "%2F", as this then means the URLs become relative to the
|
|
128
|
+
* artifact, as opposed to the file path.
|
|
129
|
+
*/
|
|
130
|
+
export declare function encodeBytescaleQuerystringKVP(key: string, value: string): string;
|
|
123
131
|
export interface ApiResponse<T> {
|
|
124
132
|
raw: Response;
|
|
125
133
|
value(): Promise<T>;
|
package/dist/worker/cjs/main.js
CHANGED
|
@@ -56,6 +56,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
56
56
|
"UrlBuilder": function() { return /* reexport */ UrlBuilder; },
|
|
57
57
|
"UrlBuilderTypesNoOp": function() { return /* reexport */ UrlBuilderTypesNoOp; },
|
|
58
58
|
"VoidApiResponse": function() { return /* reexport */ VoidApiResponse; },
|
|
59
|
+
"encodeBytescaleQuerystringKVP": function() { return /* reexport */ encodeBytescaleQuerystringKVP; },
|
|
59
60
|
"querystring": function() { return /* reexport */ querystring; }
|
|
60
61
|
});
|
|
61
62
|
|
|
@@ -290,6 +291,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
|
|
|
290
291
|
}();
|
|
291
292
|
;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
|
|
292
293
|
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); }
|
|
294
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
295
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
296
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
297
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
298
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
299
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
293
300
|
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); }
|
|
294
301
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
295
302
|
function _possibleConstructorReturn(self, call) { if (call && (runtime_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
@@ -615,8 +622,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
|
615
622
|
}
|
|
616
623
|
return runtime_createClass(BytescaleApiError);
|
|
617
624
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
625
|
+
function moveElementToEnd(array, element) {
|
|
626
|
+
return [].concat(_toConsumableArray(array.filter(function (x) {
|
|
627
|
+
return x !== element;
|
|
628
|
+
})), _toConsumableArray(array.filter(function (x) {
|
|
629
|
+
return x === element;
|
|
630
|
+
})));
|
|
631
|
+
}
|
|
618
632
|
function querystring(params) {
|
|
619
|
-
|
|
633
|
+
// The 'artifact' param must be the last param for certain transformations, such as async HLS jobs. For example,
|
|
634
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
635
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
636
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
637
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
638
|
+
// playlist to suddenly reference a different transformation.
|
|
639
|
+
var keysReordered = moveElementToEnd(Object.keys(params), "artifact");
|
|
640
|
+
return keysReordered.map(function (key) {
|
|
620
641
|
return querystringSingleKey(key, params[key]);
|
|
621
642
|
}).filter(function (part) {
|
|
622
643
|
return part.length > 0;
|
|
@@ -627,7 +648,20 @@ function querystringSingleKey(key, value) {
|
|
|
627
648
|
// Matches 'array' or 'object' (which we want).
|
|
628
649
|
return querystring(value);
|
|
629
650
|
}
|
|
630
|
-
return
|
|
651
|
+
return encodeBytescaleQuerystringKVP(key, String(value));
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Handles artifacts specially as these must use "/" instead of "%2F" in order for relative paths within the artifact's
|
|
655
|
+
* contents to work (assumes user has replaced "?" with "!"). For example, M3U8 artifacts that contain relative URLs to
|
|
656
|
+
* other M3U8s and/or media segments will only work if the user replaces "?" with "!" in the URL _and_ the artifact
|
|
657
|
+
* query param value has been written using "/" instead of "%2F", as this then means the URLs become relative to the
|
|
658
|
+
* artifact, as opposed to the file path.
|
|
659
|
+
*/
|
|
660
|
+
function encodeBytescaleQuerystringKVP(key, value) {
|
|
661
|
+
if (key === "a" || key === "artifact") {
|
|
662
|
+
return "".concat(key, "=").concat(encodeURIComponent(value).replace(/%2F/g, "/"));
|
|
663
|
+
}
|
|
664
|
+
return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
|
|
631
665
|
}
|
|
632
666
|
var JSONApiResponse = /*#__PURE__*/function () {
|
|
633
667
|
function JSONApiResponse(raw) {
|
|
@@ -1608,16 +1642,16 @@ function isDefinedEntry(object) {
|
|
|
1608
1642
|
}
|
|
1609
1643
|
;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
|
|
1610
1644
|
function UrlBuilder_typeof(obj) { "@babel/helpers - typeof"; return UrlBuilder_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; }, UrlBuilder_typeof(obj); }
|
|
1611
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) ||
|
|
1645
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1612
1646
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1613
1647
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
1614
1648
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1615
|
-
function
|
|
1616
|
-
function
|
|
1617
|
-
function
|
|
1618
|
-
function
|
|
1619
|
-
function
|
|
1620
|
-
function
|
|
1649
|
+
function UrlBuilder_toConsumableArray(arr) { return UrlBuilder_arrayWithoutHoles(arr) || UrlBuilder_iterableToArray(arr) || UrlBuilder_unsupportedIterableToArray(arr) || UrlBuilder_nonIterableSpread(); }
|
|
1650
|
+
function UrlBuilder_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1651
|
+
function UrlBuilder_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return UrlBuilder_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return UrlBuilder_arrayLikeToArray(o, minLen); }
|
|
1652
|
+
function UrlBuilder_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
1653
|
+
function UrlBuilder_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return UrlBuilder_arrayLikeToArray(arr); }
|
|
1654
|
+
function UrlBuilder_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1621
1655
|
function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1622
1656
|
function UrlBuilder_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, UrlBuilder_toPropertyKey(descriptor.key), descriptor); } }
|
|
1623
1657
|
function UrlBuilder_createClass(Constructor, protoProps, staticProps) { if (protoProps) UrlBuilder_defineProperties(Constructor.prototype, protoProps); if (staticProps) UrlBuilder_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -1672,7 +1706,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1672
1706
|
var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
|
|
1673
1707
|
var transCommonParams = this.getCommonTransformationQueryParams(trans);
|
|
1674
1708
|
// This format puts "artifact" at the end, which isn't required, but is convention.
|
|
1675
|
-
return this.addQueryParams(baseUrl, [].concat(
|
|
1709
|
+
return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
|
|
1676
1710
|
}
|
|
1677
1711
|
}, {
|
|
1678
1712
|
key: "getBaseUrl",
|
|
@@ -1688,7 +1722,12 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1688
1722
|
return this.makeQueryParams({
|
|
1689
1723
|
cacheOnly: null,
|
|
1690
1724
|
cachePermanently: null,
|
|
1691
|
-
// Keep this as the last param: this is
|
|
1725
|
+
// Keep this as the last param: this is required for certain transformations, such as async HLS jobs. For example,
|
|
1726
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
1727
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
1728
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
1729
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
1730
|
+
// playlist to suddenly reference a different transformation.
|
|
1692
1731
|
artifact: null
|
|
1693
1732
|
}, {
|
|
1694
1733
|
cacheOnly: "cache_only",
|
|
@@ -1756,7 +1795,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1756
1795
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
1757
1796
|
key = _ref4[0],
|
|
1758
1797
|
value = _ref4[1];
|
|
1759
|
-
return
|
|
1798
|
+
return encodeBytescaleQuerystringKVP(key, value);
|
|
1760
1799
|
}).join("&"));
|
|
1761
1800
|
}
|
|
1762
1801
|
}]);
|
package/dist/worker/esm/main.mjs
CHANGED
|
@@ -41,6 +41,7 @@ __lib_require__.d(__lib_exports__, {
|
|
|
41
41
|
"UrlBuilder": function() { return /* reexport */ UrlBuilder; },
|
|
42
42
|
"UrlBuilderTypesNoOp": function() { return /* reexport */ UrlBuilderTypesNoOp; },
|
|
43
43
|
"VoidApiResponse": function() { return /* reexport */ VoidApiResponse; },
|
|
44
|
+
"encodeBytescaleQuerystringKVP": function() { return /* reexport */ encodeBytescaleQuerystringKVP; },
|
|
44
45
|
"querystring": function() { return /* reexport */ querystring; }
|
|
45
46
|
});
|
|
46
47
|
|
|
@@ -275,6 +276,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
|
|
|
275
276
|
}();
|
|
276
277
|
;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
|
|
277
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); }
|
|
279
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
280
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
281
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
282
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
283
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
284
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
278
285
|
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); }
|
|
279
286
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
280
287
|
function _possibleConstructorReturn(self, call) { if (call && (runtime_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
@@ -600,8 +607,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
|
|
|
600
607
|
}
|
|
601
608
|
return runtime_createClass(BytescaleApiError);
|
|
602
609
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
610
|
+
function moveElementToEnd(array, element) {
|
|
611
|
+
return [].concat(_toConsumableArray(array.filter(function (x) {
|
|
612
|
+
return x !== element;
|
|
613
|
+
})), _toConsumableArray(array.filter(function (x) {
|
|
614
|
+
return x === element;
|
|
615
|
+
})));
|
|
616
|
+
}
|
|
603
617
|
function querystring(params) {
|
|
604
|
-
|
|
618
|
+
// The 'artifact' param must be the last param for certain transformations, such as async HLS jobs. For example,
|
|
619
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
620
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
621
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
622
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
623
|
+
// playlist to suddenly reference a different transformation.
|
|
624
|
+
var keysReordered = moveElementToEnd(Object.keys(params), "artifact");
|
|
625
|
+
return keysReordered.map(function (key) {
|
|
605
626
|
return querystringSingleKey(key, params[key]);
|
|
606
627
|
}).filter(function (part) {
|
|
607
628
|
return part.length > 0;
|
|
@@ -612,7 +633,20 @@ function querystringSingleKey(key, value) {
|
|
|
612
633
|
// Matches 'array' or 'object' (which we want).
|
|
613
634
|
return querystring(value);
|
|
614
635
|
}
|
|
615
|
-
return
|
|
636
|
+
return encodeBytescaleQuerystringKVP(key, String(value));
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Handles artifacts specially as these must use "/" instead of "%2F" in order for relative paths within the artifact's
|
|
640
|
+
* contents to work (assumes user has replaced "?" with "!"). For example, M3U8 artifacts that contain relative URLs to
|
|
641
|
+
* other M3U8s and/or media segments will only work if the user replaces "?" with "!" in the URL _and_ the artifact
|
|
642
|
+
* query param value has been written using "/" instead of "%2F", as this then means the URLs become relative to the
|
|
643
|
+
* artifact, as opposed to the file path.
|
|
644
|
+
*/
|
|
645
|
+
function encodeBytescaleQuerystringKVP(key, value) {
|
|
646
|
+
if (key === "a" || key === "artifact") {
|
|
647
|
+
return "".concat(key, "=").concat(encodeURIComponent(value).replace(/%2F/g, "/"));
|
|
648
|
+
}
|
|
649
|
+
return "".concat(encodeURIComponent(key), "=").concat(encodeURIComponent(value));
|
|
616
650
|
}
|
|
617
651
|
var JSONApiResponse = /*#__PURE__*/function () {
|
|
618
652
|
function JSONApiResponse(raw) {
|
|
@@ -1593,16 +1627,16 @@ function isDefinedEntry(object) {
|
|
|
1593
1627
|
}
|
|
1594
1628
|
;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
|
|
1595
1629
|
function UrlBuilder_typeof(obj) { "@babel/helpers - typeof"; return UrlBuilder_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; }, UrlBuilder_typeof(obj); }
|
|
1596
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) ||
|
|
1630
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
1597
1631
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1598
1632
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
1599
1633
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1600
|
-
function
|
|
1601
|
-
function
|
|
1602
|
-
function
|
|
1603
|
-
function
|
|
1604
|
-
function
|
|
1605
|
-
function
|
|
1634
|
+
function UrlBuilder_toConsumableArray(arr) { return UrlBuilder_arrayWithoutHoles(arr) || UrlBuilder_iterableToArray(arr) || UrlBuilder_unsupportedIterableToArray(arr) || UrlBuilder_nonIterableSpread(); }
|
|
1635
|
+
function UrlBuilder_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
1636
|
+
function UrlBuilder_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return UrlBuilder_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return UrlBuilder_arrayLikeToArray(o, minLen); }
|
|
1637
|
+
function UrlBuilder_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
1638
|
+
function UrlBuilder_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return UrlBuilder_arrayLikeToArray(arr); }
|
|
1639
|
+
function UrlBuilder_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1606
1640
|
function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1607
1641
|
function UrlBuilder_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, UrlBuilder_toPropertyKey(descriptor.key), descriptor); } }
|
|
1608
1642
|
function UrlBuilder_createClass(Constructor, protoProps, staticProps) { if (protoProps) UrlBuilder_defineProperties(Constructor.prototype, protoProps); if (staticProps) UrlBuilder_defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -1657,7 +1691,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1657
1691
|
var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
|
|
1658
1692
|
var transCommonParams = this.getCommonTransformationQueryParams(trans);
|
|
1659
1693
|
// This format puts "artifact" at the end, which isn't required, but is convention.
|
|
1660
|
-
return this.addQueryParams(baseUrl, [].concat(
|
|
1694
|
+
return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
|
|
1661
1695
|
}
|
|
1662
1696
|
}, {
|
|
1663
1697
|
key: "getBaseUrl",
|
|
@@ -1673,7 +1707,12 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1673
1707
|
return this.makeQueryParams({
|
|
1674
1708
|
cacheOnly: null,
|
|
1675
1709
|
cachePermanently: null,
|
|
1676
|
-
// Keep this as the last param: this is
|
|
1710
|
+
// Keep this as the last param: this is required for certain transformations, such as async HLS jobs. For example,
|
|
1711
|
+
// given an artifact '!f=hls-h264&artifact=/video.m3u8' that returns a master M3U8 playlist containing relative
|
|
1712
|
+
// links to child M3U8 playlists (e.g. 'child1.m3u8'), when the child URLs inside the master M3U8 file are resolved
|
|
1713
|
+
// by the browser, the 'child1.m3u8' path essentially replaces everything after the '/' on the master M3U8 URL.
|
|
1714
|
+
// Thus, if query params existed after the 'artifact' param, they would be wiped out, causing the child M3U8
|
|
1715
|
+
// playlist to suddenly reference a different transformation.
|
|
1677
1716
|
artifact: null
|
|
1678
1717
|
}, {
|
|
1679
1718
|
cacheOnly: "cache_only",
|
|
@@ -1741,7 +1780,7 @@ var UrlBuilder = /*#__PURE__*/function () {
|
|
|
1741
1780
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
1742
1781
|
key = _ref4[0],
|
|
1743
1782
|
value = _ref4[1];
|
|
1744
|
-
return
|
|
1783
|
+
return encodeBytescaleQuerystringKVP(key, value);
|
|
1745
1784
|
}).join("&"));
|
|
1746
1785
|
}
|
|
1747
1786
|
}]);
|
|
@@ -2535,5 +2574,6 @@ var __lib_exports__UploadManager = __lib_exports__.UploadManager;
|
|
|
2535
2574
|
var __lib_exports__UrlBuilder = __lib_exports__.UrlBuilder;
|
|
2536
2575
|
var __lib_exports__UrlBuilderTypesNoOp = __lib_exports__.UrlBuilderTypesNoOp;
|
|
2537
2576
|
var __lib_exports__VoidApiResponse = __lib_exports__.VoidApiResponse;
|
|
2577
|
+
var __lib_exports__encodeBytescaleQuerystringKVP = __lib_exports__.encodeBytescaleQuerystringKVP;
|
|
2538
2578
|
var __lib_exports__querystring = __lib_exports__.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 };
|
|
2579
|
+
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__encodeBytescaleQuerystringKVP as encodeBytescaleQuerystringKVP, __lib_exports__querystring as querystring };
|
package/package.json
CHANGED
package/tests/UrlBuilder.test.ts
CHANGED
|
@@ -49,7 +49,7 @@ describe("UrlBuilder", () => {
|
|
|
49
49
|
filePath: "/example.jpg",
|
|
50
50
|
options: { transformation: "preset", transformationPreset: "thumbnail", artifact: "/foo" }
|
|
51
51
|
});
|
|
52
|
-
const expected = "https://upcdn.io/1234abc/thumbnail/example.jpg?artifact
|
|
52
|
+
const expected = "https://upcdn.io/1234abc/thumbnail/example.jpg?artifact=/foo";
|
|
53
53
|
expect(actual).toEqual(expected);
|
|
54
54
|
});
|
|
55
55
|
|
|
@@ -59,7 +59,7 @@ describe("UrlBuilder", () => {
|
|
|
59
59
|
filePath: "/example.jpg",
|
|
60
60
|
options: { transformation: "preset", transformationPreset: "thumbnail", artifact: "/foo" }
|
|
61
61
|
});
|
|
62
|
-
const expected = "https://upcdn.io/1234abc/thumbnail/example.jpg?artifact
|
|
62
|
+
const expected = "https://upcdn.io/1234abc/thumbnail/example.jpg?artifact=/foo";
|
|
63
63
|
expect(actual).toEqual(expected);
|
|
64
64
|
});
|
|
65
65
|
|
|
@@ -74,7 +74,7 @@ describe("UrlBuilder", () => {
|
|
|
74
74
|
cachePermanently: false
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
-
const expected = "https://upcdn.io/1234abc/thumbnail/example.jpg?cache_perm=false&artifact
|
|
77
|
+
const expected = "https://upcdn.io/1234abc/thumbnail/example.jpg?cache_perm=false&artifact=/foo";
|
|
78
78
|
expect(actual).toEqual(expected);
|
|
79
79
|
});
|
|
80
80
|
|
|
@@ -121,7 +121,7 @@ describe("UrlBuilder", () => {
|
|
|
121
121
|
auth: true
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
const expected = "https://upcdn.io/1234abc/image/example.jpg?w=42&h=50&version=50&cache_perm=auto&artifact
|
|
124
|
+
const expected = "https://upcdn.io/1234abc/image/example.jpg?w=42&h=50&version=50&cache_perm=auto&artifact=/foo";
|
|
125
125
|
expect(actual).toEqual(expected);
|
|
126
126
|
});
|
|
127
127
|
|