@imferno/wasm 3.0.2-fix-working-group-resolutions.9aee1e2 → 3.0.2-fix-napi-typescript-types.ddf740f

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/README.md CHANGED
@@ -17,28 +17,29 @@ The package ships a prebuilt `.wasm` binary -- no build step required.
17
17
  ## Usage
18
18
 
19
19
  ```javascript
20
- import { buildReport, formatReport, codes, getVersion } from '@imferno/wasm';
20
+ import { validate, formatReport, codes, getVersion } from '@imferno/wasm';
21
21
 
22
22
  // Validate a full IMF package (pass all XML files as a map)
23
- const report = await buildReport({
23
+ const result = await validate({
24
24
  'ASSETMAP.xml': assetmapXml,
25
25
  'PKL_abc.xml': pklXml,
26
26
  'CPL_def.xml': cplXml,
27
27
  });
28
28
 
29
- // Pretty-print the report
30
- console.log(await formatReport(report));
29
+ // Pretty-print the result
30
+ console.log(await formatReport(result));
31
31
 
32
32
  // Check compliance programmatically
33
- if (!report.validation.is_compliant) {
34
- for (const err of report.validation.errors) {
33
+ if (!result.validation.is_compliant) {
34
+ for (const err of result.validation.errors) {
35
35
  console.error(err.code, err.message);
36
36
  }
37
37
  }
38
38
 
39
39
  // Inspect package metadata
40
- console.log('CPL count:', report.package.cplCount);
41
- console.log('CPLs:', report.cpls);
40
+ const cpls = Object.values(result.package.compositionPlaylists);
41
+ console.log('CPL count:', cpls.length);
42
+ console.log('Titles:', cpls.map((cpl) => cpl.contentTitle));
42
43
 
43
44
  // Get library version
44
45
  console.log(await getVersion());
@@ -72,10 +73,15 @@ WASM initialization is handled automatically on first call.
72
73
 
73
74
  | Export | Description |
74
75
  |--------|-------------|
75
- | `buildReport(files, options?)` | Parse and validate an IMF package, returns an `ImfReport` |
76
- | `formatReport(report)` | Render an `ImfReport` as a human-readable string |
76
+ | `validate(files, options?)` | Parse and validate an IMF package, returns `{ package, validation }` (`ValidationResult`) |
77
+ | `parsePackage(files)` | Parse without validating, returns the full package (`Imferno`) |
78
+ | `buildReport(files, options?)` | Legacy: parse and validate, returns an `ImfReport` summary |
79
+ | `formatReport(result)` | Render a `ValidationResult` (or legacy `ImfReport`) as a human-readable string |
77
80
  | `codes` | Typed validation code constants for use in `rules` config |
78
81
  | `getVersion()` | Get library version |
82
+ | `init(wasmBytes?)` | Optional explicit initialisation |
83
+
84
+ All value types (`ValidationResult`, `ValidationIssue`, `ValidateOptions`, ...) are exported for TypeScript.
79
85
 
80
86
  All exports are **async** (WASM must be initialized before use).
81
87
 
package/imferno_wasm.d.ts CHANGED
@@ -1,486 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export interface Asset {
4
- id: ImfUuid;
5
- packingList: boolean | null;
6
- chunkList: ChunkList;
7
- }
8
-
9
- export interface AssetList {
10
- assets: Asset[];
11
- }
12
-
13
- export interface AssetMap {
14
- id: ImfUuid;
15
- annotationText: string | null;
16
- creator: string | null;
17
- volumeCount: number;
18
- issueDate: string;
19
- issuer: string | null;
20
- assetList: AssetList;
21
- }
22
-
23
- export interface AudienceElement {
24
- @scope?: string | null;
25
- $text?: string | null;
26
- }
27
-
28
- export interface AudioSubDescriptors {
29
- SoundfieldGroupLabelSubDescriptor?: SoundfieldGroupLabelSubDescriptor | null;
30
- }
31
-
32
- export interface CDCIDescriptor {
33
- InstanceUID?: string | null;
34
- StoredWidth?: number | null;
35
- StoredHeight?: number | null;
36
- DisplayWidth?: number | null;
37
- DisplayHeight?: number | null;
38
- ActiveWidth?: number | null;
39
- ActiveHeight?: number | null;
40
- SampleRate?: EditRate | null;
41
- ImageAspectRatio?: string | null;
42
- ColorPrimaries?: ColorPrimaries | null;
43
- TransferCharacteristic?: TransferCharacteristic | null;
44
- CodingEquations?: CodingEquations | null;
45
- PictureCompression?: VideoCodec | null;
46
- ComponentDepth?: number | null;
47
- FrameLayout?: string | null;
48
- DisplayF2Offset?: number | null;
49
- HorizontalSubsampling?: number | null;
50
- VerticalSubsampling?: number | null;
51
- ColorSiting?: number | null;
52
- BlackRefLevel?: number | null;
53
- WhiteRefLevel?: number | null;
54
- ColorRange?: number | null;
55
- StoredF2Offset?: number | null;
56
- SampledWidth?: number | null;
57
- SampledHeight?: number | null;
58
- SampledXOffset?: number | null;
59
- SampledYOffset?: number | null;
60
- AlphaTransparency?: string | null;
61
- ImageAlignmentOffset?: number | null;
62
- ImageStartOffset?: number | null;
63
- ImageEndOffset?: number | null;
64
- FieldDominance?: number | null;
65
- ReversedByteOrder?: string | null;
66
- PaddingBits?: number | null;
67
- AlphaSampleDepth?: number | null;
68
- LinkedTrackID?: number | null;
69
- SubDescriptors?: VideoSubDescriptors | null;
70
- }
71
-
72
- export interface Chunk {
73
- path: string;
74
- volumeIndex: number;
75
- }
76
-
77
- export interface ChunkList {
78
- chunks: Chunk[];
79
- }
80
-
81
- export interface CompositionPlaylist {
82
- id: ImfUuid;
83
- annotation?: LanguageString | null;
84
- issueDate: string;
85
- issuer?: LanguageString | null;
86
- creator?: LanguageString | null;
87
- contentOriginator?: LanguageString | null;
88
- contentTitle: LanguageString;
89
- contentKind?: ContentKindElement;
90
- contentVersionList?: ContentVersionList | null;
91
- essenceDescriptorList?: EssenceDescriptorList | null;
92
- editRate?: EditRate | null;
93
- totalRunningTime?: string | null;
94
- localeList?: LocaleList | null;
95
- extensionProperties?: ExtensionProperties | null;
96
- compositionTimecode?: CompositionTimecode | null;
97
- segmentList: SegmentList;
98
- }
99
-
100
- export interface CompositionTimecode {
101
- timecodeDropFrame: boolean | null;
102
- timecodeRate: number | null;
103
- timecodeStartAddress: string | null;
104
- }
105
-
106
- export interface ContainerConstraintsSubDescriptor {
107
- InstanceID?: string | null;
108
- }
109
-
110
- export interface ContentKindElement {
111
- kind: ContentKind;
112
- scope: string | null;
113
- }
114
-
115
- export interface ContentMaturityRating {
116
- agency: string;
117
- rating?: string | null;
118
- audience?: AudienceElement | null;
119
- }
120
-
121
- export interface ContentMaturityRatingList {
122
- contentMaturityRatings: ContentMaturityRating[];
123
- }
124
-
125
- export interface ContentVersion {
126
- id: string;
127
- labelText?: LanguageString | null;
128
- }
129
-
130
- export interface ContentVersionList {
131
- contentVersions: ContentVersion[];
132
- }
133
-
134
- export interface DCTimedTextDescriptor {
135
- InstanceID?: string | null;
136
- LinkedTrackID?: number | null;
137
- SampleRate?: EditRate | null;
138
- RFC5646LanguageTagList?: LanguageTag[];
139
- NamespaceURI?: string | null;
140
- }
141
-
142
- export interface EditRate {
143
- numerator: number;
144
- denominator: number;
145
- }
146
-
147
- export interface EssenceDescriptor {
148
- id: ImfUuid;
149
- rgbaDescriptor?: RGBADescriptor | null;
150
- cdciDescriptor?: CDCIDescriptor | null;
151
- wavePCMDescriptor?: WAVEPCMDescriptor | null;
152
- dcTimedTextDescriptor?: DCTimedTextDescriptor | null;
153
- iabEssenceDescriptor?: IABEssenceDescriptor | null;
154
- isxdDataEssenceDescriptor?: ISXDDataEssenceDescriptor | null;
155
- }
156
-
157
- export interface EssenceDescriptorList {
158
- essenceDescriptors: EssenceDescriptor[];
159
- }
160
-
161
- export interface ExtensionProperties {
162
- applicationIdentification?: string | null;
163
- maxCLL?: number | null;
164
- maxFALL?: number | null;
165
- }
166
-
167
- export interface ForcedNarrativeSequence {
168
- id: ImfUuid;
169
- trackId: ImfUuid;
170
- resourceList: ResourceList;
171
- }
172
-
173
- export interface HearingImpairedCaptionsSequence {
174
- id: ImfUuid;
175
- trackId: ImfUuid;
176
- resourceList: ResourceList;
177
- }
178
-
179
- export interface IABChannelSubDescriptor {
180
- IABBedMetaID?: number | null;
181
- IABChannelID?: number | null;
182
- }
183
-
184
- export interface IABEssenceDescriptor {
185
- InstanceID?: string | null;
186
- LinkedTrackID?: number | null;
187
- SampleRate?: EditRate | null;
188
- AudioSampleRate?: EditRate | null;
189
- ChannelCount?: number | null;
190
- QuantizationBits?: number | null;
191
- ContainerFormat?: string | null;
192
- SoundCompression?: string | null;
193
- Codec?: string | null;
194
- ElectrospatialFormulation?: number | null;
195
- SubDescriptors?: IABSubDescriptors | null;
196
- }
197
-
198
- export interface IABSequence {
199
- id: ImfUuid;
200
- trackId: ImfUuid;
201
- resourceList: ResourceList;
202
- }
203
-
204
- export interface IABSoundfieldLabelSubDescriptor {
205
- InstanceID?: string | null;
206
- MCATagSymbol?: McaTagSymbol | null;
207
- MCATagName?: string | null;
208
- MCALabelDictionaryID?: string | null;
209
- RFC5646SpokenLanguage?: LanguageTag | null;
210
- }
211
-
212
- export interface IABSubDescriptors {
213
- IABSoundfieldLabelSubDescriptor?: IABSoundfieldLabelSubDescriptor | null;
214
- IABChannelSubDescriptor?: IABChannelSubDescriptor[];
215
- }
216
-
217
- export interface ISXDDataEssenceDescriptor {
218
- InstanceID?: string | null;
219
- LinkedTrackID?: number | null;
220
- SampleRate?: EditRate | null;
221
- DataEssenceCoding?: string | null;
222
- NamespaceURI?: string | null;
223
- SubDescriptors?: IsxdSubDescriptors | null;
224
- }
225
-
226
- export interface ISXDSequence {
227
- id: ImfUuid;
228
- trackId: ImfUuid;
229
- resourceList: ResourceList;
230
- }
231
-
232
- export interface IsxdSubDescriptors {
233
- ContainerConstraintsSubDescriptor?: ContainerConstraintsSubDescriptor | null;
234
- }
235
-
236
- export interface J2CLayout {
237
- RGBAComponent?: RGBALayoutComponent[];
238
- }
239
-
240
- export interface J2KCcapi {
241
- UInt16?: number[];
242
- }
243
-
244
- export interface J2KComponentSizing {
245
- Ssiz?: number | null;
246
- XRSiz?: number | null;
247
- YRSiz?: number | null;
248
- }
249
-
250
- export interface J2KExtendedCapabilities {
251
- Pcap?: number | null;
252
- Ccapi?: J2KCcapi | null;
253
- }
254
-
255
- export interface JPEG2000SubDescriptor {
256
- InstanceID?: string | null;
257
- Rsiz?: number | null;
258
- Xsiz?: number | null;
259
- Ysiz?: number | null;
260
- XOsiz?: number | null;
261
- YOsiz?: number | null;
262
- XTsiz?: number | null;
263
- YTsiz?: number | null;
264
- XTOsiz?: number | null;
265
- YTOsiz?: number | null;
266
- Csiz?: number | null;
267
- CodingStyleDefault?: string | null;
268
- QuantizationDefault?: string | null;
269
- J2CLayout?: J2CLayout | null;
270
- J2KExtendedCapabilities?: J2KExtendedCapabilities | null;
271
- PictureComponentSizing?: PictureComponentSizing | null;
272
- }
273
-
274
- export interface LanguageList {
275
- languages: LanguageTag[];
276
- }
277
-
278
- export interface LanguageString {
279
- text: string;
280
- language: LanguageTag | null;
281
- }
282
-
283
- export interface Locale {
284
- languageList?: LanguageList | null;
285
- regionList?: RegionList | null;
286
- contentMaturityRatingList?: ContentMaturityRatingList | null;
287
- }
288
-
289
- export interface LocaleList {
290
- locales?: Locale[];
291
- }
292
-
293
- export interface MainAudioSequence {
294
- id: ImfUuid;
295
- trackId: ImfUuid;
296
- resourceList: ResourceList;
297
- }
298
-
299
- export interface MainImageSequence {
300
- id: ImfUuid;
301
- trackId: ImfUuid;
302
- resourceList: ResourceList;
303
- }
304
-
305
- export interface MarkerInfo {
306
- annotation?: string | null;
307
- label: MarkerLabelElement;
308
- offset: number;
309
- }
310
-
311
- export interface MarkerLabelElement {
312
- label: MarkerLabel;
313
- scope: string | null;
314
- }
315
-
316
- export interface MarkerSequence {
317
- id: ImfUuid;
318
- trackId: ImfUuid;
319
- resourceList: ResourceList;
320
- }
321
-
322
- export interface PHDRMetadataTrackSubDescriptor {
323
- InstanceID?: string | null;
324
- PHDRMetadataTrackSubDescriptor_DataDefinition?: string | null;
325
- PHDRMetadataTrackSubDescriptor_SimplePayloadSID?: number | null;
326
- PHDRMetadataTrackSubDescriptor_SourceTrackID?: number | null;
327
- }
328
-
329
- export interface PictureComponentSizing {
330
- J2KComponentSizing?: J2KComponentSizing[];
331
- }
332
-
333
- export interface RGBADescriptor {
334
- InstanceID?: string | null;
335
- DisplayWidth?: number | null;
336
- DisplayHeight?: number | null;
337
- StoredWidth?: number | null;
338
- StoredHeight?: number | null;
339
- SampleRate?: EditRate | null;
340
- ImageAspectRatio?: string | null;
341
- ColorPrimaries?: ColorPrimaries | null;
342
- TransferCharacteristic?: TransferCharacteristic | null;
343
- CodingEquations?: CodingEquations | null;
344
- PictureCompression?: VideoCodec | null;
345
- FrameLayout?: string | null;
346
- DisplayF2Offset?: number | null;
347
- ComponentMaxRef?: number | null;
348
- ComponentMinRef?: number | null;
349
- ScanningDirection?: string | null;
350
- StoredF2Offset?: number | null;
351
- SampledWidth?: number | null;
352
- SampledHeight?: number | null;
353
- SampledXOffset?: number | null;
354
- SampledYOffset?: number | null;
355
- AlphaTransparency?: string | null;
356
- ImageAlignmentOffset?: number | null;
357
- ImageStartOffset?: number | null;
358
- ImageEndOffset?: number | null;
359
- FieldDominance?: number | null;
360
- AlphaMaxRef?: number | null;
361
- AlphaMinRef?: number | null;
362
- Palette?: string | null;
363
- PaletteLayout?: string | null;
364
- LinkedTrackID?: number | null;
365
- SubDescriptors?: VideoSubDescriptors | null;
366
- }
367
-
368
- export interface RGBALayoutComponent {
369
- Code?: string;
370
- ComponentSize?: number;
371
- }
372
-
373
- export interface RegionList {
374
- regions: string[];
375
- }
376
-
377
- export interface Resolution {
378
- width: number;
379
- height: number;
380
- }
381
-
382
- export interface Resource {
383
- id: ImfUuid;
384
- annotation?: LanguageString | null;
385
- editRate?: EditRate | null;
386
- intrinsicDuration: number;
387
- entryPoint?: number | null;
388
- sourceDuration?: number | null;
389
- sourceEncoding?: ImfUuid | null;
390
- trackFileId?: ImfUuid | null;
391
- repeatCount?: number | null;
392
- keyId?: ImfUuid | null;
393
- hash?: string | null;
394
- markers?: MarkerInfo[];
395
- }
396
-
397
- export interface ResourceList {
398
- resources?: Resource[];
399
- }
400
-
401
- export interface Segment {
402
- id: ImfUuid;
403
- sequenceList: SequenceList;
404
- }
405
-
406
- export interface SegmentList {
407
- segments?: Segment[];
408
- }
409
-
410
- export interface SequenceList {
411
- markerSequences?: MarkerSequence[];
412
- mainImageSequences?: MainImageSequence[];
413
- mainAudioSequences?: MainAudioSequence[];
414
- subtitlesSequences?: SubtitlesSequence[];
415
- hearingImpairedCaptionsSequences?: HearingImpairedCaptionsSequence[];
416
- forcedNarrativeSequences?: ForcedNarrativeSequence[];
417
- iabSequences?: IABSequence[];
418
- isxdSequences?: ISXDSequence[];
419
- }
420
-
421
- export interface SoundfieldGroupLabelSubDescriptor {
422
- MCATagSymbol?: McaTagSymbol | null;
423
- MCATagName?: string | null;
424
- MCAAudioContentKind?: string | null;
425
- RFC5646SpokenLanguage?: LanguageTag | null;
426
- }
427
-
428
- export interface SubtitlesSequence {
429
- id: ImfUuid;
430
- trackId: ImfUuid;
431
- resourceList: ResourceList;
432
- }
433
-
434
- export interface TrackInfo {
435
- track_id: string;
436
- track_type: string;
437
- codec: string;
438
- language: string | null;
439
- channels: string | null;
440
- format_details: string | null;
441
- resolution: string | null;
442
- framerate: string | null;
443
- bit_depth: string | null;
444
- subtitle_type: string | null;
445
- }
446
-
447
- export interface VideoSubDescriptors {
448
- PHDRMetadataTrackSubDescriptor?: PHDRMetadataTrackSubDescriptor | null;
449
- JPEG2000SubDescriptor?: JPEG2000SubDescriptor | null;
450
- }
451
-
452
- export interface VolumeIndex {
453
- index: number;
454
- }
455
-
456
- export interface WAVEPCMDescriptor {
457
- InstanceID?: string | null;
458
- SampleRate?: EditRate | null;
459
- AudioSampleRate?: EditRate | null;
460
- ChannelCount?: number | null;
461
- QuantizationBits?: number | null;
462
- LinkedTrackID?: number | null;
463
- SubDescriptors?: AudioSubDescriptors | null;
464
- }
465
-
466
- export type CodingEquations = "Bt601" | "Bt709" | "Bt2020Ncl" | { Unknown: string };
467
-
468
- export type ColorPrimaries = "Bt601_625" | "Bt601_525" | "Bt709" | "Bt2020" | "DciP3" | "P3D65" | { Unknown: string };
469
-
470
- export type ContentKind = "Feature" | "Trailer" | "Test" | "Promo" | "Teaser" | "RatingBump" | "Advertisement" | "Episode" | "Short" | "Commercial" | "PublicServiceAnnouncement" | { Other: string };
471
-
472
- export type CplNamespace = "Smpte2067_3_2013" | "Smpte2067_3_2016" | "Dci429_7" | { Unknown: string };
473
-
474
- export type LanguageTag = string;
475
-
476
- export type MarkerLabel = "Ffoc" | "Lfoc" | "Ffac" | "Lfac" | "Ffmc" | "Lfmc" | "Ffhc" | "Lfhc" | { Other: string };
477
-
478
- export type McaTagSymbol = "Sg51" | "Sg71" | "Sg71Ds" | "SgSt" | "SgMono" | "Iab" | "Left" | "Right" | "Center" | "Lfe" | "LeftSurround" | "RightSurround" | "LeftSideSurround" | "RightSideSurround" | "LeftRearSurround" | "RightRearSurround" | { Other: string };
479
-
480
- export type TransferCharacteristic = "Linear" | "Bt709" | "Smpte240M" | "XvYcc709" | "Bt2020" | "PqSt2084" | "Hlg" | { Unknown: string };
481
-
482
- export type VideoCodec = "Jpeg2000" | "Jpeg2000Imf2k" | "Jpeg2000Imf4k" | "Jpeg2000Imf8k" | "Jpeg2000Broadcast" | "Jpeg2000Ht" | "Vc5" | "Mpeg2" | "H264" | "H265" | "ProRes" | "Av1" | { Unknown: string };
483
-
484
3
 
485
4
  /**
486
5
  * Build a structured report from an IMF package.
@@ -499,10 +18,9 @@ export type VideoCodec = "Jpeg2000" | "Jpeg2000Imf2k" | "Jpeg2000Imf4k" | "Jpeg2
499
18
  export function buildReport(files: any, options: any): any;
500
19
 
501
20
  /**
502
- * Format a previously built `ImfReport` as a human-readable string.
21
+ * Format a validation result as a human-readable string.
503
22
  *
504
- * Pass the object returned by `buildReport()` (or any valid `ImfReport` JSON).
505
- * Returns the same output as `imferno report` on the CLI.
23
+ * Pass the object returned by `validate()`, or (legacy) by `buildReport()`.
506
24
  */
507
25
  export function formatReport(report: any): string;
508
26
 
package/imferno_wasm.js CHANGED
@@ -26,10 +26,9 @@ export function buildReport(files, options) {
26
26
  }
27
27
 
28
28
  /**
29
- * Format a previously built `ImfReport` as a human-readable string.
29
+ * Format a validation result as a human-readable string.
30
30
  *
31
- * Pass the object returned by `buildReport()` (or any valid `ImfReport` JSON).
32
- * Returns the same output as `imferno report` on the CLI.
31
+ * Pass the object returned by `validate()`, or (legacy) by `buildReport()`.
33
32
  * @param {any} report
34
33
  * @returns {string}
35
34
  */
@@ -228,10 +227,6 @@ function __wbg_get_imports() {
228
227
  const ret = arg0[arg1 >>> 0];
229
228
  return ret;
230
229
  },
231
- __wbg_get_with_ref_key_fc601247060b7204: function(arg0, arg1) {
232
- const ret = arg0[arg1];
233
- return ret;
234
- },
235
230
  __wbg_instanceof_ArrayBuffer_12cdaa4161423e6b: function(arg0) {
236
231
  let result;
237
232
  try {
Binary file
package/index.d.ts CHANGED
@@ -1,68 +1,61 @@
1
1
  /**
2
- * Auto-initializing IMF Parser TypeScript Definitions
2
+ * Auto-initializing imferno WASM bindings.
3
3
  *
4
- * All functions automatically handle WASM initialization.
4
+ * Every function initialises the WASM module on first use, so all of them
5
+ * return Promises. Value types (`ValidationResult`, `Imferno`, `ImfReport`,
6
+ * `ValidateOptions`, ...) live in ./types.d.ts, generated from the Rust types
7
+ * by `cargo xtask generate-types-ts` and shared verbatim with @imferno/node.
5
8
  */
6
9
 
7
- /** Parse ASSETMAP.xml content */
8
- export function parseAssetmapTyped(xmlContent: string): Promise<any>;
10
+ import type { ImfReport, Imferno, ValidateOptions, ValidationResult } from './types.js';
9
11
 
10
- /** Parse CPL XML content */
11
- export function parseCplTyped(xmlContent: string): Promise<any>;
12
+ export * from './types.js';
12
13
 
13
- /** Parse PKL XML content */
14
- export function parsePklTyped(xmlContent: string): Promise<any>;
15
-
16
- /** Parse VOLINDEX.xml content */
17
- export function parseVolindexTyped(xmlContent: string): Promise<any>;
18
-
19
- /** Options for the validate function */
20
- export interface ValidateOptions {
21
- /** Core constraints spec version: "auto" | "v2013" | "v2016" | "v2020" */
22
- coreSpec?: "auto" | "v2013" | "v2016" | "v2020";
23
- /** Application profile version: "auto" | "none" | "v2014" | "v2016" | "v2020" | "v2023" | "v2026" */
24
- app2eSpec?: "auto" | "none" | "v2014" | "v2016" | "v2020" | "v2023" | "v2026";
25
- /** ESLint-style rules configuration */
26
- rules?: Record<string, string>;
27
- }
14
+ /**
15
+ * Parse and validate an IMF package. This is the recommended entry point.
16
+ *
17
+ * Parse failures are reported as findings in `validation`, not thrown.
18
+ * @param files Object mapping filenames to XML string content
19
+ * @param options Optional validation options (spec selection, rules)
20
+ * @returns `{ package, validation }` — the full parsed package and all findings.
21
+ */
22
+ export function validate(
23
+ files: Record<string, string>,
24
+ options?: ValidateOptions | null,
25
+ ): Promise<ValidationResult>;
28
26
 
29
- /** Result returned by the validate function */
30
- export interface ValidateResult {
31
- /** Validation report with issues, compliance status, and profile */
32
- report: any;
33
- /** Parsed Composition Playlists */
34
- cpls: any[];
35
- /** Parsed AssetMap (null if parsing failed) */
36
- assetMap: any | null;
37
- /** Parsed Packing Lists */
38
- packingLists: any[];
39
- /** Parsed Volume Index (null if parsing failed) */
40
- volumeIndex: any | null;
41
- /** Assets in the AssetMap with no CPL or SCM reference */
42
- unreferencedAssets: { id: string; path: string }[];
43
- /** Sidecar assets declared in SCMs */
44
- declaredSidecars: { id: string; cplIds: string[] }[];
45
- }
27
+ /**
28
+ * Parse an IMF package without validating it.
29
+ * @param files Object mapping filenames to XML string content
30
+ * @returns The full parsed package. Rejects if the package cannot be parsed.
31
+ */
32
+ export function parsePackage(files: Record<string, string>): Promise<Imferno>;
46
33
 
47
34
  /**
48
- * Validate a full IMF package and return both validation report and parsed data.
35
+ * Legacy: validate and return the lossy `ImfReport` summary. Prefer `validate`.
49
36
  * @param files Object mapping filenames to XML string content
50
37
  * @param options Optional validation options (spec selection, rules)
51
- * @returns Validation report + parsed package data
38
+ * @returns Rejects if the package cannot be parsed.
52
39
  */
53
- export function validate(
40
+ export function buildReport(
54
41
  files: Record<string, string>,
55
- options?: ValidateOptions,
56
- ): Promise<ValidateResult>;
42
+ options?: ValidateOptions | null,
43
+ ): Promise<ImfReport>;
44
+
45
+ /**
46
+ * Pretty-print a validation result as a human-readable string.
47
+ * @param report The object `validate()` returned, or (legacy) `buildReport()`'s.
48
+ */
49
+ export function formatReport(report: ValidationResult | ImfReport): Promise<string>;
57
50
 
58
51
  /** Get the library version */
59
52
  export function getVersion(): Promise<string>;
60
53
 
61
- /** Manual WASM initialization (for advanced use) */
62
- export function init(wasmBuffer?: ArrayBuffer): Promise<void>;
54
+ /**
55
+ * Initialise the WASM module explicitly. Optional: every function initialises
56
+ * on first use. Pass the `.wasm` bytes to avoid fetching them.
57
+ */
58
+ export function init(wasmBytes?: ArrayBuffer | ArrayBufferView): Promise<void>;
63
59
 
64
60
  /** Typed validation code constants for use in rules config */
65
61
  export { codes } from './codes.js';
66
-
67
- /** Raw WASM bindings (for advanced use) */
68
- export declare const wasm: typeof import('./imferno_wasm.js');