@bytescale/sdk 3.29.0 → 3.31.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.
@@ -291,6 +291,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
291
291
  }();
292
292
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
293
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; }
294
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); }
295
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); }; }
296
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); }
@@ -616,8 +622,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
616
622
  }
617
623
  return runtime_createClass(BytescaleApiError);
618
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
+ }
619
632
  function querystring(params) {
620
- return Object.keys(params).map(function (key) {
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) {
621
641
  return querystringSingleKey(key, params[key]);
622
642
  }).filter(function (part) {
623
643
  return part.length > 0;
@@ -1622,16 +1642,16 @@ function isDefinedEntry(object) {
1622
1642
  }
1623
1643
  ;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
1624
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); }
1625
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1645
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1626
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."); }
1627
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; } }
1628
1648
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1629
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1630
- 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."); }
1631
- 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); }
1632
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1633
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1634
- 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; }
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; }
1635
1655
  function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1636
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); } }
1637
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; }
@@ -1686,7 +1706,7 @@ var UrlBuilder = /*#__PURE__*/function () {
1686
1706
  var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1687
1707
  var transCommonParams = this.getCommonTransformationQueryParams(trans);
1688
1708
  // This format puts "artifact" at the end, which isn't required, but is convention.
1689
- return this.addQueryParams(baseUrl, [].concat(_toConsumableArray(transParams), _toConsumableArray(commonParams), _toConsumableArray(transCommonParams)));
1709
+ return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
1690
1710
  }
1691
1711
  }, {
1692
1712
  key: "getBaseUrl",
@@ -1702,7 +1722,12 @@ var UrlBuilder = /*#__PURE__*/function () {
1702
1722
  return this.makeQueryParams({
1703
1723
  cacheOnly: null,
1704
1724
  cachePermanently: null,
1705
- // Keep this as the last param: this is the convention for transformation URLs (although not required).
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.
1706
1731
  artifact: null
1707
1732
  }, {
1708
1733
  cacheOnly: "cache_only",
@@ -276,6 +276,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
276
276
  }();
277
277
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
278
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; }
279
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); }
280
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); }; }
281
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); }
@@ -601,8 +607,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
601
607
  }
602
608
  return runtime_createClass(BytescaleApiError);
603
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
+ }
604
617
  function querystring(params) {
605
- return Object.keys(params).map(function (key) {
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) {
606
626
  return querystringSingleKey(key, params[key]);
607
627
  }).filter(function (part) {
608
628
  return part.length > 0;
@@ -1607,16 +1627,16 @@ function isDefinedEntry(object) {
1607
1627
  }
1608
1628
  ;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
1609
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); }
1610
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1630
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1611
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."); }
1612
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; } }
1613
1633
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1614
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1615
- 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."); }
1616
- 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); }
1617
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1618
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1619
- 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; }
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; }
1620
1640
  function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1621
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); } }
1622
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; }
@@ -1671,7 +1691,7 @@ var UrlBuilder = /*#__PURE__*/function () {
1671
1691
  var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1672
1692
  var transCommonParams = this.getCommonTransformationQueryParams(trans);
1673
1693
  // This format puts "artifact" at the end, which isn't required, but is convention.
1674
- return this.addQueryParams(baseUrl, [].concat(_toConsumableArray(transParams), _toConsumableArray(commonParams), _toConsumableArray(transCommonParams)));
1694
+ return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
1675
1695
  }
1676
1696
  }, {
1677
1697
  key: "getBaseUrl",
@@ -1687,7 +1707,12 @@ var UrlBuilder = /*#__PURE__*/function () {
1687
1707
  return this.makeQueryParams({
1688
1708
  cacheOnly: null,
1689
1709
  cachePermanently: null,
1690
- // Keep this as the last param: this is the convention for transformation URLs (although not required).
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.
1691
1716
  artifact: null
1692
1717
  }, {
1693
1718
  cacheOnly: "cache_only",
@@ -291,6 +291,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
291
291
  }();
292
292
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
293
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; }
294
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); }
295
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); }; }
296
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); }
@@ -616,8 +622,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
616
622
  }
617
623
  return runtime_createClass(BytescaleApiError);
