@imferno/wasm 3.0.2-beta.40c3306 → 3.0.2-beta.58c1c3b
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 +19 -13
- package/codes.d.ts +241 -331
- package/codes.js +241 -331
- package/imferno_wasm.d.ts +18 -481
- package/imferno_wasm.js +173 -146
- package/imferno_wasm_bg.wasm +0 -0
- package/imferno_wasm_bg.wasm.d.ts +3 -1
- package/index.d.ts +67 -49
- package/index.js +23 -4
- package/package.json +4 -1
- package/types.d.ts +1496 -0
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 {
|
|
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
|
|
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
|
|
30
|
-
console.log(await formatReport(
|
|
29
|
+
// Pretty-print the result
|
|
30
|
+
console.log(await formatReport(result));
|
|
31
31
|
|
|
32
32
|
// Check compliance programmatically
|
|
33
|
-
if (!
|
|
34
|
-
for (const err of
|
|
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
|
-
|
|
41
|
-
console.log('
|
|
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());
|
|
@@ -59,8 +60,8 @@ const report = await buildReport(
|
|
|
59
60
|
coreSpec: 'v2020',
|
|
60
61
|
app2eSpec: 'v2023',
|
|
61
62
|
rules: {
|
|
62
|
-
[codes.
|
|
63
|
-
[codes.
|
|
63
|
+
[codes.ST2067_2.FileNotFound]: 'critical',
|
|
64
|
+
[codes.ST2067_2.ChecksumMismatch]: 'off',
|
|
64
65
|
},
|
|
65
66
|
},
|
|
66
67
|
);
|
|
@@ -72,10 +73,15 @@ WASM initialization is handled automatically on first call.
|
|
|
72
73
|
|
|
73
74
|
| Export | Description |
|
|
74
75
|
|--------|-------------|
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
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
|
|
|
@@ -118,7 +124,7 @@ All exports are **async** (WASM must be initialized before use).
|
|
|
118
124
|
| Field | Values | Default |
|
|
119
125
|
|-------|--------|---------|
|
|
120
126
|
| `coreSpec` | `"auto"`, `"v2013"`, `"v2016"`, `"v2020"` | auto-detect |
|
|
121
|
-
| `app2eSpec` | `"auto"`, `"none"`, `"
|
|
127
|
+
| `app2eSpec` | `"auto"`, `"none"`, `"v2014"`, `"v2016"`, `"v2020"`, `"v2023"`, `"v2026"` | auto-detect |
|
|
122
128
|
| `rules` | ESLint-style rules object (`{ [code]: severity }`) | all enabled |
|
|
123
129
|
|
|
124
130
|
Rule severities: `"critical"`, `"error"`, `"warning"`, `"info"`, `"off"`.
|