@amazon/vinyl-mpd-parser 3.2.3-next.20261010160052 → 3.2.3-next.20261013174635

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.
Files changed (45) hide show
  1. package/dist/index.cjs +124 -14
  2. package/dist/index.cjs.map +4 -4
  3. package/dist/index.js +125 -8
  4. package/dist/index.js.map +4 -4
  5. package/dist/test/benchmark.es5.js +18 -16
  6. package/dist/test/benchmark.js +155 -52
  7. package/dist/test/benchmark.js.map +4 -4
  8. package/dist/types/current/index.d.ts +2 -0
  9. package/dist/types/current/index.d.ts.map +1 -1
  10. package/dist/types/current/index.js +2 -0
  11. package/dist/types/current/manifest/dashManifestXmlRules.d.ts +5 -0
  12. package/dist/types/current/manifest/dashManifestXmlRules.d.ts.map +1 -1
  13. package/dist/types/current/manifest/dashManifestXmlRules.js +30 -5
  14. package/dist/types/current/manifest/dashParser.d.ts +368 -1
  15. package/dist/types/current/manifest/dashParser.d.ts.map +1 -1
  16. package/dist/types/current/manifest/dashParser.js +2 -1
  17. package/dist/types/current/manifest/ext/events/scte35XmlRules.d.ts +33 -0
  18. package/dist/types/current/manifest/ext/events/scte35XmlRules.d.ts.map +1 -0
  19. package/dist/types/current/manifest/ext/events/scte35XmlRules.js +83 -0
  20. package/dist/types/current/tsconfig.tsbuildinfo +1 -1
  21. package/dist/types/current/xmlns/mpeg/dash/schema/mpd/2011.d.ts +79 -1
  22. package/dist/types/current/xmlns/mpeg/dash/schema/mpd/2011.d.ts.map +1 -1
  23. package/dist/types/current/xmlns/scte/35/2016.d.ts +73 -0
  24. package/dist/types/current/xmlns/scte/35/2016.d.ts.map +1 -0
  25. package/dist/types/current/xmlns/scte/35/2016.js +13 -0
  26. package/dist/types/ts3.7/index.d.ts +2 -0
  27. package/dist/types/ts3.7/manifest/dashManifestXmlRules.d.ts +5 -0
  28. package/dist/types/ts3.7/manifest/dashParser.d.ts +368 -1
  29. package/dist/types/ts3.7/manifest/ext/events/scte35XmlRules.d.ts +33 -0
  30. package/dist/types/ts3.7/xmlns/mpeg/dash/schema/mpd/2011.d.ts +79 -1
  31. package/dist/types/ts3.7/xmlns/scte/35/2016.d.ts +73 -0
  32. package/dist/types/ts4.1/index.d.ts +2 -0
  33. package/dist/types/ts4.1/manifest/dashManifestXmlRules.d.ts +5 -0
  34. package/dist/types/ts4.1/manifest/dashParser.d.ts +368 -1
  35. package/dist/types/ts4.1/manifest/ext/events/scte35XmlRules.d.ts +33 -0
  36. package/dist/types/ts4.1/xmlns/mpeg/dash/schema/mpd/2011.d.ts +79 -1
  37. package/dist/types/ts4.1/xmlns/scte/35/2016.d.ts +73 -0
  38. package/dist/types/ts4.7/index.d.ts +2 -0
  39. package/dist/types/ts4.7/manifest/dashManifestXmlRules.d.ts +5 -0
  40. package/dist/types/ts4.7/manifest/dashParser.d.ts +368 -1
  41. package/dist/types/ts4.7/manifest/ext/events/scte35XmlRules.d.ts +33 -0
  42. package/dist/types/ts4.7/xmlns/mpeg/dash/schema/mpd/2011.d.ts +79 -1
  43. package/dist/types/ts4.7/xmlns/scte/35/2016.d.ts +73 -0
  44. package/dist/unit/types/current/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +6 -6
@@ -925,9 +925,9 @@
925
925
  cyclicRefError: "Cyclic reference found at: {path}",
926
926
  mergeReferenceError: `No merge rule found at {path} for "{source}" and reference copy not allowed`
927
927
  };