618
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
+ }
619
632
  function querystring(params) {
620
- return Object.keys(params).map(function (key) {
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) {
621
641
  return querystringSingleKey(key, params[key]);
622
642
  }).filter(function (part) {
623
643
  return part.length > 0;
@@ -1622,16 +1642,16 @@ function isDefinedEntry(object) {
1622
1642
  }
1623
1643
  ;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
1624
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); }
1625
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1645
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1626
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."); }
1627
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; } }
1628
1648
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1629
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1630
- 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."); }
1631
- 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); }
1632
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1633
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1634
- 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; }
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; }
1635
1655
  function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1636
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); } }
1637
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; }
@@ -1686,7 +1706,7 @@ var UrlBuilder = /*#__PURE__*/function () {
1686
1706
  var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1687
1707
  var transCommonParams = this.getCommonTransformationQueryParams(trans);
1688
1708
  // This format puts "artifact" at the end, which isn't required, but is convention.
1689
- return this.addQueryParams(baseUrl, [].concat(_toConsumableArray(transParams), _toConsumableArray(commonParams), _toConsumableArray(transCommonParams)));
1709
+ return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
1690
1710
  }
1691
1711
  }, {
1692
1712
  key: "getBaseUrl",
@@ -1702,7 +1722,12 @@ var UrlBuilder = /*#__PURE__*/function () {
1702
1722
  return this.makeQueryParams({
1703
1723
  cacheOnly: null,
1704
1724
  cachePermanently: null,
1705
- // Keep this as the last param: this is the convention for transformation URLs (although not required).
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.
1706
1731
  artifact: null
1707
1732
  }, {
1708
1733
  cacheOnly: "cache_only",
@@ -278,6 +278,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
278
278
  }();
279
279
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
280
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; }
281
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); }
282
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); }; }
283
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); }
@@ -603,8 +609,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
603
609
  }
604
610
  return runtime_createClass(BytescaleApiError);
605
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
+ }
606
619
  function querystring(params) {
607
- return Object.keys(params).map(function (key) {
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) {
608
628
  return querystringSingleKey(key, params[key]);
609
629
  }).filter(function (part) {
610
630
  return part.length > 0;
@@ -1609,16 +1629,16 @@ function isDefinedEntry(object) {
1609
1629
  }
1610
1630
  ;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
1611
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); }
1612
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1632
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1613
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."); }
1614
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; } }
1615
1635
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1616
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1617
- 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."); }
1618
- 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); }
1619
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1620
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1621
- 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; }
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; }
1622
1642
  function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1623
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); } }
1624
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; }
@@ -1673,7 +1693,7 @@ var UrlBuilder = /*#__PURE__*/function () {
1673
1693
  var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1674
1694
  var transCommonParams = this.getCommonTransformationQueryParams(trans);
1675
1695
  // This format puts "artifact" at the end, which isn't required, but is convention.
1676
- return this.addQueryParams(baseUrl, [].concat(_toConsumableArray(transParams), _toConsumableArray(commonParams), _toConsumableArray(transCommonParams)));
1696
+ return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
1677
1697
  }
