@imferno/node 3.0.2-beta.2427eb9 → 3.0.2-beta.2609f57

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/types.d.ts CHANGED
@@ -6,6 +6,18 @@
6
6
  * ship their own copy: the WASM build serialises some CPL fields in camelCase.
7
7
  */
8
8
 
9
+ export type RuleValidationReason =
10
+ | {
11
+ kind: "unknown_source";
12
+ variant: string;
13
+ }
14
+ | {
15
+ kind: "matches_nothing";
16
+ }
17
+ | {
18
+ hint: string;
19
+ kind: "unsupported_pattern";
20
+ };
9
21
  /**
10
22
  * A SMPTE IMF UUID, serialised as a bare UUID string (e.g. "0eb3d1b9-b77b-4d3f-bbe5-7c69b15dca85")
11
23
  */
@@ -39,9 +51,33 @@ export type Severity = "Info" | "Warning" | "Error" | "Critical";
39
51
  *
40
52
  * Encodes the "prose vs XSD" provenance distinction that SMPTE ST 2067-3 §5.1 calls out ("the prose document takes precedence on conflict"), so callers can filter, group, or apply per-source severity overrides without inspecting the code string.
41
53
  *
42
- * Currently *inferred* from the code prefix on a `ValidationIssue` (see `ValidationIssue::source`) — no engine code needs to set it explicitly. If inference ever becomes ambiguous (e.g. a non-XSD engine internal rule that wants the `XSD/` prefix for catalogue reasons), we can add a `with_source()` builder without changing the public shape.
54
+ * Derived from the rule's spec (`Spec::source`): `XSD` rules are `XsdLayer`, `IMFERNO` rules `EngineInternal`, SMPTE specs `ProseRule`.
43
55
  */
44
56
  export type IssueSource = "XsdLayer" | "ProseRule" | "EngineInternal";
57
+ /**
58
+ * A document whose rules imferno checks.
59
+ */
60
+ export type Spec =
61
+ | "ST377-1"
62
+ | "ST377-4"
63
+ | "ST429-8"
64
+ | "ST429-9"
65
+ | "ST2067-2"
66
+ | "ST2067-3"
67
+ | "ST2067-5"
68
+ | "ST2067-9"
69
+ | "ST2067-20"
70
+ | "ST2067-21"
71
+ | "ST2067-201"
72
+ | "ST2067-202"
73
+ | "ST2067-203"
74
+ | "ST2067-204"
75
+ | "XSD"
76
+ | "IMFERNO";
77
+ /**
78
+ * Normative strength of a rule in an edition's text.
79
+ */
80
+ export type Strength = "shall" | "should" | "may" | "deprecated";
45
81
  /**
46
82
  * Validation profile determining strictness
47
83
  */
@@ -99,6 +135,7 @@ export type VideoCodec =
99
135
  | "Jpeg2000Imf8k"
100
136
  | "Jpeg2000Broadcast"
101
137
  | "Jpeg2000Ht"
138
+ | "Jpeg2000HtNode"
102
139
  | "Vc5"
103
140
  | "Mpeg2"
104
141
  | "H264"
@@ -195,6 +232,10 @@ export type RuleSeverity = "off" | "info" | "warn" | "error" | "critical";
195
232
  export interface ImfReport {
196
233
  cpls: CplReport[];
197
234
  package: PackageSummary;
235
+ /**
236
+ * Keys of the `rules` option that select no rule (typos, unknown editions); they were ignored. Absent when every key matched.
237
+ */
238
+ ruleWarnings?: RuleValidationWarning[];
198
239
  validation: ValidationReport;
199
240
  }