928
- function mergeDeep(sources, options) {
928
+ function mergeDeep(sources, options2) {
929
929
  if (!sources.length) return void 0;
930
- const finalOpts = __spreadValues(__spreadValues({}, defaultMergeOptions), options);
930
+ const finalOpts = __spreadValues(__spreadValues({}, defaultMergeOptions), options2);
931
931
  const stack = new PropStack();
932
932
  const n = sources.length;
933
933
  if (n === 1)
@@ -976,12 +976,12 @@
976
976
  refSet.add(source);
977
977
  }
978
978
  };
979
- function _mergeDeep(sourceA, sourceB, propStack, prop, options) {
979
+ function _mergeDeep(sourceA, sourceB, propStack, prop, options2) {
980
980
  if (typeof sourceB !== "object" || sourceB === null) return sourceB;
981
981
  const merge = (sourceA2, sourceB2, prop2) => {
982
- return _mergeDeep(sourceA2, sourceB2, propStack, prop2, options);
982
+ return _mergeDeep(sourceA2, sourceB2, propStack, prop2, options2);
983
983
  };
984
- for (const rule of options.rules) {
984
+ for (const rule of options2.rules) {
985
985
  if (rule.matches(sourceB)) {
986
986
  propStack.push(sourceA, sourceB, prop);
987
987
  const result = rule.merge(
@@ -993,7 +993,7 @@
993
993
  return result;
994
994
  }
995
995
  }
996
- if (!options.allowReferenceCopy) {
996
+ if (!options2.allowReferenceCopy) {
997
997
  propStack.push(sourceA, sourceB, prop);
998
998
  throw new MergeReferenceError(propStack.currentPath, sourceB);
999
999
  }
@@ -1138,11 +1138,11 @@
1138
1138
  };
1139
1139
 
1140
1140
  // ../vinyl-util/src/util/object/clone.ts
1141
- function clone(target, options) {
1141
+ function clone(target, options2) {
1142
1142
  var _a2, _b, _c;
1143
1143
  return mergeDeep([target], {
1144
- allowReferenceCopy: (_a2 = options == null ? void 0 : options.allowReferenceCopy) != null ? _a2 : false,
1145
- rules: (_c = (_b = options == null ? void 0 : options.rules) == null ? void 0 : _b.map(toMergeRule)) != null ? _c : defaultMergeOptions.rules
1144
+ allowReferenceCopy: (_a2 = options2 == null ? void 0 : options2.allowReferenceCopy) != null ? _a2 : false,
1145
+ rules: (_c = (_b = options2 == null ? void 0 : options2.rules) == null ? void 0 : _b.map(toMergeRule)) != null ? _c : defaultMergeOptions.rules
1146
1146
  });
1147
1147
  }
1148
1148
  function toMergeRule(cloneRule) {
@@ -1180,15 +1180,15 @@
1180
1180
  }
1181
1181
 
1182
1182
  // ../vinyl-util/src/util/serialization/ParseError.ts
1183
- function printStringPosition(str, index, options) {
1183
+ function printStringPosition(str, index, options2) {
1184
1184
  var _a2;
1185
- const caret = (options == null ? void 0 : options.caret) || "^";
1185
+ const caret = (options2 == null ? void 0 : options2.caret) || "^";
1186
1186
  index = clamp(index, 0, str.length);
1187
1187
  const minIndex = str.lastIndexOf("\n", index - 1) + 1;
1188
1188
  let maxIndex = str.indexOf("\n", index);
1189
1189
  if (maxIndex === -1) maxIndex = str.length;
1190
- const split = (options == null ? void 0 : options.split) === void 0 ? 0.6 : options.split;
1191
- const cols = ((_a2 = options == null ? void 0 : options.maxColumns) != null ? _a2 : 60) - caret.length;
1190
+ const split = (options2 == null ? void 0 : options2.split) === void 0 ? 0.6 : options2.split;
1191
+ const cols = ((_a2 = options2 == null ? void 0 : options2.maxColumns) != null ? _a2 : 60) - caret.length;
1192
1192
  let leadingChars = cols * split;
1193
1193
  let trailingChars = cols * (1 - split);
1194
1194
  const maxLeadingChars = index - minIndex;
@@ -1571,8 +1571,8 @@
1571
1571
  isValid(input) {
1572
1572
  return validate(input, { all: false }, []).length === 0;
1573
1573
  },
1574
- validate(input, options, path = []) {
1575
- return validate(input, options != null ? options : { all: false }, path);
1574
+ validate(input, options2, path = []) {
1575
+ return validate(input, options2 != null ? options2 : { all: false }, path);
1576
1576
  },
1577
1577
  assert: (input, origin, path = []) => {
1578
1578
  const errors = validate(input, { all: false }, path);
@@ -1629,9 +1629,9 @@
1629
1629
  substitute(locale5.template, {
1630
1630
  value: validators.map((v) => v.description).join(locale5.separator)
1631
1631
  }),
1632
- (input, options, path) => {
1632
+ (input, options2, path) => {
1633
1633
  for (const validator of validators) {
1634
- const errors = validator.validate(input, options, path);
1634
+ const errors = validator.validate(input, options2, path);
1635
1635
  if (errors.length) return errors;
1636
1636
  }
1637
1637
  return [];
@@ -1663,11 +1663,11 @@
1663
1663
  });
1664
1664
  return createDeepValidator(
1665
1665
  description,
1666
- (input, options, path) => {
1666
+ (input, options2, path) => {
1667
1667
  let longestErrors = [];
1668
1668
  let longestPath = 0;
1669
1669
  for (const validator of validators) {
1670
- const errors = validator.validate(input, options, path);
1670
+ const errors = validator.validate(input, options2, path);
1671
1671
  if (!errors.length) return errors;
1672
1672
  const pathLength = errors.reduce(
1673
1673
  (max, m) => Math.max(m.path.length, max),
@@ -1710,7 +1710,7 @@
1710
1710
  this.validator.assert(input, origin, path);
1711
1711
  });
1712
1712
  __publicField(this, "isValid", (input) => this.validator.isValid(input));
1713
- __publicField(this, "validate", (input, options, path) => this.validator.validate(input, options, path));
1713
+ __publicField(this, "validate", (input, options2, path) => this.validator.validate(input, options2, path));
1714
1714
  this.validator = operation == null ? currentValidator : operation(previousSchema, currentValidator);
1715
1715
  }
1716
1716
  get options() {
@@ -2144,17 +2144,17 @@
2144
2144
  }
2145
2145
 
2146
2146
  // ../vinyl-xml/src/xml/xmlRules.ts
2147
- function element(rules, options) {
2147
+ function element(rules, options2) {
2148
2148
  return __spreadProps(__spreadValues({
2149
2149
  type: "element" /* ELEMENT */,
2150
2150
  localPart: void 0,
2151
2151
  namespaceUri: void 0,
2152
2152
  required: false
2153
- }, options), {
2153
+ }, options2), {
2154
2154
  rules
2155
2155
  });
2156
2156
  }
2157
- function elements(rules, options) {
2157
+ function elements(rules, options2) {
2158
2158
  return __spreadProps(__spreadValues({
2159
2159
  type: "elements" /* ELEMENTS */,
2160
2160
  localPart: void 0,
@@ -2162,7 +2162,7 @@
2162
2162
  minOccurs: 0,
2163
2163
  maxOccurs: null,
2164
2164
  useEmptyArrays: false
2165
- }, options), {
2165
+ }, options2), {
2166
2166
  rules
2167
2167
  });
2168
2168
  }
@@ -2170,32 +2170,32 @@
2170
2170
  return { type: "characters" /* CHARACTERS */, parse, stringify: stringify2 };
2171
2171
  }
2172
2172
  var charactersString = characters((i) => i, stringify);
2173
- function attr(parse, stringify2, options) {
2173
+ function attr(parse, stringify2, options2) {
2174
2174
  return __spreadProps(__spreadValues({
2175
2175
  type: "attribute" /* ATTRIBUTE */,
2176
2176
  localPart: void 0,
2177
2177
  namespaceUri: null,
2178
2178
  required: false,
2179
2179
  default: void 0
2180
- }, options), {
2180
+ }, options2), {
2181
2181
  parse,
2182
2182
  stringify: stringify2
2183
2183
  });
2184
2184
  }
2185
- function attrString(options) {
2186
- return attr((i) => i, stringify, options);
2185
+ function attrString(options2) {
2186
+ return attr((i) => i, stringify, options2);
2187
2187
  }
2188
- function attrInt(options) {
2189
- return attr(parseInt, stringify, options);
2188
+ function attrInt(options2) {
2189
+ return attr(parseInt, stringify, options2);
2190
2190
  }
2191
- function attrFloat(options) {
2192
- return attr(parseFloat, stringify, options);
2191
+ function attrFloat(options2) {
2192
+ return attr(parseFloat, stringify, options2);
2193
2193
  }
2194
- function attrBoolean(options) {
2195
- return attr(parseBoolean, stringify, options);
2194
+ function attrBoolean(options2) {
2195
+ return attr(parseBoolean, stringify, options2);
2196
2196
  }
2197
- function attrDateTime(options) {
2198
- return attr(parseDate, stringifyDate, options);
2197
+ function attrDateTime(options2) {
2198
+ return attr(parseDate, stringifyDate, options2);
2199
2199
  }
2200
2200
 
2201
2201
  // ../vinyl-xml/src/xml/mappedXmlRules.ts
@@ -2624,12 +2624,12 @@
2624
2624
  return rules.get(xmlRuleKey(name.localPart, name.namespaceUri));
2625
2625
  }
2626
2626
  var ParseXmlHandlerImpl = class {
2627
- constructor(rules, options) {
2627
+ constructor(rules, options2) {
2628
2628
  __publicField(this, "rules", rules);
2629
2629
  __publicField(this, "stack", []);
2630
2630
  __publicField(this, "options");
2631
2631
  __publicField(this, "busy", false);
2632
- this.options = __spreadValues({ validateRules: true }, options);
2632
+ this.options = __spreadValues({ validateRules: true }, options2);
2633
2633
  }
2634
2634
  startDocument() {
2635
2635
  if (this.busy)
@@ -2836,10 +2836,13 @@
2836
2836
 
2837
2837
  // src/manifest/dashManifestXmlRules.ts
2838
2838
  var dashNamespaceUri = "urn:mpeg:dash:schema:mpd:2011";
2839
+ var XLINK_NAMESPACE_URI = "http://www.w3.org/1999/xlink";
2839
2840
  function dashManifestXmlRules() {
2840
2841
  const attrActuateType = attr(assertActuateEnum, stringify, {
2841
- default: "onRequest"
2842
+ default: "onRequest",
2843
+ namespaceUri: XLINK_NAMESPACE_URI
2842
2844
  });
2845
+ const attrHref = attrString({ namespaceUri: XLINK_NAMESPACE_URI });
2843
2846
  const descriptorType = {
2844
2847
  id: attrString,
2845
2848
  schemeIdUri: attrString({ required: true }),
@@ -2900,7 +2903,7 @@
2900
2903
  };
2901
2904
  const segmentListType = __spreadProps(__spreadValues({}, multipleSegmentBaseType), {
2902
2905
  actuate: attrActuateType,
2903
- href: attrString,
2906
+ href: attrHref,
2904
2907
  SegmentURL: elements(segmentURLType)
2905
2908
  });
2906
2909
  const segmentTemplateType = __spreadProps(__spreadValues({}, multipleSegmentBaseType), {
@@ -2913,19 +2916,32 @@
2913
2916
  contains: attr(parseIntVector, stringifyIntVector, { required: true }),
2914
2917
  id: attrString
2915
2918
  };
2919
+ const alternativePresentationType = {
2920
+ uri: attrString,
2921
+ maxDuration: attrInt,
2922
+ earliestResolutionTimeOffset: attrInt,
2923
+ returnOffset: attrInt,
2924
+ clip: attrBoolean,
2925
+ startWithOffset: attrBoolean
2926
+ };
2916
2927
  const eventType = {
2917
2928
  duration: attrInt,
2918
2929
  id: attrInt,
2919
2930
  messageData: attrString,
2920
- presentationTime: attrInt({ default: 0 })
2931
+ presentationTime: attrInt({ default: 0 }),
2932
+ contentEncoding: attrString,
2933
+ _content: charactersString,
2934
+ InsertPresentation: element(alternativePresentationType),
2935
+ ReplacePresentation: element(alternativePresentationType)
2921
2936
  };
2922
2937
  const eventStreamType = {
2923
2938
  Event: elements(eventType),
2924
2939
  actuate: attrActuateType,
2925
- href: attrString,
2940
+ href: attrHref,
2926
2941
  messageData: attrString,
2927
2942
  schemeIdUri: attrString({ required: true }),
2928
2943
  timescale: attrInt,
2944
+ presentationTimeOffset: attrInt,
2929
2945
  value: attrString
2930
2946
  };
2931
2947
  const switchingType = {
@@ -2989,7 +3005,7 @@
2989
3005
  bitstreamSwitching: attrBoolean,
2990
3006
  contentType: attrString,
2991
3007
  group: attrInt,
2992
- href: attrString,
3008
+ href: attrHref,
2993
3009
  id: attrInt,
2994
3010
  lang: attrString,
2995
3011
  maxBandwidth: attrInt,
@@ -3021,6 +3037,10 @@
3021
3037
  Range: elements(rangeType),
3022
3038
  Reporting: elements(descriptorType, { minOccurs: 1 })
3023
3039
  };
3040
+ const importedMpdType = {
3041
+ earliestResolutionTimeOffset: attrFloat,
3042
+ _content: charactersString
3043
+ };
3024
3044
  const periodType = {
3025
3045
  BaseURL: elements(baseURLType),
3026
3046
  SegmentBase: element(segmentBaseType),
@@ -3031,10 +3051,11 @@
3031
3051
  AdaptationSet: elements(adaptationSetType),
3032
3052
  Subset: elements(subsetType),
3033
3053
  SupplementalProperty: elements(descriptorType),
3054
+ ImportedMPD: element(importedMpdType),
3034
3055
  actuate: attrActuateType,
3035
3056
  bitstreamSwitching: attrBoolean({ default: false }),
3036
3057
  duration: attr(parseDuration, stringifyDuration),
3037
- href: attrString,
3058
+ href: attrHref,
3038
3059
  id: attrString,
3039
3060
  start: attr(parseDuration, stringifyDuration)
3040
3061
  };
@@ -3122,7 +3143,8 @@
3122
3143
  }
3123
3144
  var presentationTypeValidator = isOneOf(
3124
3145
  "static",
3125
- "dynamic"
3146
+ "dynamic",
3147
+ "list"
3126
3148
  );
3127
3149
  function parsePresentationTypeType(str) {
3128
3150
  presentationTypeValidator.assert(str, ErrorOrigin.PARSING);
@@ -3201,11 +3223,92 @@
3201
3223
  )
3202
3224
  };
3203
3225
 
3226
+ // src/xmlns/scte/35/2016.ts
3227
+ var SCTE35_2016_NAMESPACE_URI = "http://www.scte.org/schemas/35/2016";
3228
+
3229
+ // src/manifest/ext/events/scte35XmlRules.ts
3230
+ var options = { namespaceUri: SCTE35_2016_NAMESPACE_URI };
3231
+ var spliceTimeType = {
3232
+ ptsTime: attrInt
3233
+ };
3234
+ var segmentationUpidType = {
3235
+ segmentationUpidType: attrInt,
3236
+ segmentationUpidFormat: attrString,
3237
+ _content: charactersString
3238
+ };
3239
+ var segmentationDescriptorType = {
3240
+ segmentationEventId: attrInt,
3241
+ segmentationEventCancelIndicator: attrBoolean,
3242
+ segmentationDuration: attrInt,
3243
+ segmentationTypeId: attrInt,
3244
+ segmentNum: attrInt,
3245
+ segmentsExpected: attrInt,
3246
+ SegmentationUpid: elements(segmentationUpidType, options)
3247
+ };
3248
+ var programType = {
3249
+ SpliceTime: element(spliceTimeType, options)
3250
+ };
3251
+ var breakDurationType = {
3252
+ autoReturn: attrBoolean,
3253
+ duration: attrInt
3254
+ };
3255
+ var spliceInsertType = {
3256
+ spliceEventId: attrInt,
3257
+ spliceEventCancelIndicator: attrBoolean,
3258
+ outOfNetworkIndicator: attrBoolean,
3259
+ spliceImmediateFlag: attrBoolean,
3260
+ uniqueProgramId: attrInt,
3261
+ availNum: attrInt,
3262
+ availsExpected: attrInt,
3263
+ Program: element(programType, options),
3264
+ BreakDuration: element(breakDurationType, options)
3265
+ };
3266
+ var timeSignalType = {
3267
+ SpliceTime: element(spliceTimeType, options)
3268
+ };
3269
+ var spliceNullType = {};
3270
+ var spliceInfoSectionType = {
3271
+ ptsAdjustment: attrInt,
3272
+ tier: attrInt,
3273
+ SpliceNull: element(spliceNullType, options),
3274
+ SpliceInsert: element(spliceInsertType, options),
3275
+ TimeSignal: element(timeSignalType, options),
3276
+ SegmentationDescriptor: elements(segmentationDescriptorType, options)
3277
+ };
3278
+ var binaryType = {
3279
+ _content: charactersString
3280
+ };
3281
+ var signalType = {
3282
+ Binary: element(binaryType, options)
3283
+ };
3284
+ var scte35EventXmlRules = {
3285
+ Signal: element(signalType, options),
3286
+ SpliceInfoSection: element(spliceInfoSectionType, options)
3287
+ };
3288
+ function createDashScte35EventXmlRules() {
3289
+ return {
3290
+ MPD: element(
3291
+ {
3292
+ Period: elements(
3293
+ {
3294
+ EventStream: elements({
3295
+ Event: elements(scte35EventXmlRules)
3296
+ })
3297
+ },
3298
+ { minOccurs: 1 }
3299
+ )
3300
+ },
3301
+ { required: true, namespaceUri: dashNamespaceUri }
3302
+ )
3303
+ };
3304
+ }
3305
+
3204
3306
  // src/manifest/dashParser.ts
3205
3307
  var dashDrmRules = mergeXmlRules(
3206
3308
  dashManifestXmlRules(),
3207
3309
  createDashProtectionXmlRules(cencXmlRules),
3208
- createDashProtectionXmlRules(playreadyXmlRules)
3310
+ createDashProtectionXmlRules(playreadyXmlRules),
3311
+ createDashScte35EventXmlRules()
3209
3312
  );
3210
3313
  var dashDrmRulesMapped = mapXmlRules(dashDrmRules);
3211
3314
  function dashManifestHandler() {
@@ -3337,11 +3440,11 @@
3337
3440
  * promise will be awaited. The executor should either always return a promise, or never.
3338
3441
  * @param options Optional configuration for the benchmark.
3339
3442
  */
3340
- constructor(name, executor, options) {
3443
+ constructor(name, executor, options2) {
3341
3444
  __publicField(this, "name", name);
3342
3445
  __publicField(this, "executor", executor);
3343
3446
  __publicField(this, "options");
3344
- this.options = __spreadValues(__spreadValues({}, defaultBenchmarkOptions), options);
3447
+ this.options = __spreadValues(__spreadValues({}, defaultBenchmarkOptions), options2);
3345
3448
  }
3346
3449
  async run() {
3347
3450
  const opts = this.options;
@@ -3391,8 +3494,8 @@
3391
3494
  };
3392
3495
  __publicField(_Benchmark, "semaphore", nextFrame());
3393
3496
  var Benchmark = _Benchmark;
3394
- function benchmark(name, executor, options) {
3395
- const benchmark2 = new Benchmark(name, executor, options);
3497
+ function benchmark(name, executor, options2) {
3498
+ const benchmark2 = new Benchmark(name, executor, options2);
3396
3499
  return benchmark2.run().then((results) => {
3397
3500
  console.log(results.toString());
3398
3501
  return results;
@@ -4019,8 +4122,8 @@
4019
4122
  });
4020
4123
  return container;
4021
4124
  }
4022
- function createEl(tagName, parent, options) {
4023
- const element2 = document.createElement(tagName, options);
4125
+ function createEl(tagName, parent, options2) {
4126
+ const element2 = document.createElement(tagName, options2);
4024
4127
  if (parent) parent.appendChild(element2);
4025
4128
  return element2;
4026
4129
  }