1678
1698
  }, {
1679
1699
  key: "getBaseUrl",
@@ -1689,7 +1709,12 @@ var UrlBuilder = /*#__PURE__*/function () {
1689
1709
  return this.makeQueryParams({
1690
1710
  cacheOnly: null,
1691
1711
  cachePermanently: null,
1692
- // Keep this as the last param: this is the convention for transformation URLs (although not required).
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.
1693
1718
  artifact: null
1694
1719
  }, {
1695
1720
  cacheOnly: "cache_only",
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import * as runtime from "../runtime";
13
13
  import type { AsyncResponse, CopyFileBatchRequest, CopyFileRequest, CopyFileResponse, DeleteFileBatchRequest, FileDetails, ProcessFileAndSaveRequest, ProcessFileAndSaveResponse } from "../models";
14
- import type { ProcessFileTransformationParamsParameter } from "../models";
14
+ import type { TransformationParams } from "../models";
15
15
  export interface CopyFileOperationParams {
16
16
  accountId: string;
17
17
  copyFileRequest: CopyFileRequest;
@@ -125,7 +125,7 @@ export interface ProcessFileParams {
125
125
  * - https://www.bytescale.com/docs/audio-processing-api
126
126
  * - https://www.bytescale.com/docs/archive-processing-api
127
127
  */
128
- transformationParams?: ProcessFileTransformationParamsParameter;
128
+ transformationParams?: TransformationParams;
129
129
  /**
130
130
  * Add this parameter and increment its value to force the file to be reprocessed.
131
131
  *
@@ -158,7 +158,7 @@ export interface ProcessFileAndSaveOperationParams {
158
158
  * - https://www.bytescale.com/docs/audio-processing-api
159
159
  * - https://www.bytescale.com/docs/archive-processing-api
160
160
  */
161
- transformationParams?: ProcessFileTransformationParamsParameter;
161
+ transformationParams?: TransformationParams;
162
162
  }
163
163
  export declare class FileApi extends runtime.BaseAPI {
164
164
  /**
@@ -1422,6 +1422,12 @@ export interface ProcessFileAndSaveRequest {
1422
1422
  * @memberof ProcessFileAndSaveRequest
1423
1423
  */
1424
1424
  destination?: FilePathDefinition;
1425
+ /**
1426
+ *
1427
+ * @type {TransformationParams}
1428
+ * @memberof ProcessFileAndSaveRequest
1429
+ */
1430
+ extendedParams?: TransformationParams;
1425
1431
  /**
1426
1432
  *
1427
1433
  * @type {CopyableFileDataFileMetadata}
@@ -1585,22 +1591,6 @@ export interface ProcessFileAndSaveResponseSync {
1585
1591
  * @export
1586
1592
  */
1587
1593
  export declare type ProcessFileAndSaveResponseSyncAsyncEnum = false;
1588
- /**
1589
- * @type ProcessFileTransformationParamsParameter
1590
- *
1591
- * @export
1592
- */
1593
- export declare type ProcessFileTransformationParamsParameter = Array<{
1594
- [key: string]: ProcessFileTransformationParamsParameterOneOfValue;
1595
- }> | {
1596
- [key: string]: ProcessFileTransformationParamsParameterOneOfValue;
1597
- };
1598
- /**
1599
- * @type ProcessFileTransformationParamsParameterOneOfValue
1600
- *
1601
- * @export
1602
- */
1603
- export declare type ProcessFileTransformationParamsParameterOneOfValue = boolean | number | string;
1604
1594
  /**
1605
1595
  * Permissions applied to anonymous users who attempt to download files from a folder.
1606
1596
  *
@@ -1881,6 +1871,50 @@ export declare type StorageLayerSummary = InternalStorageV1 | InternalStorageV2
1881
1871
  * @export
1882
1872
  */
1883
1873
  export declare type StorageLayerUpdate = DigitalOceanStorage | GoogleStorage | InternalStorageV2 | R2Storage | S3Storage | WebStorage;
1874
+ /**
1875
+ * @type TransformationParamValue
1876
+ * A single transformation parameter provided to a Bytescale File Processing API.
1877
+ *
1878
+ * See TransformationParams for more information.
1879
+ * @export
1880
+ */
1881
+ export declare type TransformationParamValue = boolean | number | string;
1882
+ /**
1883
+ * @type TransformationParams
1884
+ * Transformation parameters provided to a Bytescale File Processing API.
1885
+ *
1886
+ * *Array support:*
1887
+ *
1888
+ * Arrays are specified by repeating the same parameter name multiple times on the querystring.
1889
+ *
1890
+ * For example, the following querystring declares a `file` parameter as an array containing two values (`/file1.txt` and `/file2.txt`):
1891
+ *
1892
+ * ```?file=/file1.txt&file=/file2.txt```
1893
+ *
1894
+ * The Bytescale SDKs and the ProcessFileAndSave request body (the `extendedParams` field) also support arrays of transformation parameters. These are specified by providing an array of objects as the field value instead of an object, for example:
1895
+ *
1896
+ * ```transformationParams: [{ file: "/file1.txt" }, { file: "/file2.txt" }]```
1897
+ *
1898
+ * This structure allows parameter groups to be retained, which is important for certain transformations. For example, the Video Processing API allows developers to specify multiple clusters of `w`, `h` and `q` parameters when specifying the Adaptive Bitrate (ABR) variants in an HTTP Live Streaming (HLS) output video.
1899
+ *
1900
+ * *Parameters are order sensitive:*
1901
+ *
1902
+ * The order of the parameters may be important. Please refer to the documentation of each File Processing API for more information.
1903
+ *
1904
+ * *Maximum URL length:*
1905
+ *
1906
+ * Bytescale URLs have a maximum total length of 1000 bytes (excluding the hostname and protocol).
1907
+ *
1908
+ * To provide a longer list of parameters to a Bytescale File Processing API, you must use ProcessFileAndSave (POST) instead of ProcessFile (GET). This allows you to specify parameters via the ProcessFileAndSave HTTP request body (via the `extendedParams` field) instead of via the querystring.
1909
+ *
1910
+ * The `extendedParams` field supports up to 400KB of transformation parameter data.
1911
+ * @export
1912
+ */
1913
+ export declare type TransformationParams = Array<{
1914
+ [key: string]: TransformationParamValue;
1915
+ }> | {
1916
+ [key: string]: TransformationParamValue;
1917
+ };
1884
1918
  /**
1885
1919
  * This data type specifies no update is to be performed.
1886
1920
  * @export
@@ -291,6 +291,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
291
291
  }();
292
292
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
293
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; }
294
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); }
295
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); }; }
296
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); }
@@ -616,8 +622,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
616
622
  }
617
623
  return runtime_createClass(BytescaleApiError);
618
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
+ }
619
632
  function querystring(params) {
620
- return Object.keys(params).map(function (key) {
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) {
621
641
  return querystringSingleKey(key, params[key]);
622
642
  }).filter(function (part) {
623
643
  return part.length > 0;
@@ -1622,16 +1642,16 @@ function isDefinedEntry(object) {
1622
1642
  }
1623
1643
  ;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
1624
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); }
1625
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1645
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1626
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."); }
1627
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; } }
1628
1648
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1629
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1630
- 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."); }
1631
- 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); }
1632
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1633
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1634
- 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; }
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; }
1635
1655
  function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1636
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); } }
1637
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; }
@@ -1686,7 +1706,7 @@ var UrlBuilder = /*#__PURE__*/function () {
1686
1706
  var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1687
1707
  var transCommonParams = this.getCommonTransformationQueryParams(trans);
1688
1708
  // This format puts "artifact" at the end, which isn't required, but is convention.
1689
- return this.addQueryParams(baseUrl, [].concat(_toConsumableArray(transParams), _toConsumableArray(commonParams), _toConsumableArray(transCommonParams)));
1709
+ return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
1690
1710
  }
1691
1711
  }, {
1692
1712
  key: "getBaseUrl",
@@ -1702,7 +1722,12 @@ var UrlBuilder = /*#__PURE__*/function () {
1702
1722
  return this.makeQueryParams({
1703
1723
  cacheOnly: null,
1704
1724
  cachePermanently: null,
1705
- // Keep this as the last param: this is the convention for transformation URLs (although not required).
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.
1706
1731
  artifact: null
1707
1732
  }, {
1708
1733
  cacheOnly: "cache_only",
@@ -276,6 +276,12 @@ var ConsoleUtils = /*#__PURE__*/function () {
276
276
  }();
277
277
  ;// CONCATENATED MODULE: ./src/public/shared/generated/runtime.ts
278
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; }
279
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); }
280
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); }; }
281
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); }
@@ -601,8 +607,22 @@ var BytescaleApiError = /*#__PURE__*/function (_Error3) {
601
607
  }
602
608
  return runtime_createClass(BytescaleApiError);
603
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
+ }
604
617
  function querystring(params) {
605
- return Object.keys(params).map(function (key) {
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) {
606
626
  return querystringSingleKey(key, params[key]);
607
627
  }).filter(function (part) {
608
628
  return part.length > 0;
@@ -1607,16 +1627,16 @@ function isDefinedEntry(object) {
1607
1627
  }
1608
1628
  ;// CONCATENATED MODULE: ./src/public/shared/UrlBuilder.ts
1609
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); }
1610
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1630
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || UrlBuilder_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
1611
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."); }
1612
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; } }
1613
1633
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
1614
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
1615
- 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."); }
1616
- 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); }
1617
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
1618
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
1619
- 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; }
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; }
1620
1640
  function UrlBuilder_classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
