@vidispine/vdt-js 21.3.0 → 21.4.0-pre.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,6 +2,44 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ function ownKeys(object, enumerableOnly) {
6
+ var keys = Object.keys(object);
7
+
8
+ if (Object.getOwnPropertySymbols) {
9
+ var symbols = Object.getOwnPropertySymbols(object);
10
+
11
+ if (enumerableOnly) {
12
+ symbols = symbols.filter(function (sym) {
13
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
14
+ });
15
+ }
16
+
17
+ keys.push.apply(keys, symbols);
18
+ }
19
+
20
+ return keys;
21
+ }
22
+
23
+ function _objectSpread2(target) {
24
+ for (var i = 1; i < arguments.length; i++) {
25
+ var source = arguments[i] != null ? arguments[i] : {};
26
+
27
+ if (i % 2) {
28
+ ownKeys(Object(source), true).forEach(function (key) {
29
+ _defineProperty(target, key, source[key]);
30
+ });
31
+ } else if (Object.getOwnPropertyDescriptors) {
32
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
33
+ } else {
34
+ ownKeys(Object(source)).forEach(function (key) {
35
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
36
+ });
37
+ }
38
+ }
39
+
40
+ return target;
41
+ }
42
+
5
43
  function _typeof(obj) {
6
44
  "@babel/helpers - typeof";
7
45
 
@@ -55,40 +93,6 @@ function _defineProperty(obj, key, value) {
55
93
  return obj;
56
94
  }
57
95
 
58
- function ownKeys(object, enumerableOnly) {
59
- var keys = Object.keys(object);
60
-
61
- if (Object.getOwnPropertySymbols) {
62
- var symbols = Object.getOwnPropertySymbols(object);
63
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
64
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
65
- });
66
- keys.push.apply(keys, symbols);
67
- }
68
-
69
- return keys;
70
- }
71
-
72
- function _objectSpread2(target) {
73
- for (var i = 1; i < arguments.length; i++) {
74
- var source = arguments[i] != null ? arguments[i] : {};
75
-
76
- if (i % 2) {
77
- ownKeys(Object(source), true).forEach(function (key) {
78
- _defineProperty(target, key, source[key]);
79
- });
80
- } else if (Object.getOwnPropertyDescriptors) {
81
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
82
- } else {
83
- ownKeys(Object(source)).forEach(function (key) {
84
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
85
- });
86
- }
87
- }
88
-
89
- return target;
90
- }
91
-
92
96
  function _objectWithoutPropertiesLoose(source, excluded) {
93
97
  if (source == null) return {};
94
98
  var target = {};
@@ -142,18 +146,21 @@ function _arrayWithHoles(arr) {
142
146
  }
143
147
 
144
148
  function _iterableToArray(iter) {
145
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
149
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
146
150
  }
147
151
 
148
152
  function _iterableToArrayLimit(arr, i) {
149
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
153
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
154
+
155
+ if (_i == null) return;
150
156
  var _arr = [];
151
157
  var _n = true;
152
158
  var _d = false;
153
- var _e = undefined;
159
+
160
+ var _s, _e;
154
161
 
155
162
  try {
156
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
163
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
157
164
  _arr.push(_s.value);
158
165
 
159
166
  if (i && _arr.length === i) break;
@@ -197,6 +204,11 @@ function _nonIterableRest() {
197
204
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
198
205
  }
199
206
 
207
+ var _excluded = ["value"],
208
+ _excluded2 = ["field", "group"],
209
+ _excluded3 = ["field", "group"],
210
+ _excluded4 = ["timespan"];
211
+
200
212
  var sortTimespanList = function sortTimespanList(_ref, _ref2) {
201
213
  var firstStart = _ref.start;
202
214
  var secondStart = _ref2.start;
@@ -263,7 +275,7 @@ var parseField = function parseField() {
263
275
 
264
276
  var _field$value = field.value,
265
277
  value = _field$value === void 0 ? [] : _field$value,
266
- attributes = _objectWithoutProperties(field, ["value"]);
278
+ attributes = _objectWithoutProperties(field, _excluded);
267
279
 
268
280
  var parsedValueList = parseValueList(value, options);
269
281
  if (includeAttributes || includeFieldAttributes) return _objectSpread2(_objectSpread2({}, attributes), {}, {
@@ -333,7 +345,7 @@ var parseGroup = function parseGroup() {
333
345
  fieldList = _group$field === void 0 ? [] : _group$field,
334
346
  _group$group = group.group,
335
347
  groupList = _group$group === void 0 ? [] : _group$group,
336
- attributes = _objectWithoutProperties(group, ["field", "group"]);
348
+ attributes = _objectWithoutProperties(group, _excluded2);
337
349
 
338
350
  var parsedFieldList = parseFieldList(fieldList, options);
339
351
  var parsedGroupList = parseGroupList(groupList, options); // eslint-disable-line no-use-before-define,max-len
@@ -417,7 +429,7 @@ var parseTimespan = function parseTimespan() {
417
429
  fieldList = _timespan$field === void 0 ? [] : _timespan$field,
418
430
  _timespan$group = timespan.group,
419
431
  groupList = _timespan$group === void 0 ? [] : _timespan$group,
420
- attributes = _objectWithoutProperties(timespan, ["field", "group"]);
432
+ attributes = _objectWithoutProperties(timespan, _excluded3);
421
433
 
422
434
  var field = parseFieldList(fieldList, options);
423
435
  var group = parseGroupList(groupList, options);
@@ -522,7 +534,7 @@ var parseMetadataType = function parseMetadataType() {
522
534
 
523
535
  var _metadataType$timespa2 = metadataType.timespan,
524
536
  timespanList = _metadataType$timespa2 === void 0 ? [] : _metadataType$timespa2,
525
- attributes = _objectWithoutProperties(metadataType, ["timespan"]);
537
+ attributes = _objectWithoutProperties(metadataType, _excluded4);
526
538
 
527
539
  if (sortTimespan) timespanList.sort(sortTimespanList);
528
540
  var timespan = parseTimespanList(timespanList, options);
@@ -534,20 +546,24 @@ var parseMetadataType = function parseMetadataType() {
534
546
  return timespan;
535
547
  };
536
548
 
549
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
550
+
537
551
  function createCommonjsModule(fn, module) {
538
552
  return module = { exports: {} }, fn(module, module.exports), module.exports;
539
553
  }
540
554
 
541
555
  var filesize = createCommonjsModule(function (module, exports) {
542
- /**
543
- * filesize
544
- *
545
- * @copyright 2020 Jason Mulligan <jason.mulligan@avoidwork.com>
546
- * @license BSD-3-Clause
547
- * @version 6.1.0
556
+ /**
557
+ * filesize
558
+ *
559
+ * @copyright 2021 Jason Mulligan <jason.mulligan@avoidwork.com>
560
+ * @license BSD-3-Clause
561
+ * @version 6.4.0
548
562
  */
563
+ (function (global, factory) {
564
+ module.exports = factory() ;
565
+ })(commonjsGlobal, function () {
549
566
 
550
- (function (global) {
551
567
  var b = /^(b|B)$/,
552
568
  symbol = {
553
569
  iec: {
@@ -562,37 +578,45 @@ var filesize = createCommonjsModule(function (module, exports) {
562
578
  fullform = {
563
579
  iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
564
580
  jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
581
+ },
582
+ roundingFuncs = {
583
+ floor: Math.floor,
584
+ ceil: Math.ceil
565
585
  };
566
- /**
567
- * filesize
568
- *
569
- * @method filesize
570
- * @param {Mixed} arg String, Int or Float to transform
571
- * @param {Object} descriptor [Optional] Flags
572
- * @return {String} Readable file size String
586
+ /**
587
+ * filesize
588
+ *
589
+ * @method filesize
590
+ * @param {Mixed} arg String, Int or Float to transform
591
+ * @param {Object} descriptor [Optional] Flags
592
+ * @return {String} Readable file size String
573
593
  */
574
594
 
575
595
  function filesize(arg) {
576
596
  var descriptor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
577
597
  var result = [],
578
598
  val = 0,
579
- e = void 0,
580
- base = void 0,
581
- bits = void 0,
582
- ceil = void 0,
583
- full = void 0,
584
- fullforms = void 0,
585
- locale = void 0,
586
- localeOptions = void 0,
587
- neg = void 0,
588
- num = void 0,
589
- output = void 0,
590
- round = void 0,
591
- unix = void 0,
592
- separator = void 0,
593
- spacer = void 0,
594
- standard = void 0,
595
- symbols = void 0;
599
+ e,
600
+ base,
601
+ bits,
602
+ ceil,
603
+ full,
604
+ fullforms,
605
+ locale,
606
+ localeOptions,
607
+ neg,
608
+ num,
609
+ output,
610
+ pad,
611
+ round,
612
+ u,
613
+ unix,
614
+ separator,
615
+ spacer,
616
+ standard,
617
+ symbols,
618
+ roundingFunc,
619
+ precision;
596
620
 
597
621
  if (isNaN(arg)) {
598
622
  throw new TypeError("Invalid number");
@@ -600,6 +624,7 @@ var filesize = createCommonjsModule(function (module, exports) {
600
624
 
601
625
  bits = descriptor.bits === true;
602
626
  unix = descriptor.unix === true;
627
+ pad = descriptor.pad === true;
603
628
  base = descriptor.base || 2;
604
629
  round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;
605
630
  locale = descriptor.locale !== void 0 ? descriptor.locale : "";
@@ -612,9 +637,11 @@ var filesize = createCommonjsModule(function (module, exports) {
612
637
  full = descriptor.fullform === true;
613
638
  fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];
614
639
  e = descriptor.exponent !== void 0 ? descriptor.exponent : -1;
640
+ roundingFunc = roundingFuncs[descriptor.roundingMethod] || Math.round;
615
641
  num = Number(arg);
616
642
  neg = num < 0;
617
- ceil = base > 2 ? 1000 : 1024; // Flipping a negative number to determine the size
643
+ ceil = base > 2 ? 1000 : 1024;
644
+ precision = isNaN(descriptor.precision) === false ? parseInt(descriptor.precision, 10) : 0; // Flipping a negative number to determine the size
618
645
 
619
646
  if (neg) {
620
647
  num = -num;
@@ -631,6 +658,10 @@ var filesize = createCommonjsModule(function (module, exports) {
631
658
 
632
659
 
633
660
  if (e > 8) {
661
+ if (precision > 0) {
662
+ precision += 8 - e;
663
+ }
664
+
634
665
  e = 8;
635
666
  }
636
667
 
@@ -641,7 +672,7 @@ var filesize = createCommonjsModule(function (module, exports) {
641
672
 
642
673
  if (num === 0) {
643
674
  result[0] = 0;
644
- result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
675
+ u = result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
645
676
  } else {
646
677
  val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));
647
678
 
@@ -654,14 +685,15 @@ var filesize = createCommonjsModule(function (module, exports) {
654
685
  }
655
686
  }
656
687
 
657
- result[0] = Number(val.toFixed(e > 0 ? round : 0));
688
+ var p = Math.pow(10, e > 0 ? round : 0);
689
+ result[0] = roundingFunc(val * p) / p;
658
690
 
659
691
  if (result[0] === ceil && e < 8 && descriptor.exponent === void 0) {
660
692
  result[0] = 1;
661
693
  e++;
662
694
  }
663
695
 
664
- result[1] = base === 10 && e === 1 ? bits ? "kb" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e];
696
+ u = result[1] = base === 10 && e === 1 ? bits ? "kb" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e];
665
697
 
666
698
  if (unix) {
667
699
  result[1] = standard === "jedec" ? result[1].charAt(0) : e > 0 ? result[1].replace(/B$/, "") : result[1];
@@ -676,6 +708,11 @@ var filesize = createCommonjsModule(function (module, exports) {
676
708
 
677
709
  if (neg) {
678
710
  result[0] = -result[0];
711
+ } // Setting optional precision
712
+
713
+
714
+ if (precision > 0) {
715
+ result[0] = result[0].toPrecision(precision);
679
716
  } // Applying custom symbol
680
717
 
681
718
 
@@ -687,26 +724,28 @@ var filesize = createCommonjsModule(function (module, exports) {
687
724
  result[0] = result[0].toLocaleString(locale, localeOptions);
688
725
  } else if (separator.length > 0) {
689
726
  result[0] = result[0].toString().replace(".", separator);
690
- } // Returning Array, Object, or String (default)
691
-
727
+ }
692
728
 
693
- if (output === "array") {
694
- return result;
729
+ if (pad && Number.isInteger(result[0]) === false && round > 0) {
730
+ var x = separator || ".",
731
+ tmp = result[0].toString().split(x),
732
+ s = tmp[1] || "",
733
+ l = s.length,
734
+ n = round - l;
735
+ result[0] = "".concat(tmp[0]).concat(x).concat(s.padEnd(l + n, "0"));
695
736
  }
696
737
 
697
738
  if (full) {
698
739
  result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
699
- }
740
+ } // Returning Array, Object, or String (default)
700
741
 
701
- if (output === "object") {
702
- return {
703
- value: result[0],
704
- symbol: result[1],
705
- exponent: e
706
- };
707
- }
708
742
 
709
- return result.join(spacer);
743
+ return output === "array" ? result : output === "object" ? {
744
+ value: result[0],
745
+ symbol: result[1],
746
+ exponent: e,
747
+ unit: u
748
+ } : result.join(spacer);
710
749
  } // Partial application for functional programming
711
750
 
712
751
 
@@ -714,13 +753,10 @@ var filesize = createCommonjsModule(function (module, exports) {
714
753
  return function (arg) {
715
754
  return filesize(arg, opt);
716
755
  };
717
- }; // CommonJS, AMD, script tag
718
-
756
+ };
719
757
 
720
- {
721
- module.exports = filesize;
722
- }
723
- })();
758
+ return filesize;
759
+ });
724
760
  });
725
761
 
726
762
  var _CONSTANT_TIMEBASES;
@@ -1359,6 +1395,7 @@ var parseKeyValuePairType = function parseKeyValuePairType() {
1359
1395
  return keyValuePairType.reduce(keyValuePairTypeReducer, {});
1360
1396
  };
1361
1397
 
1398
+ var _excluded$1 = ["property"];
1362
1399
  var sampleRateSymbols = {
1363
1400
  kB: 'kHz',
1364
1401
  B: 'Hz',
@@ -1393,7 +1430,7 @@ var parseBaseMediaInfoType = function parseBaseMediaInfoType() {
1393
1430
  var baseMediaInfoType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1394
1431
 
1395
1432
  var keyValuePairType = baseMediaInfoType.property,
1396
- props = _objectWithoutProperties(baseMediaInfoType, ["property"]);
1433
+ props = _objectWithoutProperties(baseMediaInfoType, _excluded$1);
1397
1434
 
1398
1435
  var parsedKeyValuePairType = parseKeyValuePairType(keyValuePairType);
1399
1436
  return _objectSpread2(_objectSpread2({}, parsedKeyValuePairType), props);
@@ -1692,6 +1729,9 @@ var parseShapeType = function parseShapeType() {
1692
1729
  return parsedShape;
1693
1730
  };
1694
1731
 
1732
+ var _excluded$2 = ["Codec"],
1733
+ _excluded2$1 = ["Codec"];
1734
+
1695
1735
  var parseMediaConvertPreset = function parseMediaConvertPreset(transcodePresetType) {
1696
1736
  var output = {};
1697
1737
  var description = transcodePresetType.description,
@@ -1718,7 +1758,7 @@ var parseMediaConvertPreset = function parseMediaConvertPreset(transcodePresetTy
1718
1758
  CodecSettings = _VideoDescription$Cod === void 0 ? {} : _VideoDescription$Cod;
1719
1759
 
1720
1760
  var Codec = CodecSettings.Codec,
1721
- otherSettings = _objectWithoutProperties(CodecSettings, ["Codec"]);
1761
+ otherSettings = _objectWithoutProperties(CodecSettings, _excluded$2);
1722
1762
 
1723
1763
  output.videoFormat = Codec;
1724
1764
  var height = VideoDescription.Height,
@@ -1759,7 +1799,7 @@ var parseMediaConvertPreset = function parseMediaConvertPreset(transcodePresetTy
1759
1799
  _CodecSettings = _AudioDescriptions$0$ === void 0 ? {} : _AudioDescriptions$0$;
1760
1800
 
1761
1801
  var _Codec = _CodecSettings.Codec,
1762
- _otherSettings = _objectWithoutProperties(_CodecSettings, ["Codec"]);
1802
+ _otherSettings = _objectWithoutProperties(_CodecSettings, _excluded2$1);
1763
1803
 
1764
1804
  output.audioFormat = _Codec;
1765
1805
 
@@ -1900,6 +1940,9 @@ var createFacetType = function createFacetType() {
1900
1940
  });
1901
1941
  }; // eslint-disable-next-line import/prefer-default-export
1902
1942
 
1943
+ var _excluded$3 = ["groupName"],
1944
+ _excluded2$2 = ["start", "end"];
1945
+
1903
1946
  /* eslint-disable import/prefer-default-export */
1904
1947
  var parseValueList$1 = function parseValueList(value) {
1905
1948
  if (value === undefined) return [];
@@ -1997,7 +2040,7 @@ var parseGroupsOrFields = function parseGroupsOrFields(groupsOrFields) {
1997
2040
  } else if (Array.isArray(value)) {
1998
2041
  value.forEach(function (_ref4) {
1999
2042
  var groupName = _ref4.groupName,
2000
- groupValue = _objectWithoutProperties(_ref4, ["groupName"]);
2043
+ groupValue = _objectWithoutProperties(_ref4, _excluded$3);
2001
2044
 
2002
2045
  // eslint-disable-next-line no-use-before-define
2003
2046
  group.push(parseGroup$1({
@@ -2024,7 +2067,7 @@ var parseTimeSpan = function parseTimeSpan(timeSpan) {
2024
2067
  start = _timeSpan$start === void 0 ? '-INF' : _timeSpan$start,
2025
2068
  _timeSpan$end = timeSpan.end,
2026
2069
  end = _timeSpan$end === void 0 ? '+INF' : _timeSpan$end,
2027
- groupsOrFields = _objectWithoutProperties(timeSpan, ["start", "end"]);
2070
+ groupsOrFields = _objectWithoutProperties(timeSpan, _excluded2$2);
2028
2071
 
2029
2072
  var _parseGroupsOrFields2 = parseGroupsOrFields(groupsOrFields),
2030
2073
  group = _parseGroupsOrFields2.group,