200
241
  export interface CplReport {
@@ -285,6 +326,18 @@ export interface UnreferencedAsset {
285
326
  id: string;
286
327
  path: string;
287
328
  }
329
+ /**
330
+ * A diagnostic about a `RulesConfig` key that the engine couldn't match.
331
+ *
332
+ * Produced by `RulesConfig::validate`. Operators can use these at config-load time to catch typos before any validation work runs.
333
+ */
334
+ export interface RuleValidationWarning {
335
+ /**
336
+ * The configured key that triggered the warning.
337
+ */
338
+ key: string;
339
+ reason: RuleValidationReason;
340
+ }
288
341
  /**
289
342
  * Comprehensive validation report
290
343
  */
@@ -305,6 +358,10 @@ export interface ValidationReport {
305
358
  * Whether the package is compliant with base SMPTE standards
306
359
  */
307
360
  is_compliant: boolean;
361
+ /**
362
+ * Whether everything in the package was validated. False when a finding says part of it was not (e.g. `IMFERNO:Cpl/ExtensionSequenceNotValidated` for S-ADM audio): then `is_compliant` only covers what was checked. A rule override that switches such a finding `off` moves it to `suppressed` but keeps this false.
363
+ */
364
+ is_fully_validated: boolean;
308
365
  /**
309
366
  * Whether the package is playable despite issues
310
367
  */
@@ -326,16 +383,22 @@ export interface ValidationReport {
326
383
  warnings: ValidationIssue[];
327
384
  }
328
385
  /**
329
- * A single validation issue
386
+ * A single validation finding.
387
+ *
388
+ * Created only through `ValidationIssue::from_rule`: severity, category, clause and display code all come from the rule table row of the edition that was applied.
330
389
  */
331
390
  export interface ValidationIssue {
332
391
  /**
333
- * Other `Location`s when this issue represents an aggregation of multiple identical-code occurrences (see `ValidationReport::aggregate`). Empty for fresh, un-aggregated issues. Skipped during serialisation when empty so the on-wire shape stays back-compatible for callers that don't aggregate.
392
+ * Other `Location`s when this issue represents an aggregation of multiple identical-code occurrences (see `ValidationReport::aggregate`). Empty for fresh, un-aggregated issues. Skipped during serialisation when empty.
334
393
  */
335
394
  additional_instances?: Location[];
336
395
  category: Category;
337
396
  /**
338
- * Error code (e.g., "ST2067-2:2020:8.3/FileNotFound")
397
+ * Clause of that edition the rule comes from (empty for pseudo-specs without clauses).
398
+ */
399
+ clause: string;
400
+ /**
401
+ * Display code: `SPEC:EDITION:CLAUSE/Name`, with the edition actually applied (e.g. `ST2067-3:2016:7.2/SegmentDuration`).
339
402
  */
340
403
  code: string;
341
404
  /**
@@ -344,15 +407,29 @@ export interface ValidationIssue {
344
407
  context: {
345
408
  [k: string]: string | undefined;
346
409
  };
410
+ /**
411
+ * Technical detail behind the message: the values, identifiers, URIs, file paths and clause text a person needs to locate or verify the finding. Shown after the message and the suggestion.
412
+ */
413
+ detail?: string | null;
414
+ /**
415
+ * Edition of the spec that was applied (`"2016"`; empty for single-edition pseudo-specs).
416
+ */
417
+ edition: string;
347
418
  location: Location;
348
419
  /**
349
- * Human-readable message
420
+ * What is wrong, in one short plain sentence for a person to read.
350
421
  */
351
422
  message: string;
423
+ /**
424
+ * Stable, edition-free rule id (`ST2067-3/SegmentDuration`).
425
+ */
426
+ rule: string;
352
427
  severity: Severity;
353
- source?: IssueSource;
428
+ source: IssueSource;
429
+ spec: Spec;
430
+ strength: Strength;
354
431
  /**
355
- * Suggestion for how to fix
432
+ * What to do about it.
356
433
  */
357
434
  suggestion?: string | null;
358
435
  }
@@ -392,6 +469,10 @@ export interface Location {
392
469
  * Segment index (0-based)
393
470
  */
394
471
  segment?: number | null;
472
+ /**
473
+ * Segment Id (`urn:uuid:…`) if applicable
474
+ */
475
+ segment_id?: string | null;
395
476
  /**
396
477
  * Sequence UUID if applicable
397
478
  */
@@ -486,10 +567,21 @@ export interface ChunkList {
486
567
  * A single file path entry in a ChunkList.
487
568
  */
488
569
  export interface Chunk {
570
+ /**
571
+ * `<Length>` in bytes, when present.
572
+ */
573
+ length?: number | null;
574
+ /**
575
+ * `<Offset>` in bytes, when present.
576
+ */
577
+ offset?: number | null;
489
578
  /**
490
579
  * File path relative to the IMP root directory.
491
580
  */
492
581
  path: string;
582
+ /**
583
+ * `<VolumeIndex>`; 1 when absent.
584
+ */
493
585
  volumeIndex: number;
494
586
  }
495
587
  /**
@@ -835,9 +927,9 @@ export interface IABEssenceDescriptor {
835
927
  */
836
928
  ContainerFormat?: string | null;
837
929
  /**
838
- * ST 2067-201 §5.9: ElectrospatialFormulation shall NOT be present.
930
+ * ST 2067-201 §5.9: if present, ElectrospatialFormulation shall be 15 (multi-channel mode default). Kept as written: RegXML writes the enumeration as its register symbol (`ElectroSpatialFormulation_MultiChannelMode`), some writers as the number. See `IABEssenceDescriptor::electrospatial_formulation_value`.
839
931
  */
840
- ElectrospatialFormulation?: number | null;
932
+ ElectrospatialFormulation?: string | null;
841
933
  InstanceID?: string | null;
842
934
  LinkedTrackID?: number | null;
843
935
  /**
@@ -861,7 +953,7 @@ export interface IABSubDescriptors {
861
953
  /**
862
954
  * Presence-only stub for ST 2067-201:2026 Annex E `IABChannelSubDescriptor`.
863
955
  *
864
- * The 2026 spec defines the full item set in Table E.1 (`IABBedMetaID`, `IABChannelID`, `IABAudioDescription`, `IABAudioDescriptionText`); imferno's CPL parser only needs to count occurrences to fire the `IabChannelSubDescriptorRecommended` warning, so the inner shape is intentionally permissive — any nested content deserialises into the catch-all map without affecting presence.
956
+ * The 2026 spec defines the full item set in Table E.1 (`IABBedMetaID`, `IABChannelID`, `IABAudioDescription`, `IABAudioDescriptionText`); imferno's CPL parser only needs to count occurrences to fire the `IabChannelSubDescriptorRecommended` notice, so the inner shape is intentionally permissive — any nested content deserialises into the catch-all map without affecting presence.
865
957
  */
866
958
  export interface IABChannelSubDescriptor {
867
959
  /**
@@ -890,6 +982,10 @@ export interface IABSoundfieldLabelSubDescriptor {
890
982
  * ISXD (Immersive Sound XML Data) essence descriptor — Dolby Atmos sidecar format
891
983
  */
892
984
  export interface ISXDDataEssenceDescriptor {
985
+ /**
986
+ * ST 2067-202 §9.1: the Essence Container UL shall be the Frame Wrapped ISXD Container UL (Table 3).
987
+ */
988
+ ContainerFormat?: string | null;
893
989
  DataEssenceCoding?: string | null;
894
990
  InstanceID?: string | null;
895
991
  LinkedTrackID?: number | null;
@@ -1015,6 +1111,10 @@ export interface WAVEPCMDescriptor {
1015
1111
  InstanceID?: string | null;
1016
1112
  LinkedTrackID?: number | null;
1017
1113
  QuantizationBits?: number | null;
1114
+ /**
1115
+ * ST 2067-2 Annex F (2013, 2016) / Annex E (2020): the edit rate of the image the audio is designed to sync to (§5.3.5 Table 6).
1116
+ */
1117
+ ReferenceImageEditRate?: EditRate | null;
1018
1118
  SampleRate?: EditRate | null;
1019
1119
  SubDescriptors?: AudioSubDescriptors | null;
1020
1120
  }
@@ -1036,6 +1136,9 @@ export interface SoundfieldGroupLabelSubDescriptor {
1036
1136
  */
1037
1137
  RFC5646SpokenLanguage?: LanguageTag | null;
1038
1138
  }
1139
+ /**
1140
+ * The CPL's `ExtensionProperties`: ApplicationIdentification (the Application IDs of every ST 2067-2 instance, space-separated), MaxCLL and MaxFALL.
1141
+ */
1039
1142
  export interface ExtensionProperties {
1040
1143
  ApplicationIdentification?: string | null;
1041
1144
  MaxCLL?: number | null;
@@ -1084,6 +1187,10 @@ export interface Segment {
1084
1187
  SequenceList: SequenceList;
1085
1188
  }
1086
1189
  export interface SequenceList {
1190
+ /**
1191
+ * Sequences whose element imferno does not model (ST 2067-3 §6.9.3 Extension Sequences, e.g. ST 2067-203 `MGASADMSignalSequence` or ST 2067-2 `CommentarySequence`), in document order. Filled by `parse_cpl` from the source XML so their EssenceDescriptor and Track File references resolve; no other rules are applied to them.
1192
+ */
1193
+ ExtensionSequence?: ExtensionSequence[];
1087
1194
  ForcedNarrativeSequence?: ForcedNarrativeSequence[];
1088
1195
  HearingImpairedCaptionsSequence?: HearingImpairedCaptionsSequence[];
1089
1196
  IABSequence?: IABSequence[];
@@ -1093,8 +1200,13 @@ export interface SequenceList {
1093
1200
  MarkerSequence?: MarkerSequence[];
1094
1201
  SubtitlesSequence?: SubtitlesSequence[];
1095
1202
  }
1096
- export interface ForcedNarrativeSequence {
1203
+ /**
1204
+ * A Sequence of a kind imferno does not model (ST 2067-3 §6.9.3 Extension Sequence). Every Sequence derives from SequenceType, so its Id, TrackId and Resources are kept; the element is named by `name` (local name) and `namespace` (namespace URI; null when the element has no namespace).
1205
+ */
1206
+ export interface ExtensionSequence {
1097
1207
  Id: ImfUuid;
1208
+ Name?: string;
1209
+ Namespace?: string | null;
1098
1210
  ResourceList: ResourceList;
1099
1211
  TrackId: ImfUuid;
1100
1212
  }
@@ -1109,17 +1221,40 @@ export interface Resource {
1109
1221
  Id: ImfUuid;
1110
1222
  IntrinsicDuration: number;
1111
1223
  KeyId?: ImfUuid | null;
1224
+ /**
1225
+ * `LeftEye` of a `cc:StereoImageTrackFileResourceType` resource (ST 2067-2:2013, :2016 and :2020). A stereo resource carries its SourceEncoding and TrackFileId per eye, not on the resource itself.
1226
+ */
1227
+ LeftEye?: StereoEye | null;
1112
1228
  Marker?: MarkerInfo[];
1113
1229
  RepeatCount?: number | null;
1230
+ /**
1231
+ * `RightEye` of a `cc:StereoImageTrackFileResourceType` resource.
1232
+ */
1233
+ RightEye?: StereoEye | null;
1114
1234
  SourceDuration?: number | null;
1115
1235
  SourceEncoding?: ImfUuid | null;
1116
1236
  TrackFileId?: ImfUuid | null;
1117
1237
  }
1238
+ /**
1239
+ * One eye of a stereo resource: a `cpl:TrackFileResourceType` (ST 2067-2). Only the track file reference fields are kept; the eye's timing fields are checked by the XSD layer.
1240
+ */
1241
+ export interface StereoEye {
1242
+ Hash?: string | null;
1243
+ Id?: ImfUuid | null;
1244
+ KeyId?: ImfUuid | null;
1245
+ SourceEncoding?: ImfUuid | null;
1246
+ TrackFileId?: ImfUuid | null;
1247
+ }
1118
1248
  export interface MarkerInfo {
1119
1249
  Annotation?: string | null;
1120
1250
  Label: MarkerLabelElement;
1121
1251
  Offset: number;
1122
1252
  }
1253
+ export interface ForcedNarrativeSequence {
1254
+ Id: ImfUuid;
1255
+ ResourceList: ResourceList;
1256
+ TrackId: ImfUuid;
1257
+ }
1123
1258
  export interface HearingImpairedCaptionsSequence {
1124
1259
  Id: ImfUuid;
1125
1260
  ResourceList: ResourceList;
@@ -1294,13 +1429,86 @@ export interface VolumeIndex {
1294
1429
  index: number;
1295
1430
  }
1296
1431
  /**
1297
- * ESLint-style per-rule severity overrides.
1298
- *
1299
- * Keys are either: - A rule suffix — `"SegmentDuration"` — matched against the part of the issue code after the last `/`. - A full normalised code — `"ST2067-3:2020:7.2.2/SegmentDuration"`.
1300
- *
1301
- * Values are the desired `RuleSeverity`, or `RuleSeverity::Off` to suppress the rule entirely.
1302
- *
1303
- * An empty map (the default) is a no-op.
1432
+ * Serializable rule description (`listRules()` entry).
1433
+ */
1434
+ export interface RuleInfo {
1435
+ category: Category;
1436
+ /**
1437
+ * What the rule checks.
1438
+ */
1439
+ description: string;
1440
+ /**
1441
+ * One row per edition of the spec imferno knows, oldest first.
1442
+ */
1443
+ editions: EditionInfo[];
1444
+ /**
1445
+ * A minimal illustration of a violation.
1446
+ */
1447
+ example?: string | null;
1448
+ /**
1449
+ * `<SPEC>/<Name>` — usable as a rules-config key (all editions).
1450
+ */
1451
+ id: string;
1452
+ /**
1453
+ * Name, unique within the spec; usable as a rules-config key (every rule with that name).
1454
+ */
1455
+ name: string;
1456
+ spec: Spec;
1457
+ }
1458
+ /**
1459
+ * Serializable edition row of a `RuleInfo`.
1460
+ */
1461
+ export interface EditionInfo {
1462
+ /**
1463
+ * Clause in this edition; absent when the edition does not contain the rule.
1464
+ */
1465
+ clause?: string | null;
1466
+ /**
1467
+ * Display code findings carry for this edition (`SPEC:EDITION:CLAUSE/Name`); absent when the edition does not contain the rule.
1468
+ */
1469
+ code?: string | null;
1470
+ defaultSeverity: Severity;
1471
+ /**
1472
+ * Edition label (`"2016"`; empty for single-edition pseudo-specs).
1473
+ */
1474
+ edition: string;
1475
+ /**
1476
+ * Interpretation the check follows.
1477
+ */
1478
+ interpretation?: InterpretationInfo | null;
1479
+ /**
1480
+ * Why the default severity differs from the strength's.
1481
+ */
1482
+ severityReason?: string | null;
1483
+ strength: Strength;
1484
+ /**
1485
+ * `false` while the strength is derived from the default severity.
1486
+ */
1487
+ strengthVerified: boolean;
1488
+ /**
1489
+ * The clause is known or suspected to be wrong.
1490
+ */
1491
+ suspect: boolean;
1492
+ /**
1493
+ * `true` only when the row was checked against this edition's text.
1494
+ */
1495
+ verified: boolean;
1496
+ }
1497
+ /**
1498
+ * Serializable `Interpretation`.
1499
+ */
1500
+ export interface InterpretationInfo {
1501
+ /**
1502
+ * What imferno does and why.
1503
+ */
1504
+ text: string;
1505
+ /**
1506
+ * Link to the issue or finding.
1507
+ */
1508
+ url?: string | null;
1509
+ }
1510
+ /**
1511
+ * ESLint-style per-rule severity overrides (see the module docs for the key forms and their precedence). An empty map (the default) is a no-op.
1304
1512
  */
1305
1513
  export interface RulesConfig {
1306
1514
  [k: string]: RuleSeverity | undefined;
@@ -1312,12 +1520,36 @@ export interface RulesConfig {
1312
1520
  */
1313
1521
  export interface ValidationResult {
1314
1522
  package: Imferno;
1523
+ /**
1524
+ * Keys of the `rules` option that select no rule (typos, unknown editions); they were ignored. Absent when every key matched.
1525
+ */
1526
+ rule_warnings?: RuleValidationWarning[];
1315
1527
  validation: ValidationReport;
1316
1528
  }
1317
1529
 
1318
- /** Core constraints (ST 2067-2) edition to validate against. `"auto"` detects it from the CPL. */
1530
+ /**
1531
+ * Core constraints (ST 2067-2) edition to validate against. `"auto"` detects
1532
+ * it from the package and CPLs. A pinned edition also pins the editions it
1533
+ * cites (ST 2067-3, ST 2067-201 for IAB, ST 377-1/377-4 for MXF), over the
1534
+ * documents' namespaces, unless `cplSpec` / `iabSpec` pin those separately.
1535
+ */
1319
1536
  export type CoreSpec = "auto" | "v2013" | "v2016" | "v2020";
1320
1537
 
1538
+ /**
1539
+ * Composition Playlist (ST 2067-3) edition to validate against; wins over the
1540
+ * edition `coreSpec` implies. ST 2067-3:2016 and :2020 share one namespace;
1541
+ * `"auto"` applies the newest unless the CPL uses something only one edition
1542
+ * defines, and reports the choice.
1543
+ */
1544
+ export type CplSpec = "auto" | "v2013" | "v2016" | "v2020";
1545
+
1546
+ /**
1547
+ * IAB plug-in (ST 2067-201) edition to validate against; wins over the edition
1548
+ * `coreSpec` implies. Every edition shares one namespace; `"auto"` applies
1549
+ * the newest and reports the choice.
1550
+ */
1551
+ export type IabSpec = "auto" | "v2019" | "v2021" | "v2026";
1552
+
1321
1553
  /**
1322
1554
  * App #2E (ST 2067-21) edition to validate against. `"auto"` uses the CPL's
1323
1555
  * ApplicationIdentification; `"none"` skips application-profile validation.
@@ -1328,6 +1560,10 @@ export type App2eSpec = "auto" | "none" | "v2014" | "v2016" | "v2020" | "v2023"
1328
1560
  export interface ValidateOptions {
1329
1561
  /** Core constraints edition. Default: `"auto"`. */
1330
1562
  coreSpec?: CoreSpec;
1563
+ /** Composition Playlist (ST 2067-3) edition. Default: `"auto"`. */
1564
+ cplSpec?: CplSpec;
1565
+ /** IAB plug-in (ST 2067-201) edition. Default: `"auto"`. */
1566
+ iabSpec?: IabSpec;
1331
1567
  /** App #2E edition. Default: `"auto"`. */
1332
1568
  app2eSpec?: App2eSpec;
1333
1569
  /** ESLint-style per-rule severity overrides, keyed by code, rule suffix, glob or `source:<kind>`. */