1621
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); } }
1622
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; }
@@ -1671,7 +1691,7 @@ var UrlBuilder = /*#__PURE__*/function () {
1671
1691
  var commonParams = this.getCommonQueryParams((_a = params.options) !== null && _a !== void 0 ? _a : {});
1672
1692
  var transCommonParams = this.getCommonTransformationQueryParams(trans);
1673
1693
  // This format puts "artifact" at the end, which isn't required, but is convention.
1674
- return this.addQueryParams(baseUrl, [].concat(_toConsumableArray(transParams), _toConsumableArray(commonParams), _toConsumableArray(transCommonParams)));
1694
+ return this.addQueryParams(baseUrl, [].concat(UrlBuilder_toConsumableArray(transParams), UrlBuilder_toConsumableArray(commonParams), UrlBuilder_toConsumableArray(transCommonParams)));
1675
1695
  }
1676
1696
  }, {
1677
1697
  key: "getBaseUrl",
@@ -1687,7 +1707,12 @@ var UrlBuilder = /*#__PURE__*/function () {
1687
1707
  return this.makeQueryParams({
1688
1708
  cacheOnly: null,
1689
1709
  cachePermanently: null,
1690
- // Keep this as the last param: this is the convention for transformation URLs (although not required).
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.
1691
1716
  artifact: null
1692
1717
  }, {
1693
1718
  cacheOnly: "cache_only",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytescale/sdk",
3
- "version": "3.29.0",
3
+ "version": "3.31.0",
4
4
  "description": "Bytescale JavaScript SDK",
5
5
  "author": "Bytescale <hello@bytescale.com> (https://www.bytescale.com)",
6
6
  "license": "MIT",